Skip to content

Commit

Permalink
Update fixers (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia authored Jan 13, 2025
1 parent dfdeccc commit d3bf551
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ You can find and compare releases at the [GitHub release page](https://github.co

## Unreleased

## v5.10.0

### Added

- Enable `assign_null_coalescing_to_coalesce_equal` fixer
- Enable `list_syntax` fixer
- Enable `method_chaining_indentation` fixer
- Enable `single_line_throw` fixer
- Enable `MultilinePromotedPropertiesFixer` fixer

## v5.9.2

### Fixed
Expand Down
19 changes: 12 additions & 7 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixerCustomFixers\Fixer\ConstructorEmptyBracesFixer;
use PhpCsFixerCustomFixers\Fixer\DeclareAfterOpeningTagFixer;
use PhpCsFixerCustomFixers\Fixers;
use PhpCsFixerCustomFixers;

/**
* Create a php-cs-fixer config that is enhanced with MLL rules.
Expand All @@ -19,6 +17,7 @@ function config(Finder $finder, array $ruleOverrides = []): Config
'@Symfony' => true,

'array_indentation' => true,
'assign_null_coalescing_to_coalesce_equal' => true,
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [],
Expand All @@ -36,9 +35,11 @@ function config(Finder $finder, array $ruleOverrides = []): Config
'explicit_string_variable' => true,
'fully_qualified_strict_types' => false, // Messes up global config files where fully qualified class names are preferred
'heredoc_indentation' => false,
'list_syntax' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
],
'method_chaining_indentation' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
Expand Down Expand Up @@ -68,13 +69,16 @@ function config(Finder $finder, array $ruleOverrides = []): Config
'phpdoc_order' => true,
'phpdoc_to_comment' => false, // Intermediary PHPDocs are sometimes useful to provide type assertions for PHPStan
'single_line_empty_body' => true,
'single_line_throw' => false,
'single_line_throw' => true,
// TODO add trailing commas everywhere when dropping PHP 7.4
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => [
// 'arguments',
'array_destructuring',
'arrays',
// 'match',
// 'parameters',
],
],
'yoda_style' => [ // Not necessary with static analysis, non-Yoda is more natural to write and read
Expand All @@ -83,12 +87,13 @@ function config(Finder $finder, array $ruleOverrides = []): Config
'less_and_greater' => false,
],

ConstructorEmptyBracesFixer::name() => true,
DeclareAfterOpeningTagFixer::name() => true, // Use native rule when added with https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/2062
PhpCsFixerCustomFixers\Fixer\ConstructorEmptyBracesFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\DeclareAfterOpeningTagFixer::name() => true, // Use native rule when added with https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/2062
PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer::name() => true,
];

return (new Config())
->registerCustomFixers(new Fixers())
->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers())
->setFinder($finder)
->setRules(array_merge($safeRules, $ruleOverrides));
}
Expand Down

0 comments on commit d3bf551

Please sign in to comment.