Skip to content

Conversation

mvorisek
Copy link

@mvorisek mvorisek commented Aug 27, 2024

assertType('StaticWithThisChained\Foo', self::newStaticStatic());
assertType('StaticWithThisChained\Foo', Foo::newStaticStatic());

assertType('static(StaticWithThisChained\Foo)', $this->newStatic()->getThis());
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help needed - how can I mutate the scope to be static when static return type is analysed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ondrejmirtes please see https://phpstan.org/r/29fcfdb5-f19e-4df2-9177-61ad88490c64 repro - do you know where the issue comes from and how it can be fixed? (static must never be converted to $this )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@staabm might I ask you for a help? I have looked into the fix several times, but I am not familiar with mutating the scope logic and I do not know how to fix this myself.

@mvorisek mvorisek force-pushed the fix_5946_this_into_static branch 2 times, most recently from 8440516 to fd3a89a Compare September 23, 2024 06:45
@mvorisek mvorisek force-pushed the fix_5946_this_into_static branch from fd3a89a to 8eae77c Compare October 11, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$this type of static (self, ...) type must remains static
1 participant