Search code examples
phpphp-cs-fixer

How to replicate PHPStorm's "Align fields in columns" in PHP-CS-Fixer?


I would like to know if it is possible to replicate the Align fields in columns behavior from PHPStorm to PHP-CS-Fixer

For having this :

        var    $numbers = ["one", "two", "three", "four", "five", "six"];
        var    $v       = 0;
        public $path    = "root";

        const FIRST  = 'first';
        const SECOND = 0;
        const Z      = -1;

instead of :

        var $numbers = ["one", "two", "three", "four", "five", "six"];
        var $v = 0;
        public $path = "root";

        const FIRST = 'first';
        const SECOND = 0;
        const Z = -1;

Aligning the = is done by using this directive :

'binary_operator_spaces' => [
        'default' => 'align',
        'operators' => ['=>' => 'align']
    ],

But I can't find how to align the variables names as well


Solution

  • PHP CS Fixer does not have such feature, if you have time to implement I will recommend this as a start.