Saturday, 9 March 2019

Atom-beautify not loading php-cs-fixer custom config

I have Atom installed with PHP-CS-Fixer plugin. I'm trying to use some custom rules to apply same-line braces style.

I have tried using the in-Atom config option, but couldn't make it work. I have tried setting position_after_functions_and_oop_constructs and putting it in PHP-CS-FIXER Rules in Atom, but didn't work.

Therefore, I have set a custom path to my config, which is C:\xampp\htdocs\myproject\atom.php_cs

The config is:

<?php

$finder = PhpCsFixer\Finder::create()
    //->exclude('somedir')
    //->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php'
    ->in(__DIR__)
;

return PhpCsFixer\Config::create()
    ->setRules([
        '@PSR2' => true,
        'strict_param' => false,
        'array_syntax' => ['syntax' => 'long'],
        'braces' => [
            'allow_single_line_closure' => true, 
            'position_after_functions_and_oop_constructs' => 'same'],
    ])
    ->setFinder($finder)
;

It didn't work and Atom is NOT doing a proper beautify. Any idea to enforce the rules?

Notes:

I'm interested in having the following style:

  public function someFunction(){ 
    // code here
}

  • I'm using Windows 10 as OS, Atom is IDE and have PHP-cs-fixer installed via Composer.


from Atom-beautify not loading php-cs-fixer custom config

No comments:

Post a Comment