stevekanger / sk-php-cs-fixers
Custom fixers for php-cs-fixer.
v0.1.2
2026-08-04 21:41 UTC
Requires
- php: >=8.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- php-cs-fixer/phpunit-constraint-isidenticalstring: ^1.8
- phpunit/phpunit: ^9.6.34 || ^10.5.63 || ^11.5.55
This package is auto-updated.
Last update: 2026-08-05 01:32:20 UTC
README
Requirements
Php >= 8.3
Installation
composer require --dev stevekanger/sk-php-cs-fixers
Then you can configure your custom fixer in .php-cs-fixer.php. See Php-cs-fixer custom rules
<?php use SkPhpCsFixers\Fixer\CustomFixer; require __DIR__ . '/vendor/autoload.php' $rules = [ 'SkPhpCsFixers/custom_fixer' => true, ]; $finder = (new PhpCsFixer\Finder()) ->in(__DIR__); return (new PhpCsFixer\Config()) ->setRules($rules) ->registerCustomFixers([ new CustomFixer(), ]);
Fixers
Array Format Fixer SkPhpCsFixers/array_format
Currently Php-cs-fixers rules only format indents on array. This fixer makes sure arrays are fully formatted.
Configuration
- namespace:
SkPhpCsFixers\Fixer\ArrayNotation\ArrayFormatFixer - rule name:
SkPhpCsFixers/array_format
Options
| Option | Default | Allowed Values | Description |
|---|---|---|---|
| on_singleline | ignore | ignore, ensure_multiline | Handles what to do on singleline arrays. |
| on_empty | ensure_singleline | ensure_multiline, ensure_singleline, ignore | Handles what to do on empty arrays. |
Examples
<?php // Unformatted $arr = [1, 2, 3 ]; // Formatted $arr = [1, 2, 3]; // Unformatted $arr = [1, 2, 3 => [ "one" => 1 ] ]; // Formatted $arr = [ 1, 2, 3 => [ "one" => 1 ] ];
License
Licensed under the MIT license. See LICENSE for more information.