我安装了带有 PHP-CS-Fixer 插件的 Atom。我正在尝试使用一些自定义规则来应用同行大括号样式。
我曾尝试使用 in-Atom 配置选项,但无法使其工作。我已经尝试设置position_after_functions_and_oop_constructs
并将其放入PHP-CS-FIXER Rules
Atom 中,但没有奏效。
因此,我为我的配置设置了一个自定义路径,即C:\xampp\htdocs\myproject\atom.php_cs
配置是:
<?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)
;
它没有用,Atom 没有做适当的美化。有执行规则的想法吗?
笔记:
我有兴趣拥有以下风格:
public function someFunction(){
// code here
}
- 我使用 Windows 10 作为操作系统,Atom 是 IDE,并通过 Composer 安装了 PHP-cs-fixer。