PHP

PHP

Made by DeepSource

Literal array with empty item(s) PHP-W1001

Bug risk
Critical
Autofix

This array contains one or more empty items, which will result in a fatal error.

It is recommended to remove any extra commas which may have caused the array to contain empty items.

Bad practice

$characters = ['Spock', 'Kirk', , 'McCoy'];  // invalid: empty item after `Kirk`

Recommended

$characters = ['Spock', 'Kirk', 'McCoy']; // make sure there are no empty items in array definitions

References