Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit d122530

Browse files
committed
Adjust to new prefixed ECS; add php-cs-fixer 3.0 compatibility
1 parent 950cae3 commit d122530

File tree

7 files changed

+17
-16
lines changed

7 files changed

+17
-16
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
composer.lock
22
composer.phar
33
/vendor/
4-
.php_cs.cache
4+
.php-cs-fixer.cache
55
.phpunit.result.cache

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<!-- There is always Unreleased section on the top. Subsections (Added, Changed, Fixed, Removed) should be added as needed. -->
66

77
## Unreleased
8+
- Use php-cs-fixer 3.0.
9+
- Use new prefixed version of symplify/easy-coding-standard.
810

911
## 3.0.1 - 2021-04-21
1012
- `PhpUnitExpectationFixer` is now used only on PHP 8.0+. See [symplify#3130](https://github.com/symplify/symplify/issues/3130).

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
],
1212
"require": {
1313
"php": "^7.3 || ^8.0",
14-
"friendsofphp/php-cs-fixer": "^2.16.3",
14+
"friendsofphp/php-cs-fixer": "^3.0",
15+
"nette/utils": "^3.2",
1516
"slevomat/coding-standard": "^6.4.1",
16-
"symplify/easy-coding-standard": "^9.0.50"
17+
"squizlabs/php_codesniffer": "^3.6",
18+
"symplify/easy-coding-standard": "^9.3.10"
1719
},
1820
"require-dev": {
1921
"ergebnis/composer-normalize": "^2.13.2",

ecs.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
4242
use PhpCsFixer\Fixer\ArrayNotation\NormalizeIndexBraceFixer;
4343
use PhpCsFixer\Fixer\ArrayNotation\NoTrailingCommaInSinglelineArrayFixer;
44-
use PhpCsFixer\Fixer\ArrayNotation\TrailingCommaInMultilineArrayFixer;
4544
use PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer;
4645
use PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer;
4746
use PhpCsFixer\Fixer\Basic\BracesFixer;
@@ -60,6 +59,7 @@
6059
use PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer;
6160
use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer;
6261
use PhpCsFixer\Fixer\ControlStructure\SwitchContinueToBreakFixer;
62+
use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer;
6363
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
6464
use PhpCsFixer\Fixer\FunctionNotation\CombineNestedDirnameFixer;
6565
use PhpCsFixer\Fixer\FunctionNotation\FopenFlagOrderFixer;
@@ -275,8 +275,8 @@
275275
$services->set(NormalizeIndexBraceFixer::class);
276276
// PHP single-line arrays should not have trailing comma
277277
$services->set(NoTrailingCommaInSinglelineArrayFixer::class);
278-
// PHP multi-line arrays should have a trailing comma
279-
$services->set(TrailingCommaInMultilineArrayFixer::class);
278+
// Multi-line arrays, arguments list and parameters list must have a trailing comma
279+
$services->set(TrailingCommaInMultilineFixer::class);
280280
// Arrays should be formatted like function/method arguments
281281
$services->set(TrimArraySpacesFixer::class);
282282
// In array declaration, there MUST be a whitespace after each comma
@@ -351,9 +351,8 @@
351351
$services->set(OrderedImportsFixer::class);
352352

353353
$services->set(DeclareEqualNormalizeFixer::class);
354-
355-
$services->set(IsNullFixer::class)
356-
->call('configure', [['use_yoda_style' => false]]);
354+
// Replaces `is_null($var)` expression with `null === $var`
355+
$services->set(IsNullFixer::class);
357356
// Ensures a single space after language constructs.
358357
$services->set(SingleSpaceAfterConstructFixer::class);
359358

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ parameters:
44
- src/
55
- tests/
66
bootstrapFiles:
7-
- vendor/squizlabs/php_codesniffer/autoload.php
8-
- vendor/squizlabs/php_codesniffer/src/Util/Tokens.php
7+
- vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/autoload.php
8+
- vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/src/Util/Tokens.php
99
ignoreErrors:
1010
- message: '#Parameter \#(2|3) \$(argumentStart|argumentEnd) of method PhpCsFixer\\Tokenizer\\Analyzer\\ArgumentsAnalyzer::getArgumentInfo\(\) expects int#'
1111
path: %currentWorkingDirectory%/src/Fixer/SpecifyArgSeparatorFixer.php

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4-
bootstrap="./vendor/squizlabs/php_codesniffer/tests/bootstrap.php"
4+
bootstrap="./vendor/symplify/easy-coding-standard/vendor/squizlabs/php_codesniffer/tests/bootstrap.php"
55
colors="true"
66
>
77
<testsuites>

src/Fixer/SpecifyArgSeparatorFixer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Lmc\CodingStandard\Fixer;
44

5-
use PhpCsFixer\Fixer\DefinedFixerInterface;
5+
use PhpCsFixer\Fixer\FixerInterface;
66
use PhpCsFixer\FixerDefinition\CodeSample;
77
use PhpCsFixer\FixerDefinition\FixerDefinition;
88
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
@@ -12,7 +12,7 @@
1212
use PhpCsFixer\Tokenizer\Token;
1313
use PhpCsFixer\Tokenizer\Tokens;
1414

15-
class SpecifyArgSeparatorFixer implements DefinedFixerInterface
15+
class SpecifyArgSeparatorFixer implements FixerInterface
1616
{
1717
public function getDefinition(): FixerDefinitionInterface
1818
{
@@ -25,8 +25,6 @@ public function getDefinition(): FixerDefinitionInterface
2525
. 'however when its default value "&" is changed, query string assembled by the method will be '
2626
. 'unexpectedly invalid. This Fixer forces you to not rely on ini settings and rather define '
2727
. '`$arg_separator` in third argument of the function.',
28-
null,
29-
null,
3028
'Risky when other than default "&" argument separator should be used in query strings.'
3129
);
3230
}

0 commit comments

Comments
 (0)