bladestan: The array shape of view() is not picked up if given as a variable
$data = [
// ...
'user' => $userBloc->toArray(),
];
$response = view('viewName', $data)->render();
It says
185 Undefined variable: $user
rendered in: mandat/partials/viewName.blade.php:3
But if I use:
$response = view('viewName', [
// ...
'user' => $userBloc->toArray(),
])->render();
There is no more error
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (8 by maintainers)
Fixed by https://github.com/TomasVotruba/bladestan/pull/108
(support for
Illuminate\Mail\Mailable::view()->with()will be tracked separately)Met @AJenbo at a conference as he is my old coworker, someone talked about PHPParsing, this was mentioned and i gave it a try with this PR. There was some new challenges compared to some of the other analyzers they made, so we probably need some changes to make it more “non hacky”.
But there is hope out there and the testcase i made passed, similar to the first example you had, if we get that PR moving i would gladly take a look at the other example you presented.
If no one picks up the bounty I might take a stab at it in the next 2-3 weeks.
@williamdes Thanks 👍 Make sure you sponsor @AJenbo, he’s the main contributor last couple of years 💪