Skip to content

Commit

Permalink
Remove deprecated Rector rules (#5270)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Nov 21, 2023
1 parent a9797fd commit 189a026
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 212 deletions.
53 changes: 3 additions & 50 deletions build/target-repository/docs/rector_rules_overview.md
@@ -1,4 +1,4 @@
# 355 Rules Overview
# 353 Rules Overview

<br>

Expand All @@ -8,7 +8,7 @@

- [CodeQuality](#codequality) (72)

- [CodingStyle](#codingstyle) (29)
- [CodingStyle](#codingstyle) (28)

- [DeadCode](#deadcode) (42)

Expand Down Expand Up @@ -56,7 +56,7 @@

- [Transform](#transform) (22)

- [TypeDeclaration](#typedeclaration) (42)
- [TypeDeclaration](#typedeclaration) (41)

- [Visibility](#visibility) (3)

Expand Down Expand Up @@ -1623,29 +1623,6 @@ Change `array_merge()` to spread operator

<br>

### BinarySwitchToIfElseRector

Changes switch with 2 options to if-else

- class: [`Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector`](../rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php)

```diff
-switch ($foo) {
- case 'my string':
- $result = 'ok';
- break;
-
- default:
- $result = 'not ok';
+if ($foo == 'my string') {
+ $result = 'ok';
+} else {
+ $result = 'not ok';
}
```

<br>

### CallUserFuncArrayToVariadicRector

Replace `call_user_func_array()` with variadic
Expand Down Expand Up @@ -7022,30 +6999,6 @@ Add typed property from assigned types

<br>

### TypedPropertyFromStrictConstructorReadonlyClassRector

Add typed public properties based only on strict constructor types in readonly classes

- class: [`Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorReadonlyClassRector`](../rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php)

```diff
/**
* @immutable
*/
class SomeObject
{
- public $name;
+ public string $name;

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

<br>

### TypedPropertyFromStrictConstructorRector

Add typed properties based only on strict constructor types
Expand Down
5 changes: 0 additions & 5 deletions phpstan.neon
Expand Up @@ -522,19 +522,14 @@ parameters:
message: '#Unreachable statement \- code above always terminates#'
paths:
- rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php
- rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php

# deprecated
- '#Fetching class constant class of deprecated class Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorReadonlyClassRector#'
- '#Class "Rector\\Php71\\Rector\\FuncCall\\CountOnNullRector" is missing @see annotation with test case class reference#'
- '#Register "Rector\\Php71\\Rector\\FuncCall\\CountOnNullRector" service to "php71\.php" config set#'

# dev rule
- '#Class "Rector\\Utils\\Rector\\MoveAbstractRectorToChildrenRector" is missing @see annotation with test case class reference#'

# deprecated parent property
- '#Fetching class constant class of deprecated class Rector\\CodingStyle\\Rector\\Switch_\\BinarySwitchToIfElseRector#'

-
path: rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php
message: "#Method \"processToClassConstFetch\\(\\)\" returns bool type, so the name should start with is/has/was#"
Expand Down
64 changes: 0 additions & 64 deletions rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions utils/Command/MissingInSetCommand.php
Expand Up @@ -5,12 +5,10 @@
namespace Rector\Utils\Command;

use Nette\Utils\Strings;
use Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector;
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenCollectorRector;
use Rector\TypeDeclaration\Rector\BooleanAnd\BinaryOpNullableToInstanceofRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorReadonlyClassRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictGetterMethodReturnTypeRector;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
use Rector\TypeDeclaration\Rector\While_\WhileNullableToInstanceofRector;
Expand All @@ -36,9 +34,7 @@ final class MissingInSetCommand extends Command
// collectors
FinalizeClassesWithoutChildrenCollectorRector::class,
// deprecated
TypedPropertyFromStrictConstructorReadonlyClassRector::class,
TypedPropertyFromStrictGetterMethodReturnTypeRector::class,
BinarySwitchToIfElseRector::class,
CountOnNullRector::class,
];

Expand Down

0 comments on commit 189a026

Please sign in to comment.