Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of PHP CS Fixer. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* Dariusz Rumiński <dariusz.ruminski@gmail.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
// HARD copy of .php-cs-fixer.dist.php file for fabbot.io compatibility for PHP CS Fixer v2 | ||
|
||
$header = <<<'EOF' | ||
This file is part of PHP CS Fixer. | ||
(c) Fabien Potencier <fabien@symfony.com> | ||
Dariusz Rumiński <dariusz.ruminski@gmail.com> | ||
This source file is subject to the MIT license that is bundled | ||
with this source code in the file LICENSE. | ||
EOF; | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->exclude('tests/Fixtures') | ||
->in(__DIR__) | ||
->append([ | ||
__DIR__.'/dev-tools/doc.php', | ||
__DIR__.'/php-cs-fixer', | ||
]) | ||
; | ||
|
||
$config = new PhpCsFixer\Config(); | ||
$config | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PHP56Migration' => true, | ||
'@PHPUnit75Migration:risky' => true, | ||
'@PhpCsFixer' => true, | ||
'@PhpCsFixer:risky' => true, | ||
'header_comment' => ['header' => $header], | ||
'list_syntax' => ['syntax' => 'long'], | ||
]) | ||
->setFinder($finder) | ||
; | ||
|
||
// special handling of fabbot.io service if it's using too old PHP CS Fixer version | ||
if (false !== getenv('FABBOT_IO')) { | ||
try { | ||
PhpCsFixer\FixerFactory::create() | ||
->registerBuiltInFixers() | ||
->registerCustomFixers($config->getCustomFixers()) | ||
->useRuleSet(new PhpCsFixer\RuleSet($config->getRules())) | ||
; | ||
} catch (PhpCsFixer\ConfigurationException\InvalidConfigurationException $e) { | ||
$config->setRules([]); | ||
} catch (UnexpectedValueException $e) { | ||
$config->setRules([]); | ||
} catch (InvalidArgumentException $e) { | ||
$config->setRules([]); | ||
} | ||
} | ||
|
||
return $config; |