TomasVotruba / bladestan

PHPStan analysis for Blade templates

Home Page:https://tomasvotruba.com/blog/introducing-bladestan-phpstan-analysis-of-blade-templates/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Livewire support

jamesRUS52 opened this issue · comments

the blade can access the public property of the livewire component without having to specify it as a parameter for "view" helper in the "render" method? like so

public $foo = 'bar';
public function render()
{
    return view('custom-livewire');
}

in blade
{{ $foo }}

Too many like this for each livewire component

Line app/Http/Requests/Requests/Livewire/View/ActionsLivewire.php


29 Variable $foo might not be defined.
29 Variable $foo might not be defined.
29 Variable $foo might not be defined.
29 Variable $foo might not be defined.
29 Variable $foo might not be defined.
29 Variable $foo might not be defined.


This also holds true for components, but you can workaround it by explicitly providing the variables.

public $foo = 'bar';
public function render()
{
    return view('custom-livewire', [
        'foo' => $this->foo,
    ]);
}

On that note I would also suggest that you use $this->view() rather then view() or the context will be unclear since it will be using reflection to detect and copy the properties.

Any news on whether this could be solved more elegantly with Livewire v3? 🤞

Is there some change that makes you think it would?