© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
howdu

Access to an undefined property $form

Inside a custom component with a Filament form how to keep PhpStan happy with error:
Access to an undefined property $form

When I declare it
protected $form;
protected $form;
the fill method throws error:
Call to a member function fill() on null

Type hinting with form
$form must not be accessed before initialization
Solution
Add a phpdoc
/** @property Form $form */
/** @property Form $form */
to the class
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

phpstan 'Access to an undefined property'
FilamentFFilament / ❓┊help
11mo ago
phpstan: Access to an undefined property App\Livewire\RegisterPage::$form.
FilamentFFilament / ❓┊help
3y ago
Undefined property: App\Filament\Pages\SettingsPage::$form
FilamentFFilament / ❓┊help
8mo ago
Undefined property User$id
FilamentFFilament / ❓┊help
7mo ago