psalm / psalm-plugin-laravel

A Psalm plugin for Laravel
MIT License
307 stars 72 forks source link

ModelPropertyAccessorHandler::getClassLikeNames() returns unnecessary classes #244

Closed zlodes closed 1 year ago

zlodes commented 1 year ago

Describe the bug Seems that ModelPropertyAccessorHandler::getClassLikeNames() returns a lot of non-model classes:

image

It affects performance and may affect other classes property resolving.

Impacted Versions 2.0.2

Additional context

mr-feek commented 1 year ago

You didn't include the version of ide-helper used in your report, but we currently rely on the ide helper models generator command to find the models in your application --

2 choices here:

1) fix upstream in laravel-ide-helper 2) remove reliance on the ide-helper models command, and find the model classes ourselves by looping through the src directories being analyzed and checking the parent prototype of the inheritance chain to see if it is an eloquent model

alies-dev commented 1 year ago

I've reported an issue: https://github.com/barryvdh/laravel-ide-helper/issues/1414

Meanwhile, hack to bypass it is ready. I'll release it soon