Skip to content

Instantly share code, notes, and snippets.

@wowiwj
Created November 19, 2018 08:15
Show Gist options
  • Save wowiwj/caee16541a1a1001a59f919df81f2ae0 to your computer and use it in GitHub Desktop.
Save wowiwj/caee16541a1a1001a59f919df81f2ae0 to your computer and use it in GitHub Desktop.
tp php_cs格式化配置文件
<?php
$excluded_folders = [
'TmsLogs',
'Public',
'BiFtpFile'
];
$finder = Symfony\Component\Finder\Finder::create()
->in([__DIR__])
->notPath('*/Runtime')
->exclude($excluded_folders)
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'braces' => [
'allow_single_line_closure' => false,
'position_after_functions_and_oop_constructs' => 'same',
],
'blank_line_before_statement' => true,
'cast_spaces' => [
'space' => 'none',
],
'linebreak_after_opening_tag' => true,
'no_whitespace_in_blank_line' => true,
'non_printable_character' => [
'use_escape_sequences_in_strings' => true,
],
'ordered_imports' => true,
'single_quote' => true,
'whitespace_after_comma_in_array' => true,
'trailing_comma_in_multiline_array' => true,
])
->setRiskyAllowed(true)
->setFinder($finder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment