TomasVotruba / bladestan

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

Import mapped variables into scope #48

Closed AJenbo closed 1 year ago

AJenbo commented 1 year ago

Fixes #31

This fixes the issue where variables created by @foreach() are not imported in to the scope of the Closure.

Specifically this is done by explicitly include the variables used in the alias expression of the @include directive.

That way things like ['amphibians' => $frogs + $toads, 'msg' => 'Welcome ' . $name] are correctly handled as well.

This also means that errors where an undefined variable is used will cause a single error at the place of @include rather then for ever usage in the included template.

TomasVotruba commented 1 year ago

Thank you :+1: