phpphp-cs-fixer

Space after named argument colon


I am looking for a PHP CS Fixer rule that requires a single space after a named argument, going from this:

array_key_exists(
    key:'test',
    array:$array,
);

to this:

array_key_exists(
    key: 'test',
    array: $array,
);

Any ideas?


Solution

  • Rule single_space_after_construct is what you are looking for, it has an option named_argument which is enabled by default.

    So either use it with default (true in config) or add named_argument to constructs array.