Fix PHPStan Errors while using FormBuilder

Oct 29, 2022
Form builder

If you are using FormBuilder (outside of admin panel) along with PHPStan, you may get an error

Access to an undefined property App\Http\Livewire\MyLivewireComponentWithForm::$form.

To solve this you can add the following docblock to your Livewire component:

use Filament\Forms\ComponentContainer;
use Filament\Forms\Contracts\HasForms;
* @property ComponentContainer $form
class MyLivewireComponentWithForm extends Component implements HasForms

No comments yet…