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 typo in ObjectType #3206

Merged
merged 5 commits into from
Jul 2, 2024
Merged

Fix typo in ObjectType #3206

merged 5 commits into from
Jul 2, 2024

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Jul 2, 2024

No description provided.

@@ -1230,15 +1230,15 @@ public function getEnumCases(): array
$className = $classReflection->getName();

if ($this->subtractedType !== null) {
$subtracedEnumCaseNames = [];
$subtractedEnumCaseNames = [];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

typo-fix

@@ -1384,7 +1386,7 @@ public function changeSubtractedType(?Type $subtractedType): Type
$subtractedTypesList = TypeUtils::flattenTypes($subtractedType);
$subtractedTypes = [];
foreach ($subtractedTypesList as $type) {
$subtractedTypes[$type->describe(VerbosityLevel::precise())] = $type;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we don't need the key of this array and building up the descriptions shows up in profiles of phpstan/phpstan#11263

Copy link
Contributor Author

Choose a reason for hiding this comment

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

after getting rid of the key, it seems we can get rid of the whole loop

@staabm
Copy link
Contributor Author

staabm commented Jul 2, 2024

intially started as a typo fix, but after some closer looks I was able to remove some unnecessary code

repro of phpstan/phpstan#11263 before this PR:

php bin/phpstan analyze slow.php --debug  
 7.58s user 0.15s system 99% cpu 7.787 total

php bin/phpstan analyze slow.php --debug
 7.60s user 0.14s system 99% cpu 7.811 total

after

php bin/phpstan analyze slow.php --debug  
 7.13s user 0.14s system 99% cpu 7.286 total

php bin/phpstan analyze slow.php --debug 
 7.12s user 0.15s system 99% cpu 7.292 total

@ondrejmirtes ondrejmirtes merged commit f546c37 into phpstan:1.11.x Jul 2, 2024
451 of 454 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the fix2 branch July 2, 2024 15:28
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.

2 participants