-
Notifications
You must be signed in to change notification settings - Fork 663
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
Using stub causes PropertyNotSetInConstructor #2319
Comments
Same here with non-stub : https://psalm.dev/r/6e1df08edd |
This doesn't fail anymore, but the original issue still reproduced as described. |
I found these snippets: https://psalm.dev/r/6e1df08edd<?php
class A {
/** @var int */
protected $a;
public function __construct() {
$this->a = 1;
}
public function __toString(): string {
return (string) $this->a;
}
}
class B extends A {
}
class C extends B {
public function __construct() {
parent::__construct();
}
}
echo (string) (new C());
|
I'm still affected by this, any way to fix it? |
If #7110 doesn't fix this directly, it should at least make the fix possible. Edit: Well, maybe, maybe not. That issue is more about loading stubs when the class doesn't appear in the code, this may have more to do with stubs correctly overriding a class that appears in the code. |
Looks like I have deleted reproducer repo. |
Steps to reproduce
git clone [email protected]:weirdan/psalm-bug-PropertyNotSetInConstructor-with-stub.git
cd psalm-bug-PropertyNotSetInConstructor-with-stub
composer install
vendor/bin/psalm --no-cache
Expected
No issues. Stub with constructor body, without constructor body and without constructor at all - all of those cases should not cause
PropertyNotSetInConstructor
.Actual
Additional observations
Running with stubs disabled (
vendor/bin/psalm --no-cache -c psalm-no-stubs.xml
) produces no issues:References
Originally reported in psalm/psalm-plugin-doctrine#30
The text was updated successfully, but these errors were encountered: