Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated Rector rules #5270

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 3 additions & 50 deletions build/target-repository/docs/rector_rules_overview.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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