deprecated-packages / reveal-src

Static analysis for your templates is here!
9 stars 3 forks source link

[template phpstan compiler] PHPStan with reveal/template-phpstan-compiler ignore some (or all) parameters #22

Closed lulco closed 1 year ago

lulco commented 2 years ago

I have Nette application, and phpstan with nette extension. Everything was OK but after update package reveal/template-phpstan-compiler to dev-main d37707f, I got too many errors like:

Access to an undefined property Nette\Bridges\ApplicationLatte\Template::$benefits.
Access to an undefined property Nette\Database\Table\IRow::$page_title. 

It looks like it is ignoring some parameters (or all of them - I'm not sure here).

Mentioned errors are covered by parameter universalObjectCratesClasses which is set in phpstan-nette extension:

parameters:
...
    universalObjectCratesClasses:
        - Nette\Application\UI\ITemplate
        - Nette\Application\UI\Template
        - Nette\Bridges\ApplicationLatte\Template
        - Nette\Database\IRow
...

So it should be OK.

And it is OK with previous commits e.g. reveal/template-phpstan-compiler dev-main 6f4a503

Something went wrong in https://github.com/revealphp/template-phpstan-compiler/commit/d37707fc45382400734298fa76904fbd2b33ad26

I have no idea what this commit does :) I think the problem is something with PHPStanServicesFactory or FileAnalyserProvider. Like you are creating some new services and not using those already created and configured in phpstan.

Thanks for your help.

TomasVotruba commented 2 years ago

I don't use this project now, so I'm not able to help :)

I would suspect this line: https://github.com/revealphp/template-phpstan-compiler/commit/d37707fc45382400734298fa76904fbd2b33ad26#diff-4fe9872fda4e8d4d2b42eb0facda5a53d9f68feb0ef5693c56ff08cd34aa09f8L39

lulco commented 2 years ago

Yes, it looks like a problem. Can I rollback it? Or is there another solution? Why it work in tests?

TomasVotruba commented 2 years ago

Possibly tests are wrong :)