-
Notifications
You must be signed in to change notification settings - Fork 506
handle ClassConstFetch in scope #1944
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
Conversation
It's obvious that |
This pull request has been marked as ready for review. |
class HelloWorld | ||
{ | ||
public static function doFoo() | ||
{ | ||
if (defined('Foo::TEST')) { | ||
Foo::TEST; | ||
\Foo::TEST; | ||
\ClassConstFetchDefined\Foo::TEST; | ||
} else { | ||
Foo::TEST; | ||
\Foo::TEST; | ||
\ClassConstFetchDefined\Foo::TEST; | ||
} | ||
|
||
if (defined('\Foo::TEST')) { | ||
Foo::TEST; | ||
\Foo::TEST; | ||
\ClassConstFetchDefined\Foo::TEST; | ||
} else { | ||
Foo::TEST; | ||
\Foo::TEST; | ||
\ClassConstFetchDefined\Foo::TEST; | ||
} | ||
|
||
if (defined('ClassConstFetchDefined\Foo::TEST')) { | ||
Foo::TEST; | ||
\Foo::TEST; | ||
\ClassConstFetchDefined\Foo::TEST; | ||
} else { | ||
Foo::TEST; | ||
\Foo::TEST; | ||
\ClassConstFetchDefined\Foo::TEST; | ||
} | ||
|
||
if (defined('\ClassConstFetchDefined\Foo::TEST')) { | ||
Foo::TEST; | ||
\Foo::TEST; | ||
\ClassConstFetchDefined\Foo::TEST; | ||
} else { | ||
Foo::TEST; | ||
\Foo::TEST; | ||
\ClassConstFetchDefined\Foo::TEST; | ||
} | ||
} | ||
} |
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.
verified the behavior by https://3v4l.org/ueJTH
&& !$context->null(); | ||
&& $context->truthy(); |
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.
Not exist !== NeverType so I think this makes things better.
Perfect, thank you! |
fixes phpstan/phpstan#8034
blocking
phpstan/phpstan#8191
regression from
#1938
Steps to fix