Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Dec 24, 2025

php bin/phpstan analyse src/Analyser/ src/Rules/ -v --debug

before this PR:

...
Elapsed time: 37 seconds
Used memory: 366.5 MB

after this PR:

Elapsed time: 36 seconds
Used memory: 354.03 MB
...

Comment on lines 5008 to 5011
if (!$expr->hasAttribute(self::CONTAINS_SUPER_GLOBAL_ATTRIBUTE_NAME)) {
$expr->setAttribute(self::CONTAINS_SUPER_GLOBAL_ATTRIBUTE_NAME, $nodeFinder->findFirst($expr, $globalVariableCallback) !== null);
}
if ($expr->getAttribute(self::CONTAINS_SUPER_GLOBAL_ATTRIBUTE_NAME) !== null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe super global variables are rare enough that we could instead remember with a bool property on Scope, whether the current scope contains any super-global variable.

if not, skip this whole node-finding at this stage.


another way could be using a NodeVisitor

@staabm staabm closed this Dec 24, 2025
@staabm staabm deleted the fastermut branch December 24, 2025 13:25
@ondrejmirtes
Copy link
Member

Why did you close this? 😊

@staabm staabm restored the fastermut branch December 24, 2025 13:54
@staabm
Copy link
Contributor Author

staabm commented Dec 24, 2025

it contained a bug :) - re-opened but the numbers are not as good as initially thought (updated the description)

@staabm staabm reopened this Dec 24, 2025
@ondrejmirtes ondrejmirtes merged commit 21a1602 into phpstan:2.1.x Dec 25, 2025
633 of 639 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the fastermut branch December 25, 2025 07:22
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