Kumora/.php-cs-fixer.dist.php

104 lines
3.1 KiB
PHP
Raw Permalink Normal View History

2025-01-16 21:31:32 +01:00
<?php
declare(strict_types=1);
/*
* 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.
*/
$finder = PhpCsFixer\Finder::create()
->ignoreVCSIgnored(true)
->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([
'@PHP82Migration' => true,
'@PHP80Migration:risky' => true,
'@PhpCsFixer:risky' => true,
'@PSR1' => true,
'@PSR2' => true,
'@PSR12' => true,
'align_multiline_comment' => [
'comment_type' => 'phpdocs_only',
],
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short',
],
// Anciennement 'braces'
'single_space_around_construct' => true,
'control_structure_braces' => true,
'control_structure_continuation_position' => true,
'declare_parentheses' => true,
'no_multiple_statements_per_line' => true,
'braces_position' => true,
'statement_indentation' => true,
'compact_nullable_type_declaration' => true,
'concat_space' => ['spacing' => 'one'],
'doctrine_annotation_array_assignment' => [
'operator' => '=',
],
'doctrine_annotation_spaces' => [
'after_array_assignments_equals' => false,
'before_array_assignments_equals' => false,
],
'php_unit_internal_class' => false,
'php_unit_test_class_requires_covers' => false,
'no_extra_blank_lines' => [
'tokens' => [
'break',
'continue',
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'throw',
'use',
],
],
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'alpha',
],
'php_unit_method_casing' => [
'case' => 'camel_case',
],
'phpdoc_order' => true,
'phpdoc_separation' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last'],
'strict_comparison' => true,
'strict_param' => true,
'yoda_style' => true,
'modernize_strpos' => true, // needs PHP 8+ or polyfill
'native_constant_invocation' => false,
'php_unit_strict' => false,
'native_function_invocation' => false,
])
->setFinder($finder)
;
return $config;