Skip to content

Fix formatter panics on empty arrays, $a[] and skipped list items - #13

Open
danslo wants to merge 1 commit into
rectorphp:mainfrom
danslo:fix-formatter-panics
Open

danslo wants to merge 1 commit into
rectorphp:mainfrom
danslo:fix-formatter-panics

Conversation

@danslo

@danslo danslo commented Nov 14, 2026

Copy link
Copy Markdown

The formatter panics on some pretty common code:

  • [] and array(): formatList makes a slice of length -1
  • $a[] = 1;: ExprArrayDimFetch has no Dim
  • [$a, , $b] = $c; and list(, $b) = $c;: the skipped ExprArrayItem has no Val

Added a guard and a test for each.

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