TomasVotruba / bladestan

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

Type of $this gets mangled when passed as a variable to blade #90

Open AJenbo opened 8 months ago

AJenbo commented 8 months ago

If in a component you use the following to pass the component model to the blade template:

view('my-template', ['model' => $this]);

The analyzed PHP code will looks like this:

/** @var $this(App\View\Components\MyForm) $model */

Thisisn't valid an will generate errors and warnings in PHPStan, instead the correctly generated phpDoc should look like this:

/** @var App\View\Components\MyForm $model */