Skip to content

Commit

Permalink
minor #5840 DX: drop v2 compatible config in project itself (keradus)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 3.0 branch.

Discussion
----------

DX: drop v2 compatible config in project itself

Commits
-------

b45be67 DX: drop v2 compatible config in project itself
  • Loading branch information
keradus committed Aug 3, 2021
2 parents a8897f2 + b45be67 commit 50a38f5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 68 deletions.
55 changes: 53 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of PHP CS Fixer.
*
Expand All @@ -10,6 +12,55 @@
* with this source code in the file LICENSE.
*/

// @TODO 3.x: make this file the only distributed config file and remove `.php_cs.dist` file.
$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', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message
__FILE__,
])
;

$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
->setRules([
'@PHP71Migration:risky' => true,
'@PHPUnit75Migration:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'general_phpdoc_annotation_remove' => ['annotations' => ['expectedDeprecation']],
'header_comment' => ['header' => $header],
])
->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 require '.php_cs.dist';
return $config;
66 changes: 0 additions & 66 deletions .php_cs.dist

This file was deleted.

0 comments on commit 50a38f5

Please sign in to comment.