stevekanger/sk-php-cs-fixers

Custom fixers for php-cs-fixer.

Maintainers

Package info

github.com/stevekanger/sk-php-cs-fixers

pkg:composer/stevekanger/sk-php-cs-fixers

Transparency log

Statistics

Installs: 11

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.2 2026-08-04 21:41 UTC

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.