mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-07-23 13:28:47 +02:00
Fix style and add config file to php-cs-fixer
This commit is contained in:
parent
485a0cb6fd
commit
fab9e256ab
40 changed files with 2360 additions and 1128 deletions
55
tests/php-cs-fixer/php_cs.config
Normal file
55
tests/php-cs-fixer/php_cs.config
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
$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__.'/php-cs-fixer'])
|
||||
;
|
||||
|
||||
$config = PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setRules([
|
||||
'@PHP56Migration' => true,
|
||||
'@PHPUnit60Migration:risky' => true,
|
||||
'@PhpCsFixer' => true,
|
||||
'@PhpCsFixer:risky' => true,
|
||||
'header_comment' => ['header' => $header],
|
||||
'list_syntax' => ['syntax' => 'long'],
|
||||
'mb_str_functions' => true,
|
||||
'method_separation' => true,
|
||||
'braces' => [
|
||||
'position_after_anonymous_constructs' => 'next',
|
||||
'position_after_control_structures' => 'next',
|
||||
'position_after_functions_and_oop_constructs' => 'next'
|
||||
],
|
||||
])
|
||||
->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;
|
Loading…
Add table
Add a link
Reference in a new issue