Skip to content

Commit c922594

Browse files
committed
Merge remote-tracking branch 'origin/main' into phpdoc-sorter-property
# Conflicts: # src/Fixer/PhpdocPropertySortedFixer.php # tests/Fixer/PhpdocPropertySortedFixerTest.php
2 parents c060132 + cf73689 commit c922594

File tree

12 files changed

+87
-38
lines changed

12 files changed

+87
-38
lines changed

.dev-tools/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
"ergebnis/composer-normalize": "^2.48.2",
66
"infection/infection": "^0.31.2",
77
"kubawerlos/composer-smaller-lock": "^1.1.0",
8-
"kubawerlos/php-cs-fixer-config": "^5.3",
8+
"kubawerlos/php-cs-fixer-config": "^5.4",
99
"mi-schi/phpmd-extension": "^4.3",
1010
"phpmd/phpmd": "^2.15",
1111
"phpstan/extension-installer": "^1.4.3",
12-
"phpstan/phpstan": "^2.1.23",
12+
"phpstan/phpstan": "^2.1.28",
1313
"phpstan/phpstan-phpunit": "^2.0.7",
1414
"phpstan/phpstan-strict-rules": "^2.0.6",
1515
"shipmonk/composer-dependency-analyser": "^1.8.3",
1616
"shipmonk/dead-code-detector": "^0.13.3",
1717
"shipmonk/phpstan-rules": "^4.2.1",
18-
"squizlabs/php_codesniffer": "^3.13.4",
18+
"squizlabs/php_codesniffer": "^4.0",
1919
"tomasvotruba/type-coverage": "^2.0.2",
2020
"vimeo/psalm": "^6.13.1"
2121
},

.dev-tools/composer.lock

Lines changed: 26 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.dev-tools/phpcs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<rule ref='PSR12'>
1515
<exclude name='Generic.Files.LineLength' />
16-
<exclude name='PSR12.Files.FileHeader.SpacingAfterBlock' />
16+
<exclude name='PSR12.Files.FileHeader.SpacingAfterTagBlock' />
1717
<exclude name='PSR12.Files.OpenTag.NotAlone' />
1818
<exclude name='Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore' />
1919
</rule>

.dev-tools/psalm_stub.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
*/
1111

1212
namespace PhpCsFixer\Tokenizer {
13+
/**
14+
* @internal
15+
*/
1316
final class FCT
1417
{
1518
public const int T_ATTRIBUTE = \T_ATTRIBUTE;
@@ -18,5 +21,8 @@ final class FCT
1821
public const int T_PUBLIC_SET = \T_PUBLIC_SET;
1922
public const int T_READONLY = \T_READONLY;
2023
}
24+
/**
25+
* @internal
26+
*/
2127
final class OtherClassSoTheNameOfClassAboveIsNotChanged {}
2228
}

.dev-tools/src/InfectionConfigBuilder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Infection\Mutator\ProfileList;
1515
use PhpCsFixerCustomFixers\Fixer\NoLeadingSlashInGlobalNamespaceFixer;
1616

17+
/**
18+
* @internal
19+
*/
1720
final class InfectionConfigBuilder
1821
{
1922
private const UNWANTED_MUTATORS = [

.dev-tools/src/Priority/PriorityCollection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
use PhpCsFixerCustomFixers\Fixers;
2020
use Tests\PriorityTest;
2121

22+
/**
23+
* @internal
24+
*/
2225
final class PriorityCollection
2326
{
2427
/** @var list<PriorityFixer> */

.dev-tools/src/Priority/PriorityFixer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use PhpCsFixer\Fixer\FixerInterface;
1515

16+
/**
17+
* @internal
18+
*/
1619
final class PriorityFixer
1720
{
1821
private FixerInterface $fixer;

.dev-tools/src/Readme/ReadmeCommand.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313

1414
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
1515
use PhpCsFixer\Fixer\DeprecatedFixerInterface;
16+
use PhpCsFixer\Fixer\FixerInterface;
1617
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
1718
use PhpCsFixer\FixerDefinition\CodeSampleInterface;
19+
use PhpCsFixer\FixerFactory;
20+
use PhpCsFixer\RuleSet\RuleSet;
1821
use PhpCsFixer\Tokenizer\Tokens;
1922
use PhpCsFixer\Utils;
2023
use PhpCsFixer\WhitespacesFixerConfig;
@@ -168,7 +171,22 @@ private static function fixers(): string
168171
$fixer->getDefinition()->getSummary(),
169172
);
170173

171-
$output .= $fixer instanceof DeprecatedFixerInterface ? \sprintf("\n DEPRECATED: use `%s` instead.", \implode('`, `', $fixer->getSuccessorsNames())) : '';
174+
if ($fixer instanceof DeprecatedFixerInterface) {
175+
$fixers = (new FixerFactory())
176+
->registerBuiltInFixers()
177+
->registerCustomFixers(new Fixers())
178+
->useRuleSet(new RuleSet(\array_combine($fixer->getSuccessorsNames(), [true])))
179+
->getFixers();
180+
181+
$successors = \array_map(
182+
static fn (FixerInterface $fixer): string => $fixer instanceof AbstractFixer
183+
? (new \ReflectionObject($fixer))->getShortName()
184+
: $fixer->getName(),
185+
$fixers,
186+
);
187+
188+
$output .= \sprintf("\n DEPRECATED: use `%s` instead.", \implode('`, `', $successors));
189+
}
172190

173191
if ($fixer instanceof DataProviderStaticFixer) {
174192
$fixer->configure(['force' => true]);

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG for PHP CS Fixer: custom fixers
22

3+
## v3.34.0
4+
- Add PhpdocPropertySortedFixer
5+
- Deprecate PhpDocPropertySorterFixer - use PhpdocPropertySortedFixer
6+
37
## v3.33.0
48
- Add PhpDocPropertySorterFixer
59
- Deprecate PhpdocTagNoNamedArgumentsFixer - use "phpdoc_tag_no_named_arguments"

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ Configuration options:
463463

464464
#### PhpDocPropertySorterFixer
465465
Sorts @property annotations in PHPDoc blocks alphabetically within groups separated by empty lines.
466+
DEPRECATED: use `PhpdocPropertySortedFixer` instead.
466467
```diff
467468
<?php
468469
/**
@@ -615,6 +616,19 @@ The `@param` annotations must have a type.
615616
function a($foo, $bar) {}
616617
```
617618

619+
#### PhpdocPropertySortedFixer
620+
Sorts @property annotations in PHPDoc blocks alphabetically within groups separated by empty lines.
621+
```diff
622+
<?php
623+
/**
624+
- * @property string $zzz
625+
* @property int $aaa
626+
* @property bool $mmm
627+
+ * @property string $zzz
628+
*/
629+
class Foo {}
630+
```
631+
618632
#### PhpdocSelfAccessorFixer
619633
In PHPDoc, the class or interface element `self` must be used instead of the class name itself.
620634
```diff

0 commit comments

Comments
 (0)