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
}
Since the beautification is not working properly the programm might have run into an error.
You can run Atom Beautify: Help Debug Editor from the command pallette to get Debug information.
Your config works perfectly fine for me and the problem seems to be your naming.
Simply rename your atom.php_cs to .php_cs and remove any config file path from the settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With