TomasVotruba / bladestan

PHPStan analysis for Blade templates
https://tomasvotruba.com/blog/introducing-bladestan-phpstan-analysis-of-blade-templates/
MIT License
286 stars 14 forks source link

Only rendered blade files are checked #2

Closed szepeviktor closed 1 year ago

szepeviktor commented 1 year ago

From https://github.com/TomasVotruba/tomasvotruba.com/pull/1384#issuecomment-1454830723

I'm not sure.

parameters:
    paths:
        - app/View/
    level: 0
    templatePaths:
        - resources/views/

with this configuration blade files are not checked.

parameters:
    paths:
        - resources/views/
    level: 0
    # phpstan for blade
    templatePaths:
        - resources/views/

this works.

TomasVotruba commented 1 year ago

I have no idea how the package works now. I'll need a reproducer test case with failing CI.

szepeviktor commented 1 year ago

May I contribute my default CI workflows? They are very long but 3 years of maintenance is included.

TomasVotruba commented 1 year ago

Give me a day or two to make CI pass first. I'm still rebooting package I've dperecated a year ago :)

https://packagist.org/packages/symplify/template-phpstan-compiler

If you come on Monday, that would be more useful for me :+1:

szepeviktor commented 1 year ago

Got it! When used with nunomaduro/larastan Blade files are ignored. Larastan makes Bladestan ignore them.

TomasVotruba commented 1 year ago

That's not it.

The testing PR uses both larastan and bladestan: https://github.com/TomasVotruba/tomasvotruba.com/pull/1387

szepeviktor commented 1 year ago

That PR does not set templatePaths, so only blade files in view() calls are checked.

...no, we have a default path.

I need to implement e2e testing. That will show this problem.

AJenbo commented 1 year ago

It might be good to look at how Larastan find view-strings and use a similar way to determin if it's a template that should be analyzed. From what I can see it looks like email templates are also not analyzed since they do not use view(), the same is true when a component uses $this->view() instead of view().

TomasVotruba commented 1 year ago

Closing as this is now mixing many various issues and getting messy :)

To re-open, please provide reproducer first, even if Github repository :+1:

szepeviktor commented 1 year ago

this is now mixing many various issues and getting messy :)

Yes!