Open smares opened 2 years ago
It will be possible after the big 5.0 update.
For now... What if I just teach PhpStorm that $this
in the blade file is a ShowPost
class object?
I already have a PHP comment in my Blade file containing /** @var App\Http\Livewire\Component $this */
but it doesn't work for computed properties because there is no $fooBar
declared in the component. It hints getFooBarProperty()
and all other public properties and methods, though.
I'll try to make it working without phpDoc comment
For people wondering, this is how I do it in the mean-time:
/**
* @property-read bool $shouldShowBudget
*/
class MyComponent extends Component {}
An update here: Livewire now also supports computed properties via php attributes:
// old way:
protected function getProjectsProperty() { ... }
// Livewire 3's way:
#[\Livewire\Attributes\Computed]
protected function projects() { ... }
Sorry for hijacking https://github.com/laravel-idea/plugin/issues/353#issuecomment-893249453, thought it was related.
Would be awesome if Laravel Idea would support Livewire's computed properties (https://laravel-livewire.com/docs/2.x/properties#computed-properties) that work in a similar way to accessors where you define a public method
getFooBarProperty
which you can then access in the component Blade file using$this->fooBar
. With support, I mean clicking onfooBar
in the template would jump togetFooBarProperty
.