phpstan warning: unknown view

Why do you think phpstan is complaining about this being an unknown view? Everything functions fine though.
View::make('main_image')
->hiddenLabel()
->dehydrated(false)
->view('forms.components.property-main-image-placeholder'),
View::make('main_image')
->hiddenLabel()
->dehydrated(false)
->view('forms.components.property-main-image-placeholder'),
2 Replies
Mark Chaney
Mark ChaneyOP2y ago
Also, why i have your attention on the phpstan subject and typing, why does render() need so many types? Is it not simply a view being returned?
public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application
{
return view('livewire.property.photos-form');
}
public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application
{
return view('livewire.property.photos-form');
}
Ugh, i feel kind of dumb on the View part, it should be View::make('forms.components.property-main-image-placeholder'), might have just been copilot or force of habit with most components, etc. idk. lol ok, i think
public function render(): \Illuminate\Contracts\View\View
{
return view('livewire.property.photos-form');
}
public function render(): \Illuminate\Contracts\View\View
{
return view('livewire.property.photos-form');
}
might be enough. Just cant count on phpstorm setting it correctly. I know helper could return a factory if doing that, but not obviously not doing that here.
Dan Harrin
Dan Harrin2y ago
right on both counts the view contract is correct
Want results from more Discord servers?
Add your server