Skip to content

Consistently pass $nativeExpressionTypes in MutatingScope #2021

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

Merged
merged 2 commits into from
Nov 24, 2022

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Nov 21, 2022

because why not? no really, I have no clue and am asking myself exactly that.

I went through all ScopeFactory::create() calls and this makes the native expression types passing consistent with the expression types passing AFAIK.

This passes native types properly for

  • enterDeclareStrictTypes
  • enterClosureBind / restoreOriginalScopeAfterClosureBind
  • enterClosureCall
  • enterArrowFunction

CC @rajyan

@ondrejmirtes
Copy link
Member

For these changes, there should definitely be some tests that fail without these changes.

And one idea - we should move nativeExpressionTypes to be right after expressionTypes in MutatingScope constructor + in InternalScopeFactory.

@herndlm
Copy link
Contributor Author

herndlm commented Nov 21, 2022

For these changes, there should definitely be some tests that fail without these changes.

Right, I thought the same, but was struggling with tests. I just managed to come up with something and can hopefully push it soon.

And one idea - we should move nativeExpressionTypes to be right after expressionTypes in MutatingScope constructor + in InternalScopeFactory.

OK, then I'll quickly create a PR for that, that simplifies my other PRs including this one 👍

@herndlm
Copy link
Contributor Author

herndlm commented Nov 21, 2022

Oh, and unfortunately I need #2017 first to make the regression tests here work

@herndlm
Copy link
Contributor Author

herndlm commented Nov 22, 2022

while adding some tests I realized that currently $thisType is passed into nativeExpressionTypes, which isn't correct. Do we want to retain and pass a $nativeThisType? it would definitely work, but duplicate some code basically.

UPDATE: I think I dealt with it, also added tests for everything and ensured that they fail without the commit. they should turn magically green after merging #2017 and rebasing

@herndlm herndlm force-pushed the consistent-native-types-passing branch 3 times, most recently from df7244f to ee8d630 Compare November 22, 2022 15:36
@herndlm herndlm marked this pull request as ready for review November 22, 2022 15:47
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes
Copy link
Member

This one should be rebased now I guess :)

@herndlm
Copy link
Contributor Author

herndlm commented Nov 24, 2022

yes and no. it needs #2017 unfortunately :) but really, no worries!

also, I need to fix conflicts now

@herndlm herndlm force-pushed the consistent-native-types-passing branch from ee8d630 to b7215c1 Compare November 24, 2022 16:13
@ondrejmirtes ondrejmirtes merged commit ce57901 into phpstan:1.9.x Nov 24, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@herndlm herndlm deleted the consistent-native-types-passing branch November 24, 2022 16:21
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