Repository navigation
fix(phpstan): drop the null check that the trait alias lookup can not fail - #247
Merged
Merged
Conversation
… fail The declaring trait is set together with the original method node, so PHPStan 2.3 reports the second null check as always false and fails the build of 4.x. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxhC1DaSZY1jAz2XfyjhPa
This was referenced Nov 2, 2026
Merged
lisachenko
marked this pull request as ready for review
November 2, 2026 17:23
3 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PHPStan fails on
4.x. The last run on its head,1f096af, is red, and so are #245 and #246, which don't touch this code:In the trait alias loop,
$declaringTraitNameis assigned in the same branch as$originalMethodNode, so once$originalMethodNode !== nullit can't benull. PHPStan 2.3 tracks that correlation and reports the second half of$originalMethodNode === null || $declaringTraitName === nullas dead. The check is reduced to$originalMethodNode === null, so behaviour is unchanged.masterhas the same line, and the cascade merge carries the fix there.Testing
vendor/bin/phpstan analyse src(PHPStan 2.3.4): no errors (1 error before).vendor/bin/phpunit: OK (13747 tests; the 133 skipped and 2 incomplete are already on4.x).Generated by Claude Code