Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 345cb46

Browse files
committed
minor #2935 special handling of fabbot.io service if it's using too old PHP CS Fixer version (keradus)
This PR was squashed before being merged into the 2.2 branch (closes #2935). Discussion ---------- special handling of fabbot.io service if it's using too old PHP CS Fixer version Commits ------- 02b510d special handling of fabbot.io service if it's using too old PHP CS Fixer version
2 parents bbbe911 + 02b510d commit 345cb46

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

.php_cs.dist

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ This source file is subject to the MIT license that is bundled
1010
with this source code in the file LICENSE.
1111
EOF;
1212

13-
return PhpCsFixer\Config::create()
13+
$config = PhpCsFixer\Config::create()
1414
->setRiskyAllowed(true)
1515
->setRules(array(
1616
'@Symfony' => true,
1717
'@Symfony:risky' => true,
1818
'array_syntax' => array('syntax' => 'long'),
1919
'combine_consecutive_unsets' => true,
2020
// one should use PHPUnit methods to set up expected exception instead of annotations
21-
'general_phpdoc_annotation_remove' => array('expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'),
21+
'general_phpdoc_annotation_remove' => array('annotations' => array('expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp')),
2222
'header_comment' => array('header' => $header),
2323
'heredoc_to_nowdoc' => true,
24-
'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'),
24+
'no_extra_consecutive_blank_lines' => array('tokens' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block')),
2525
'no_short_echo_tag' => true,
2626
'no_unreachable_default_argument_value' => true,
2727
'no_useless_else' => true,
@@ -41,3 +41,15 @@ return PhpCsFixer\Config::create()
4141
->in(__DIR__)
4242
)
4343
;
44+
45+
// special handling of fabbot.io service if it's using too old PHP CS Fixer version
46+
try {
47+
PhpCsFixer\FixerFactory::create()
48+
->registerBuiltInFixers()
49+
->registerCustomFixers($config->getCustomFixers())
50+
->useRuleSet(new PhpCsFixer\RuleSet($config->getRules()));
51+
} catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) {
52+
$config->setRules(array());
53+
}
54+
55+
return $config;

0 commit comments

Comments
 (0)