Skip to content

Set class and method reflection in the MethodReturnStatementNode.#2515

Merged
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
mad-briller:method-return-statement
Jul 17, 2023
Merged

Set class and method reflection in the MethodReturnStatementNode.#2515
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
mad-briller:method-return-statement

Conversation

@mad-briller
Copy link
Copy Markdown
Contributor

Is this what you meant by #2514 (comment) ?

@phpstan-bot
Copy link
Copy Markdown
Collaborator

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.

@mad-briller mad-briller force-pushed the method-return-statement branch from 4ee3018 to e394afd Compare July 7, 2023 16:17
@mad-briller
Copy link
Copy Markdown
Contributor Author

not sure if github is broken atm but i can't seem to change the target to 1.10.x cos the dropdown isn't opening

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure if this is the best way to get the reflections to pass into the node

@mad-briller mad-briller force-pushed the method-return-statement branch 2 times, most recently from 18fa72f to d0c3fa6 Compare July 7, 2023 16:24
@mad-briller mad-briller changed the base branch from 1.11.x to 1.10.x July 7, 2023 17:17
Copy link
Copy Markdown
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

MethodReturnStatementsNode is read in NodeScopeResolver around line 4417, we could access ClassReflection on $node instead of $scope there too :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could do this on $scope and then you don't need to check for null - because of if (!$scope->isInClass()) { on line 526.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is the isInClass thing a custom type-specifier in phpstan?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not anymore, it just has @phpstan-assert above it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah i didn't know they could do that, nice

@mad-briller mad-briller force-pushed the method-return-statement branch from d0c3fa6 to 1b06588 Compare July 16, 2023 11:42
@ondrejmirtes ondrejmirtes merged commit 32ca340 into phpstan:1.10.x Jul 17, 2023
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you!

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.

3 participants