Skip to content

Fix PHPStan 2.3.2 failure in ArrayDeclarationSniff - #93

Merged
dereuromark merged 1 commit into
masterfrom
phpstan-2-3-array-declaration
Oct 25, 2026
Merged

dereuromark merged 1 commit into
masterfrom
phpstan-2-3-array-declaration

Conversation

@dereuromark

Copy link
Copy Markdown
Contributor

CI now installs PHPStan 2.3.2, which reports ArrayDeclarationSniff.php:616 as identical.alwaysTrue and fails the stan job on every branch, including #89, #90, #91 and #92.

It is a false positive (the property can hold other strings at that point), but the loop only needs the value of the check made just before it, so the condition is now computed once and reused. No behavior change.

PHPStan 2.3.2 reports the repeated `multiLineIndentationMode === 'assoc'`
check inside the item loop as always true (identical.alwaysTrue), which
fails the stan job on every branch. The property can hold other values
there, so it is a false positive, but the loop only needs the result of
the check made before it. Evaluating it once removes the duplicate and
the report without changing behavior.
@dereuromark dereuromark added the bug Something isn't working label Oct 25, 2026
Copilot AI balanced review requested due to automatic review settings October 25, 2026 14:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@dereuromark
dereuromark merged commit d9f2701 into master Oct 25, 2026
5 checks passed
@dereuromark
dereuromark deleted the phpstan-2-3-array-declaration branch October 25, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants