New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive "Access to an uninitialized property" #9619
Comments
This bug report is missing a link to reproduction at phpstan.org/try. It will most likely be closed after manual review. |
Fixed: phpstan/phpstan-src@218aad0 |
Thanks for quick fix |
@ondrejmirtes Hi, this is still an issue if property is set via __construct() and accessed in additional constructor: (startup is marked as additional constructor) class AdminPresenter extends Presenter
{
private User $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function startup()
{
parent::startup();
if (!$this->user->isLoggedIn()) {
// do something
}
}
} |
@lulco What error are you getting on which line? |
Access to an uninitialized property App\AdminModule\Presenters\AdminPresenter::$user. on line with the |
Do you need some additional information here? |
Fixed: phpstan/phpstan-src@1b0c6a0 Please open a new issue next time there's a problem with a closed issue. |
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. |
Bug report
Since phpstan 1.10.23 there is an error reported if property marked as initialized is accessed in additional constructor method.
See phpstan/phpstan-nette#129
Code snippet that reproduces the problem
No response
Expected output
no error
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: