2 回答

TA貢獻1824條經驗 獲得超8個贊
根據@Nicolas 的評論,我能夠分兩步完成它。
我必須在項目的根目錄中創建一個名為.php_cs
將此代碼塊添加到文件中:
<?php
return PhpCsFixer\Config::create()
->setRules(array(
'braces' => array(
'position_after_anonymous_constructs' => 'next',
'position_after_control_structures' => 'next',
)
));
一切都完成了,就像一個魅力。感謝@Nicolas 的幫助!

TA貢獻1851條經驗 獲得超5個贊
正在尋找同樣的東西。我嘗試了 Radical_activity 給出的(接受的)答案,但這對我不起作用。在這里找到另一個片段:
片段:
<?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)
;
您還需要.php_cs在存儲庫中創建一個文件。這對我有用!
- 2 回答
- 0 關注
- 227 瀏覽
添加回答
舉報