Skip to content

PHPStan 2.3.3 + remove stale workarounds - #8859

Merged
TomasVotruba merged 8 commits into
rectorphp:mainfrom
ondrejmirtes:phpstan-2.3.3-remove-stale-workarounds
Oct 27, 2026
Merged

TomasVotruba merged 8 commits into
rectorphp:mainfrom
ondrejmirtes:phpstan-2.3.3-remove-stale-workarounds

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Contributor

I did some work so that Rector needs to work around PHPStan deficiencies less 😊

@ondrejmirtes
ondrejmirtes force-pushed the phpstan-2.3.3-remove-stale-workarounds branch from 3a0aa45 to d1da801 Compare October 27, 2026 14:26
@ondrejmirtes
ondrejmirtes force-pushed the phpstan-2.3.3-remove-stale-workarounds branch from d1da801 to 96e95af Compare October 27, 2026 14:30
@ondrejmirtes

Copy link
Copy Markdown
Contributor Author

Everything green now 😊

Comment on lines -361 to -377
// PHPStan does not process attributes of closures and arrow functions
if (($node instanceof Closure || $node instanceof ArrowFunction) && $node->attrGroups !== []) {
$this->processClosureAttributeGroups($node, $mutatingScope, $nodeCallback);
}
};

try {
$this->nodeScopeResolverProcessNodes($stmts, $scope, $nodeCallback);
} catch (Error $error) {
if (! str_starts_with($error->getMessage(), 'Call to undefined method ' . Printer::class . '::pPHPStan_')) {
throw $error;
}

// nothing we can do more precise here as error printing from deep internal PHPStan Printer service with service injection we cannot reset
// in the middle of process
// fallback to fill by found scope
RectorNodeScopeResolver::processNodes($stmts, $scope);

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.

This section was so annoying, just came across it last week. Happy to see it gone 👏

@TomasVotruba
TomasVotruba merged commit 9fa16da into rectorphp:main Oct 27, 2026
50 checks passed
@TomasVotruba

Copy link
Copy Markdown
Member

Just shipped, more awesomeness :) thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants