Skip to content

[DeadCode] Skip RecastingRemovalRector on array dim fetch value - #8262

Merged
TomasVotruba merged 1 commit into
mainfrom
skip-recasting-array-dim-fetch
Aug 2, 2026
Merged

[DeadCode] Skip RecastingRemovalRector on array dim fetch value#8262
TomasVotruba merged 1 commit into
mainfrom
skip-recasting-array-dim-fetch

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Array dim fetch values can hold anything at runtime. PHPStan often reports a narrow type (e.g. int[]) where the real type is mixed[], so removing the cast changes behavior.

 $list = ['id' => 1, 'name' => 'Tom'];

-$id = (int) $list['id'];
-$name = (string) $list['name'];
+$id = $list['id'];
+$name = $list['name'];

Now skipped.

@TomasVotruba
TomasVotruba merged commit 209ae32 into main Aug 2, 2026
64 checks passed
@TomasVotruba
TomasVotruba deleted the skip-recasting-array-dim-fetch branch August 2, 2026 11:46
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.

1 participant