-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Dropping @psalm-self-out
to avoid incorrect type inference in inheritance
#78
Dropping @psalm-self-out
to avoid incorrect type inference in inheritance
#78
Conversation
Before this change, in following example, `@psalm-self-out` would delete inheritance type information at runtime. For example: ```php class Foo implements ParentType { // ... } $foo = new Foo(); $foo->methodWithSelfOut(); /** @psalm-trace $foo */ // produces `ParentType` ``` This change corrects that, preserving `static` in the type information.
Note: I noticed the problem while working on |
… type inference Cases like following break completely with `@psalm-self-out`: ```php $o = new ArrayObject(['foo' => 'bar']); $o->baz = 'taz'; // `never` due to `'foo'&'bar'` not being possible ``` Rolling back the entire `psalm-self-out` improvement: too aggressive, and not practically useful on these mutable data containers.
@psalm-self-out
references to preserve child class types too@psalm-self-out
to avoid incorrect type inference in inheritance
…block overrides causing type clashes Note: we assume laminas/laminas-stdlib#78 will be merged first.
Is it not possible to do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if we have to. Strange how somehow removing some of the type data which reduced the baseline last time also reduces the baseline here 😆
The I will keep using |
…nges removing type information Ref: laminas/laminas-stdlib#78 Ref: 22dceb8
Before this change, in following example,
@psalm-self-out
would delete inheritance type information at runtime.For example:
This change corrects that, preserving
static
in the type information.