Access to an undefined property Nette\Application\UI\Presenter
aleswita opened this issue · 6 comments
Hi,
any idea, how to fix errors like follow:
Access to an undefined property Nette\Application\UI\Presenter::$permission.
if I using code below in components?
$this->presenter->permission;
Hi, which version of nette/application are you using?
v2.4.9
For more details, I'm creating components as multiplier
/**
* @return Nette\Application\UI\Multiplier
*/
protected function createComponentRow(): Nette\Application\UI\Multiplier
{
return new Nette\Application\UI\Multiplier(function (int $id): App\Module\Components\Row {
return new App\Module\Components\Row($id);
});
}There's no property permission or Nette\Application\UI\Presenter, so PHPStan is right here: https://github.com/nette/application/blob/v2.4.9/src/Application/UI/Presenter.php
But I probably understand what's wrong with your code - you need to somehow persuade PHPStan that you're relying on the fact that some of your presenters have the permission property, probably your BasePresenter or something. So you need to put @property MyOwnBasePresenter $presenter in your component (probably App\Module\Components\Row?) or your BaseControl.
After added annotation to component, problem solved, tnx for help.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.