Skip to content

Commit ccbe5ec

Browse files
committed
Feat: Remove the most risky fixers from the next version (will be readded in the next release)
1 parent 728a7ae commit ccbe5ec

File tree

3 files changed

+5
-31
lines changed

3 files changed

+5
-31
lines changed

ecs.php

-29
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@
6969
use PhpCsFixer\Fixer\FunctionNotation\LambdaNotUsedImportFixer;
7070
use PhpCsFixer\Fixer\FunctionNotation\NoUnreachableDefaultArgumentValueFixer;
7171
use PhpCsFixer\Fixer\FunctionNotation\NoUselessSprintfFixer;
72-
use PhpCsFixer\Fixer\FunctionNotation\PhpdocToParamTypeFixer;
73-
use PhpCsFixer\Fixer\FunctionNotation\PhpdocToPropertyTypeFixer;
74-
use PhpCsFixer\Fixer\FunctionNotation\PhpdocToReturnTypeFixer;
7572
use PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer;
7673
use PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer;
7774
use PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer;
@@ -133,7 +130,6 @@
133130
use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
134131
use PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer;
135132
use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer;
136-
use SlevomatCodingStandard\Sniffs\Classes\RequireConstructorPropertyPromotionSniff;
137133
use SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullSafeObjectOperatorSniff;
138134
use SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff;
139135
use SlevomatCodingStandard\Sniffs\Functions\RequireTrailingCommaInCallSniff;
@@ -377,26 +373,13 @@
377373
ReferenceThrowableOnlySniff::class,
378374
// The @param, @return, @var and inline @var annotations should keep standard format
379375
ParamReturnAndVarTagMalformsFixer::class,
380-
// Takes `@var` annotation of non-mixed types and adjusts accordingly the property signature.
381-
PhpdocToPropertyTypeFixer::class,
382-
// Takes `@param` annotations of non-mixed types and adjusts accordingly the function signature.
383-
PhpdocToParamTypeFixer::class,
384-
// Takes `@return` annotation of non-mixed types and adjusts accordingly the function signature.
385-
PhpdocToReturnTypeFixer::class,
386-
// Promote constructor properties
387-
// @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5956
388-
RequireConstructorPropertyPromotionSniff::class,
389376

390377
// switch -> match
391378
// @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5894
392379

393380
// Require \Stringable interface in classes implementing __toString() method
394381
// > it may probably be a phpstan rule, more than cs rule - since it needs a class hierarchy to solve this
395382
// @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/6235
396-
PropertyTypeHintSniff::class,
397-
398-
ParameterTypeHintSniff::class,
399-
ReturnTypeHintSniff::class,
400383

401384
// Multi-line arguments list in function/method declaration must have a trailing comma
402385
RequireTrailingCommaInDeclarationSniff::class,
@@ -531,18 +514,6 @@
531514
// Allow single line closures
532515
ScopeClosingBraceSniff::class . '.ContentBefore' => null,
533516

534-
// Skip unwanted rules from PropertyTypeHintSniff
535-
PropertyTypeHintSniff::class . '.' . PropertyTypeHintSniff::CODE_MISSING_TRAVERSABLE_TYPE_HINT_SPECIFICATION => null,
536-
PropertyTypeHintSniff::class . '.' . PropertyTypeHintSniff::CODE_MISSING_ANY_TYPE_HINT => null,
537-
538-
// Skip unwanted rules from ParameterTypeHintSniff
539-
ParameterTypeHintSniff::class . '.' . ParameterTypeHintSniff::CODE_MISSING_TRAVERSABLE_TYPE_HINT_SPECIFICATION => null,
540-
ParameterTypeHintSniff::class . '.' . ParameterTypeHintSniff::CODE_MISSING_ANY_TYPE_HINT => null,
541-
542-
// Skip unwanted rules from ReturnTypeHintSniff
543-
ReturnTypeHintSniff::class . '.' . ReturnTypeHintSniff::CODE_MISSING_TRAVERSABLE_TYPE_HINT_SPECIFICATION => null,
544-
ReturnTypeHintSniff::class . '.' . ReturnTypeHintSniff::CODE_MISSING_ANY_TYPE_HINT => null,
545-
546517
// We use declare(strict_types=1); after opening tag
547518
BlankLineAfterOpeningTagFixer::class => null,
548519
]);

tests/Integration/Fixtures/NewPhpFeatures.correct.php.inc

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ namespace Lmc\CodingStandard\Integration\Fixtures;
44

55
class NewPhpFeatures
66
{
7-
public function __construct(private string $someString) // RequireConstructorPropertyPromotionSniff
7+
private string $someString;
8+
9+
public function __construct(string $someString)
810
{
11+
$this->someString = $someString;
912
}
1013

1114
public function php80features(

tests/Integration/Fixtures/NewPhpFeatures.wrong.php.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class NewPhpFeatures
66
{
77
private string $someString;
88

9-
public function __construct(string $someString) // RequireConstructorPropertyPromotionSniff
9+
public function __construct(string $someString)
1010
{
1111
$this->someString = $someString;
1212
}

0 commit comments

Comments
 (0)