phpstan/phpstan-nette

Access to an uninitialized property which is @inject-ed

lulco opened this issue · 1 comments

lulco commented

This code is correct and working. With phpstan >= 1.10.23 it reports error Access to an uninitialized property App\AdminModule\Presenters\AdminPresenter::$user.

class AdminPresenter extends Presenter
{
    /** @inject */
    public User $user;

    public function startup()
    {
        parent::startup();

        if (!$this->user->isLoggedIn()) {
            // do something
        }
    }
}

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.