Skip to content

Commit 6d8882a

Browse files
committed
upgrade to php-cs-fixer v3
1 parent 669260e commit 6d8882a

14 files changed

+34
-21
lines changed

.php-cs-fixer.dist.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
require_once(__DIR__.'/vendor/autoload.php');
3+
4+
use Permafrost\PhpCsFixerRules\Finders\ComposerPackageFinder;
5+
use Permafrost\PhpCsFixerRules\Rulesets\DefaultRuleset;
6+
use Permafrost\PhpCsFixerRules\SharedConfig;
7+
8+
// optional: chain additiional custom Finder options:
9+
$finder = ComposerPackageFinder::create(__DIR__);
10+
11+
return SharedConfig::create($finder, new DefaultRuleset());
File renamed without changes.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"symfony/console": "^5.2"
1010
},
1111
"require-dev": {
12-
"friendsofphp/php-cs-fixer": "^2.16",
12+
"friendsofphp/php-cs-fixer": "^3.0",
1313
"phpunit/phpunit": "^9.4"
1414
},
1515
"autoload": {

src/Commands/Prompts/ConsoleSelectPathsForCustomFinderPrompt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function prepareItems(array $items, array $excludeItems): array
8484

8585
return Collection::create($items)
8686
->exclude($excludeItems)
87-
->filter(function ($item) {
87+
->filter(function($item) {
8888
return !Str::startsWith($item, '.');
8989
})
9090
->values()

src/Commands/Support/CustomConfigGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ public function setPaths($includePaths, $excludePaths)
2626
public function generateFinderCode(): string
2727
{
2828
$includeCode = trim(Collection::create($this->includePaths)
29-
->map(function ($item) {
29+
->map(function($item) {
3030
return " __DIR__ . '/$item',";
3131
})
3232
->implode(PHP_EOL));
3333

3434
$excludeCode = Collection::create($this->excludePaths)
35-
->map(function ($item) {
35+
->map(function($item) {
3636
return " ->notPath('$item/*')";
3737
})
3838
->implode(PHP_EOL);

src/Commands/Support/Options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct($input)
1717
$this->initialize();
1818
}
1919

20-
protected function initialize(string $defaultFilename = '.php_cs.dist'): void
20+
protected function initialize(string $defaultFilename = '.php-cs-fixer.dist.php'): void
2121
{
2222
$this->filename = $this->input->hasOption('outfile')
2323
? $this->input->getOption('outfile')

src/Finders/BaseFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ abstract class BaseFinder
66
{
77
public static function onlyExistingPaths(array $paths): array
88
{
9-
return array_filter($paths, function ($path) {
9+
return array_filter($paths, function($path) {
1010
return file_exists($path) && is_dir($path);
1111
});
1212
}

src/Rulesets/DefaultRuleset.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public static function name(): string
1717
public function rules(): array
1818
{
1919
return array_merge([
20-
'psr0' => false,
2120
'@PSR2' => true,
2221
'@Symfony' => true,
2322
'array_syntax' => [
@@ -44,16 +43,15 @@ public function rules(): array
4443
'closure_function_spacing' => 'none',
4544
],
4645
'increment_style' => [
47-
'style' => 'post'
46+
'style' => 'post',
4847
],
4948
'indentation_type' => true,
5049
'linebreak_after_opening_tag' => true,
5150
'line_ending' => true,
52-
'lowercase_constants' => false,
5351
'lowercase_keywords' => true,
54-
'method_argument_space' => [
55-
'ensure_fully_multiline' => true,
56-
],
52+
//'method_argument_space' => [
53+
// 'ensure_fully_multiline' => true,
54+
//],
5755
'no_break_comment' => false,
5856
'no_closing_tag' => true,
5957
'no_spaces_after_function_name' => true,
@@ -64,7 +62,7 @@ public function rules(): array
6462
'no_unused_imports' => true,
6563
'not_operator_with_successor_space' => false,
6664
'ordered_imports' => [
67-
'sortAlgorithm' => 'alpha',
65+
'sort_algorithm' => 'alpha',
6866
],
6967
'phpdoc_align' => [
7068
'align' => 'left',

src/Rulesets/LaravelShiftRuleset.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function rules(): array
4141
'concat_space' => [
4242
'spacing' => 'none',
4343
],
44+
'constant_case' => ['case' => 'lower'],
4445
'declare_equal_normalize' => true,
4546
'elseif' => true,
4647
'encoding' => true,
@@ -55,7 +56,6 @@ public function rules(): array
5556
'linebreak_after_opening_tag' => true,
5657
'line_ending' => true,
5758
'lowercase_cast' => true,
58-
'lowercase_constants' => true,
5959
'lowercase_keywords' => true,
6060
'lowercase_static_reference' => true, // added from Symfony
6161
'magic_method_casing' => true, // added from Symfony
@@ -104,7 +104,7 @@ public function rules(): array
104104
'object_operator_without_whitespace' => true,
105105
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
106106
'phpdoc_indent' => true,
107-
'phpdoc_inline_tag' => true,
107+
//'phpdoc_inline_tag' => true,
108108
'phpdoc_no_access' => true,
109109
'phpdoc_no_package' => true,
110110
'phpdoc_no_useless_inheritdoc' => true,
@@ -133,7 +133,9 @@ public function rules(): array
133133
'switch_case_semicolon_to_colon' => true,
134134
'switch_case_space' => true,
135135
'ternary_operator_spaces' => true,
136-
'trailing_comma_in_multiline_array' => true,
136+
'trailing_comma_in_multiline' => [
137+
'elements' => ['arrays'],
138+
],
137139
'trim_array_spaces' => true,
138140
'unary_operator_spaces' => true,
139141
'visibility_required' => [

src/Rulesets/PhpUnitRuleset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function rules(): array
116116
'no_null_property_initialization' => true,
117117
'no_php4_constructor' => true,
118118
'no_short_bool_cast' => true,
119-
'no_short_echo_tag' => true,
119+
'echo_tag_syntax' => ['format' => 'long'],
120120
'no_singleline_whitespace_before_semicolons' => true,
121121
'no_spaces_after_function_name' => true,
122122
'no_spaces_around_offset' => true,

0 commit comments

Comments
 (0)