Skip to content

Commit

Permalink
Feat: Remove the most risky fixers from the next version (will be rea…
Browse files Browse the repository at this point in the history
…dded in the next release)
  • Loading branch information
OndraM committed May 13, 2024
1 parent 728a7ae commit af892d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
17 changes: 0 additions & 17 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
use PhpCsFixer\Fixer\FunctionNotation\LambdaNotUsedImportFixer;
use PhpCsFixer\Fixer\FunctionNotation\NoUnreachableDefaultArgumentValueFixer;
use PhpCsFixer\Fixer\FunctionNotation\NoUselessSprintfFixer;
use PhpCsFixer\Fixer\FunctionNotation\PhpdocToParamTypeFixer;
use PhpCsFixer\Fixer\FunctionNotation\PhpdocToPropertyTypeFixer;
use PhpCsFixer\Fixer\FunctionNotation\PhpdocToReturnTypeFixer;
use PhpCsFixer\Fixer\FunctionNotation\ReturnTypeDeclarationFixer;
use PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer;
use PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer;
Expand Down Expand Up @@ -133,7 +130,6 @@
use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
use PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer;
use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer;
use SlevomatCodingStandard\Sniffs\Classes\RequireConstructorPropertyPromotionSniff;
use SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullSafeObjectOperatorSniff;
use SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff;
use SlevomatCodingStandard\Sniffs\Functions\RequireTrailingCommaInCallSniff;
Expand Down Expand Up @@ -377,26 +373,13 @@
ReferenceThrowableOnlySniff::class,
// The @param, @return, @var and inline @var annotations should keep standard format
ParamReturnAndVarTagMalformsFixer::class,
// Takes `@var` annotation of non-mixed types and adjusts accordingly the property signature.
PhpdocToPropertyTypeFixer::class,
// Takes `@param` annotations of non-mixed types and adjusts accordingly the function signature.
PhpdocToParamTypeFixer::class,
// Takes `@return` annotation of non-mixed types and adjusts accordingly the function signature.
PhpdocToReturnTypeFixer::class,
// Promote constructor properties
// @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5956
RequireConstructorPropertyPromotionSniff::class,

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

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

ParameterTypeHintSniff::class,
ReturnTypeHintSniff::class,

// Multi-line arguments list in function/method declaration must have a trailing comma
RequireTrailingCommaInDeclarationSniff::class,
Expand Down
5 changes: 4 additions & 1 deletion tests/Integration/Fixtures/NewPhpFeatures.correct.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ namespace Lmc\CodingStandard\Integration\Fixtures;

class NewPhpFeatures
{
public function __construct(private string $someString) // RequireConstructorPropertyPromotionSniff
private string $someString;

public function __construct(string $someString)
{
$this->someString = $someString;
}

public function php80features(
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Fixtures/NewPhpFeatures.wrong.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class NewPhpFeatures
{
private string $someString;

public function __construct(string $someString) // RequireConstructorPropertyPromotionSniff
public function __construct(string $someString)
{
$this->someString = $someString;
}
Expand Down

0 comments on commit af892d7

Please sign in to comment.