yharahuts/space-inside-array-braces-fixer

Custom rule for php-cs-fixer to add spaces inside array braces

dev-master 2023-10-23 23:47 UTC

This package is auto-updated.

Last update: 2024-09-24 02:13:51 UTC


README

What is this?

A fixer class for the php-cs-fixer to add spaces inside array (square) braces, like:

// before
$array['foo'] = ['bar'];

// after
$array[ 'foo' ] = [ 'bar' ];

Usage

Require it via composer:

composer require --dev yharahuts/space-inside-array-braces-fixer

Then enable it in your .php-cs-fixer config file:

// ...
$config = new PhpCsFixer\Config();

return $config
	->registerCustomFixers( [
		new \Codestyle\Fixer\SpaceInsideArrayBracesFixer(),
	] )
	->setRules( [
	    // ...
	    'Yharahuts/space_inside_array_braces' => true
    ] );