Skip to content

Commit 1c6667e

Browse files
committed
Update PHP-CS-Fixer to v2.16
1 parent df670d5 commit 1c6667e

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

.php_cs.dist

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
use Mollie\PhpCodingStandards\PhpCsFixer\Rules;
46
use PhpCsFixer\Config;
57
use PhpCsFixer\Finder;
68

79
$finder = Finder::create()
8-
->name('.php_cs.dist') // Fix this file as well
10+
->name('.php_cs.dist') // Fix this file as well
911
->in(__DIR__);
1012

13+
$overrides = [
14+
'declare_strict_types' => true,
15+
];
16+
1117
return Config::create()
1218
->setFinder($finder)
1319
->setRiskyAllowed(true)
14-
->setRules(Rules::getForPhp71());
20+
->setRules(Rules::getForPhp71($overrides));

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"minimum-stability": "stable",
1818
"require": {
1919
"php": "^7.1.3",
20-
"friendsofphp/php-cs-fixer": "^2.15"
20+
"friendsofphp/php-cs-fixer": "^2.16"
2121
}
2222
}

src/PhpCsFixer/Rules.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Mollie\PhpCodingStandards\PhpCsFixer;
66

77
/*
8-
* Last updated for php-cs-fixer version: 2.15
8+
* Last updated for php-cs-fixer version: 2.16
99
*/
1010
class Rules
1111
{
@@ -46,10 +46,7 @@ private static function getBaseRules(): array
4646
'align_multiline_comment' => [
4747
'comment_type' => 'all_multiline',
4848
],
49-
'array_indentation' => true,
50-
'array_syntax' => [
51-
'syntax' => 'short',
52-
],
49+
'array_indentation' => true,
5350
'binary_operator_spaces' => [
5451
'default' => 'align_single_space_minimal',
5552
],
@@ -75,6 +72,7 @@ private static function getBaseRules(): array
7572
'explicit_string_variable' => true,
7673
'fully_qualified_strict_types' => true,
7774
'function_to_constant' => true,
75+
'global_namespace_import' => true,
7876
// 'header_comment' => [ // Has too many issues atm
7977
// 'header' => '',
8078
// ],
@@ -105,14 +103,15 @@ private static function getBaseRules(): array
105103
// TODO: Add 'use' when php-cs-fixer #3582 is fixed
106104
],
107105
],
108-
'no_null_property_initialization' => true,
109-
'no_superfluous_elseif' => true,
110-
'no_superfluous_phpdoc_tags' => true,
111-
'no_unset_cast' => true,
112-
'no_unset_on_property' => false, // It's purposely used for the side effect :(
113-
'no_useless_else' => true,
114-
'no_useless_return' => true,
115-
'ordered_class_elements' => [
106+
'no_null_property_initialization' => true,
107+
'no_superfluous_elseif' => true,
108+
'no_superfluous_phpdoc_tags' => true,
109+
'no_unset_cast' => true,
110+
'no_unset_on_property' => false, // It's purposely used for the side effect :(
111+
'no_useless_else' => true,
112+
'no_useless_return' => true,
113+
'nullable_type_declaration_for_default_null_value' => true,
114+
'ordered_class_elements' => [
116115
'order' => [
117116
'use_trait',
118117
'constant_public', 'constant_protected', 'constant_private',
@@ -123,6 +122,12 @@ private static function getBaseRules(): array
123122
'ordered_imports' => [
124123
'imports_order' => ['class', 'function', 'const'],
125124
],
125+
'phpdoc_line_span' => [
126+
'const' => 'single',
127+
'method' => 'multi',
128+
'property' => 'single',
129+
],
130+
'phpdoc_no_empty_return' => true,
126131
'php_unit_construct' => true,
127132
'php_unit_dedicate_assert_internal_type' => true,
128133
'php_unit_method_casing' => true,
@@ -149,6 +154,7 @@ private static function getBaseRules(): array
149154
'simple_to_complex_string_variable' => true,
150155
'simplified_null_return' => false, // Too many old code places that become implicit, also ignores doc blocks.
151156
'single_class_element_per_statement' => true,
157+
'single_line_throw' => false,
152158
'single_quote' => false,
153159
'single_trait_insert_per_statement' => true,
154160
'space_after_semicolon' => [

0 commit comments

Comments
 (0)