-
Notifications
You must be signed in to change notification settings - Fork 509
support 'HasMethodType' on StaticCall #1969
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
2fee0d2
to
2302a61
Compare
This pull request has been marked as ready for review. |
94d479a
to
4e8c9d6
Compare
if ($objectType->isString()->yes()) { | ||
return new SpecifiedTypes([], []); | ||
if ($objectType->isString()->yes()) { | ||
if ($objectType instanceof ConstantStringType && $objectType->isClassString()) { |
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.
Should we add isClassString on Type as a followup?
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.
Of course :)
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.
we already have ConstantStringType->isClassString(): bool
,
phpstan-src/src/Type/Constant/ConstantStringType.php
Lines 75 to 84 in 47ba52b
public function isClassString(): bool | |
{ | |
if ($this->isClassString) { | |
return true; | |
} | |
$reflectionProvider = ReflectionProviderStaticAccessor::getInstance(); | |
return $reflectionProvider->hasClass($this->value); | |
} |
therefore we need a different name for this new method... any suggestions?
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.
isClassStringType
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.
And make it nicer for 2.0
Yeah, I guess this is usable. Thank you :) |
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.
We should also test a scenario when a method doesn't exist - for example when we're not in method_exists at all, or when we call a different method than what was asked in method_exists.
51ae84d
to
95dba26
Compare
95dba26
to
9d1bca9
Compare
Thank you! |
implements phpstan/phpstan#8297
closes phpstan/phpstan#1267