-
Notifications
You must be signed in to change notification settings - Fork 134
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
Improved return type of Reflection*::getModifiers()
#1236
Conversation
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.
👍
Even more type improvements, nice!
@@ -25,3 +25,6 @@ parameters: | |||
- | |||
message: '#Call to an undefined method PhpParser\\NodeVisitorAbstract::(getNode|setConstantName)\(\)#' | |||
path: src/SourceLocator/Type/AutoloadSourceLocator.php | |||
- | |||
message: '#Method Roave\\BetterReflection\\Reflection\\ReflectionClass::computeModifiers\(\) never returns \d+ so it can be removed from the return type#' |
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.
There's a grammar error here on returns
/cc @ondrejmirtes
src/Reflection/ReflectionClass.php
Outdated
@@ -332,6 +326,7 @@ private function createMethodsFromTrait(ReflectionMethod $method): array | |||
|
|||
if (array_key_exists($methodHash, $this->traitsData['modifiers'])) { | |||
// PhpParser modifiers are compatible with PHP reflection modifiers | |||
/** @var int-mask-of<ReflectionMethodAdapter::IS_*> $methodModifiers */ |
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.
Can this not be inferred? 🤔
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.
Cherry-picked two commits from my next PR.
Psalm can infer the type now, PHPStan cannot.
8f89aae
Constant should be removed in a4e5618