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

Fix huge union types result from "+"-array-merge operation #1141

Merged
merged 6 commits into from
Mar 30, 2022

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Mar 29, 2022

with the fix we apply the limit already used in ConstantArrayTypeBuilder also to the merge-process when analyzing constant-arrays beeing merged by the +-operator.

without the fix, the provided testcase runs 2-4 minutes. with the fix it runs in 3-5 seconds.

closes phpstan/phpstan#6936

Copy link
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.

Also please demonstrate in NodeScopeResolverTest what happens if we go right under and right over the limit. Thanks.

src/Analyser/MutatingScope.php Outdated Show resolved Hide resolved
@staabm
Copy link
Contributor Author

staabm commented Mar 29, 2022

I tried for more then an hour, but it seems I am not able to come up with a proper NodeScopeResolverTest for it.

either my fix only works by accident, or I am really not able to create the test... I don't know right now.

@staabm
Copy link
Contributor Author

staabm commented Mar 30, 2022

finally found a test-case which works locally. lets see what CI is thinking about it

that was a hard one for me.

@ondrejmirtes ondrejmirtes merged commit 925eabb into phpstan:1.5.x Mar 30, 2022
@ondrejmirtes
Copy link
Member

Perfect, 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
3 participants