Skip to content
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

Merged
merged 7 commits into from
Sep 25, 2022

Conversation

kukulich
Copy link
Collaborator

@kukulich kukulich commented Sep 25, 2022

Constant should be removed in a4e5618

@kukulich kukulich added this to the 6.0.0 milestone Sep 25, 2022
@kukulich kukulich marked this pull request as ready for review September 25, 2022 09:20
Copy link
Member

@Ocramius Ocramius left a 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#'
Copy link
Member

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

@@ -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 */
Copy link
Member

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? 🤔

Copy link
Collaborator Author

@kukulich kukulich Sep 25, 2022

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

@kukulich kukulich self-assigned this Sep 25, 2022
@kukulich kukulich merged commit a83180f into Roave:6.0.x Sep 25, 2022
@kukulich kukulich deleted the modifiers branch September 25, 2022 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants