2015-05-28 13:51:01 +00:00
|
|
|
<?php
|
|
|
|
|
2015-10-13 09:33:40 +00:00
|
|
|
$header = <<<EOF
|
|
|
|
This file is part of Composer.
|
|
|
|
|
|
|
|
(c) Nils Adermann <naderman@naderman.de>
|
|
|
|
Jordi Boggiano <j.boggiano@seld.be>
|
|
|
|
|
|
|
|
For the full copyright and license information, please view the LICENSE
|
|
|
|
file that was distributed with this source code.
|
|
|
|
EOF;
|
|
|
|
|
2016-04-11 14:06:57 +00:00
|
|
|
$finder = PhpCsFixer\Finder::create()
|
2015-05-28 13:51:01 +00:00
|
|
|
->files()
|
|
|
|
->in(__DIR__.'/src')
|
|
|
|
->in(__DIR__.'/tests')
|
2017-12-18 15:02:48 +00:00
|
|
|
->name('*.php')
|
|
|
|
->notPath('Fixtures')
|
2022-02-22 15:47:09 +00:00
|
|
|
->notPath('Composer/Autoload/ClassLoader.php')
|
|
|
|
->notPath('Composer/InstalledVersions.php')
|
2015-05-28 13:51:01 +00:00
|
|
|
;
|
|
|
|
|
2021-10-27 14:18:24 +00:00
|
|
|
$config = new PhpCsFixer\Config();
|
|
|
|
return $config->setRules([
|
2015-09-28 09:34:24 +00:00
|
|
|
'@PSR2' => true,
|
2016-01-26 13:59:34 +00:00
|
|
|
'binary_operator_spaces' => true,
|
2018-07-24 12:32:52 +00:00
|
|
|
'blank_line_before_statement' => array('statements' => array('declare', 'return')),
|
|
|
|
'cast_spaces' => array('space' => 'single'),
|
2015-10-13 09:33:40 +00:00
|
|
|
'header_comment' => array('header' => $header),
|
2015-09-28 09:34:24 +00:00
|
|
|
'include' => true,
|
2021-10-27 14:18:24 +00:00
|
|
|
|
|
|
|
'class_attributes_separation' => array('elements' => array('method' => 'one', 'trait_import' => 'none')),
|
2015-10-13 09:33:40 +00:00
|
|
|
'no_blank_lines_after_class_opening' => true,
|
2016-01-26 13:59:34 +00:00
|
|
|
'no_blank_lines_after_phpdoc' => true,
|
2017-03-08 14:07:29 +00:00
|
|
|
'no_empty_statement' => true,
|
2021-10-27 14:18:24 +00:00
|
|
|
'no_extra_blank_lines' => true,
|
2016-01-26 13:59:34 +00:00
|
|
|
'no_leading_namespace_whitespace' => true,
|
|
|
|
'no_trailing_comma_in_singleline_array' => true,
|
2017-03-08 14:07:29 +00:00
|
|
|
'no_whitespace_in_blank_line' => true,
|
2016-01-26 13:59:34 +00:00
|
|
|
'object_operator_without_whitespace' => true,
|
2021-10-27 14:18:24 +00:00
|
|
|
//'phpdoc_align' => true,
|
2015-09-28 09:34:24 +00:00
|
|
|
'phpdoc_indent' => true,
|
|
|
|
'phpdoc_no_access' => true,
|
|
|
|
'phpdoc_no_package' => true,
|
2021-10-27 14:18:24 +00:00
|
|
|
//'phpdoc_order' => true,
|
2015-09-28 09:34:24 +00:00
|
|
|
'phpdoc_scalar' => true,
|
|
|
|
'phpdoc_trim' => true,
|
2017-03-08 14:07:29 +00:00
|
|
|
'phpdoc_types' => true,
|
2021-10-27 14:18:24 +00:00
|
|
|
'psr_autoloading' => true,
|
2018-03-09 07:17:31 +00:00
|
|
|
'single_blank_line_before_namespace' => true,
|
2016-01-26 13:59:34 +00:00
|
|
|
'standardize_not_equals' => true,
|
|
|
|
'ternary_operator_spaces' => true,
|
2021-10-27 14:18:24 +00:00
|
|
|
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
|
2020-01-30 12:38:53 +00:00
|
|
|
'unary_operator_spaces' => true,
|
2021-10-27 14:18:24 +00:00
|
|
|
|
|
|
|
// imports
|
|
|
|
'no_unused_imports' => true,
|
|
|
|
'fully_qualified_strict_types' => true,
|
|
|
|
'single_line_after_imports' => true,
|
|
|
|
//'global_namespace_import' => ['import_classes' => true],
|
|
|
|
'no_leading_import_slash' => true,
|
|
|
|
'single_import_per_statement' => true,
|
2022-02-18 08:09:58 +00:00
|
|
|
|
|
|
|
// PHP 7.2 migration
|
|
|
|
// TODO later once 2.2 is more stable
|
|
|
|
// 'array_syntax' => true,
|
|
|
|
// 'list_syntax' => true,
|
2022-02-23 13:09:49 +00:00
|
|
|
'visibility_required' => ['elements' => ['property', 'method', 'const']],
|
2022-02-18 08:09:58 +00:00
|
|
|
'non_printable_character' => true,
|
|
|
|
'combine_nested_dirname' => true,
|
|
|
|
'random_api_migration' => true,
|
|
|
|
'ternary_to_null_coalescing' => true,
|
2022-02-22 15:47:09 +00:00
|
|
|
'phpdoc_to_param_type' => true,
|
2022-02-18 08:09:58 +00:00
|
|
|
//'declare_strict_types' => true,
|
2022-02-22 15:47:09 +00:00
|
|
|
|
|
|
|
// TODO php 7.4 migration (one day..)
|
|
|
|
// 'phpdoc_to_property_type' => true,
|
2021-10-27 14:18:24 +00:00
|
|
|
])
|
|
|
|
->setUsingCache(true)
|
|
|
|
->setRiskyAllowed(true)
|
2017-03-08 14:07:29 +00:00
|
|
|
->setFinder($finder)
|
2015-05-28 13:51:01 +00:00
|
|
|
;
|