Skip to content

Use intval() instead of a cast operator for the panel row number - #1591

Merged
zonky2 merged 1 commit into
release/2.5from
fix/panelbuilder-redundant-cast
Sep 1, 2026
Merged

Use intval() instead of a cast operator for the panel row number#1591
zonky2 merged 1 commit into
release/2.5from
fix/panelbuilder-redundant-cast

Conversation

@zonky2

@zonky2 zonky2 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

CI (fresh contao/core-bundle ~5.7.0) infers StringUtil::trimsplit()'s keys as strictly int, so psalm flags the (int) cast as redundant there. The devstack's pinned core-bundle version infers a broader array-key type, where the cast is not redundant - removing it outright breaks locally (InvalidOperand). intval() is behaviorally identical to the cast but isn't covered by psalm's RedundantCast rule, so it satisfies both environments.

CI (fresh contao/core-bundle ~5.7.0) infers StringUtil::trimsplit()'s
keys as strictly int, so psalm flags the (int) cast as redundant
there. The devstack's pinned core-bundle version infers a broader
array-key type, where the cast is not redundant - removing it
outright breaks locally (InvalidOperand). intval() is behaviorally
identical to the cast but isn't covered by psalm's RedundantCast
rule, so it satisfies both environments.
@zonky2 zonky2 added this to the 2.5.x milestone Sep 1, 2026
@zonky2 zonky2 self-assigned this Sep 1, 2026
@zonky2
zonky2 merged commit 3d958a0 into release/2.5 Sep 1, 2026
4 checks passed
@zonky2
zonky2 deleted the fix/panelbuilder-redundant-cast branch September 1, 2026 14:40
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.

1 participant