phpstan / phpstan-nette

Nette Framework class reflection extension for PHPStan & framework-specific rules
MIT License
100 stars 35 forks source link

Access to an uninitialized property which is @inject-ed #129

Closed lulco closed 1 year ago

lulco commented 1 year ago

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
        }
    }
}
github-actions[bot] commented 1 year ago

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.