mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 08:20:53 +00:00
Updated Rector to commit 189a02635533f450aea58d8de075e494f538182b
189a026355
Remove deprecated Rector rules (#5270)
This commit is contained in:
parent
d1c1d175ce
commit
7a8bc36a24
|
@ -1,4 +1,4 @@
|
||||||
# 355 Rules Overview
|
# 353 Rules Overview
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
- [CodeQuality](#codequality) (72)
|
- [CodeQuality](#codequality) (72)
|
||||||
|
|
||||||
- [CodingStyle](#codingstyle) (29)
|
- [CodingStyle](#codingstyle) (28)
|
||||||
|
|
||||||
- [DeadCode](#deadcode) (42)
|
- [DeadCode](#deadcode) (42)
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
|
|
||||||
- [Transform](#transform) (22)
|
- [Transform](#transform) (22)
|
||||||
|
|
||||||
- [TypeDeclaration](#typedeclaration) (42)
|
- [TypeDeclaration](#typedeclaration) (41)
|
||||||
|
|
||||||
- [Visibility](#visibility) (3)
|
- [Visibility](#visibility) (3)
|
||||||
|
|
||||||
|
@ -1623,29 +1623,6 @@ Change `array_merge()` to spread operator
|
||||||
|
|
||||||
<br>
|
<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
|
### CallUserFuncArrayToVariadicRector
|
||||||
|
|
||||||
Replace `call_user_func_array()` with variadic
|
Replace `call_user_func_array()` with variadic
|
||||||
|
@ -7022,30 +6999,6 @@ Add typed property from assigned types
|
||||||
|
|
||||||
<br>
|
<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
|
### TypedPropertyFromStrictConstructorRector
|
||||||
|
|
||||||
Add typed properties based only on strict constructor types
|
Add typed properties based only on strict constructor types
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace Rector\CodingStyle\Rector\Switch_;
|
|
||||||
|
|
||||||
use PhpParser\Node;
|
|
||||||
use PhpParser\Node\Stmt\Switch_;
|
|
||||||
use Rector\Core\Rector\AbstractRector;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|
||||||
/**
|
|
||||||
* @deprecated This rule is deprecated as prevents refactoring to match (), use PHPStan, manual handling and PHP 8.0 upgrade set instead
|
|
||||||
*/
|
|
||||||
final class BinarySwitchToIfElseRector extends AbstractRector
|
|
||||||
{
|
|
||||||
public function getRuleDefinition() : RuleDefinition
|
|
||||||
{
|
|
||||||
return new RuleDefinition('Changes switch with 2 options to if-else', [new CodeSample(<<<'CODE_SAMPLE'
|
|
||||||
switch ($foo) {
|
|
||||||
case 'my string':
|
|
||||||
$result = 'ok';
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$result = 'not ok';
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
, <<<'CODE_SAMPLE'
|
|
||||||
if ($foo == 'my string') {
|
|
||||||
$result = 'ok';
|
|
||||||
} else {
|
|
||||||
$result = 'not ok';
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
)]);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return array<class-string<Node>>
|
|
||||||
*/
|
|
||||||
public function getNodeTypes() : array
|
|
||||||
{
|
|
||||||
return [Switch_::class];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param Switch_ $node
|
|
||||||
*/
|
|
||||||
public function refactor(Node $node) : ?Node
|
|
||||||
{
|
|
||||||
\trigger_error(\sprintf('The "%s" rule is deprecated as prevents refactoring to match (), use PHPStan, manual handling and PHP 8.0 upgrade set instead.', self::class), \E_USER_ERROR);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace Rector\TypeDeclaration\Rector\Property;
|
|
||||||
|
|
||||||
use PhpParser\Node;
|
|
||||||
use PhpParser\Node\Stmt\Class_;
|
|
||||||
use PHPStan\Analyser\Scope;
|
|
||||||
use Rector\Core\Rector\AbstractScopeAwareRector;
|
|
||||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
|
||||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|
||||||
/**
|
|
||||||
* @deprecated This rule is deprecated, as based on docblock and public elements,
|
|
||||||
* use private properties and property promotion instead to use PHP language features.
|
|
||||||
*/
|
|
||||||
final class TypedPropertyFromStrictConstructorReadonlyClassRector extends AbstractScopeAwareRector implements MinPhpVersionInterface
|
|
||||||
{
|
|
||||||
public function getRuleDefinition() : RuleDefinition
|
|
||||||
{
|
|
||||||
return new RuleDefinition('Add typed public properties based only on strict constructor types in readonly classes', [new CodeSample(<<<'CODE_SAMPLE'
|
|
||||||
/**
|
|
||||||
* @immutable
|
|
||||||
*/
|
|
||||||
class SomeObject
|
|
||||||
{
|
|
||||||
public $name;
|
|
||||||
|
|
||||||
public function __construct(string $name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
, <<<'CODE_SAMPLE'
|
|
||||||
/**
|
|
||||||
* @immutable
|
|
||||||
*/
|
|
||||||
class SomeObject
|
|
||||||
{
|
|
||||||
public string $name;
|
|
||||||
|
|
||||||
public function __construct(string $name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
)]);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return array<class-string<Node>>
|
|
||||||
*/
|
|
||||||
public function getNodeTypes() : array
|
|
||||||
{
|
|
||||||
return [Class_::class];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param Class_ $node
|
|
||||||
*/
|
|
||||||
public function refactorWithScope(Node $node, Scope $scope) : ?Node
|
|
||||||
{
|
|
||||||
\trigger_error(\sprintf('The "%s" rule is deprecated as based on docblock and public elements. Use private properties and property promotion rules instead.', self::class), \E_USER_ERROR);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public function provideMinPhpVersion() : int
|
|
||||||
{
|
|
||||||
return PhpVersionFeature::TYPED_PROPERTIES;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = 'a9797fdc1ca6b8d7080fb1299b44fcb94ecd5936';
|
public const PACKAGE_VERSION = '189a02635533f450aea58d8de075e494f538182b';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-11-21 15:26:30';
|
public const RELEASE_DATE = '2023-11-21 14:30:22';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
|
@ -1138,7 +1138,6 @@ return array(
|
||||||
'Rector\\CodingStyle\\Rector\\Stmt\\NewlineAfterStatementRector' => $baseDir . '/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php',
|
'Rector\\CodingStyle\\Rector\\Stmt\\NewlineAfterStatementRector' => $baseDir . '/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\String_\\SymplifyQuoteEscapeRector' => $baseDir . '/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php',
|
'Rector\\CodingStyle\\Rector\\String_\\SymplifyQuoteEscapeRector' => $baseDir . '/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\String_\\UseClassKeywordForClassNameResolutionRector' => $baseDir . '/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php',
|
'Rector\\CodingStyle\\Rector\\String_\\UseClassKeywordForClassNameResolutionRector' => $baseDir . '/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\Switch_\\BinarySwitchToIfElseRector' => $baseDir . '/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php',
|
|
||||||
'Rector\\CodingStyle\\Rector\\Ternary\\TernaryConditionVariableAssignmentRector' => $baseDir . '/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php',
|
'Rector\\CodingStyle\\Rector\\Ternary\\TernaryConditionVariableAssignmentRector' => $baseDir . '/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => $baseDir . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php',
|
'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => $baseDir . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php',
|
||||||
'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => $baseDir . '/rules/CodingStyle/Reflection/VendorLocationDetector.php',
|
'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => $baseDir . '/rules/CodingStyle/Reflection/VendorLocationDetector.php',
|
||||||
|
@ -2327,7 +2326,6 @@ return array(
|
||||||
'Rector\\TypeDeclaration\\Rector\\Param\\ParamTypeFromStrictTypedPropertyRector' => $baseDir . '/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Param\\ParamTypeFromStrictTypedPropertyRector' => $baseDir . '/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\AddPropertyTypeDeclarationRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\AddPropertyTypeDeclarationRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromAssignsRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromAssignsRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorReadonlyClassRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php',
|
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictGetterMethodReturnTypeRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictGetterMethodReturnTypeRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictSetUpRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictSetUpRector' => $baseDir . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php',
|
||||||
|
|
2
vendor/composer/autoload_static.php
vendored
2
vendor/composer/autoload_static.php
vendored
|
@ -1356,7 +1356,6 @@ class ComposerStaticInita55c41c7fa52abd86138c6f32df1d185
|
||||||
'Rector\\CodingStyle\\Rector\\Stmt\\NewlineAfterStatementRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php',
|
'Rector\\CodingStyle\\Rector\\Stmt\\NewlineAfterStatementRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Stmt/NewlineAfterStatementRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\String_\\SymplifyQuoteEscapeRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php',
|
'Rector\\CodingStyle\\Rector\\String_\\SymplifyQuoteEscapeRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\String_\\UseClassKeywordForClassNameResolutionRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php',
|
'Rector\\CodingStyle\\Rector\\String_\\UseClassKeywordForClassNameResolutionRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/String_/UseClassKeywordForClassNameResolutionRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\Switch_\\BinarySwitchToIfElseRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Switch_/BinarySwitchToIfElseRector.php',
|
|
||||||
'Rector\\CodingStyle\\Rector\\Ternary\\TernaryConditionVariableAssignmentRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php',
|
'Rector\\CodingStyle\\Rector\\Ternary\\TernaryConditionVariableAssignmentRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php',
|
||||||
'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php',
|
'Rector\\CodingStyle\\Rector\\Use_\\SeparateMultiUseImportsRector' => __DIR__ . '/../..' . '/rules/CodingStyle/Rector/Use_/SeparateMultiUseImportsRector.php',
|
||||||
'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => __DIR__ . '/../..' . '/rules/CodingStyle/Reflection/VendorLocationDetector.php',
|
'Rector\\CodingStyle\\Reflection\\VendorLocationDetector' => __DIR__ . '/../..' . '/rules/CodingStyle/Reflection/VendorLocationDetector.php',
|
||||||
|
@ -2545,7 +2544,6 @@ class ComposerStaticInita55c41c7fa52abd86138c6f32df1d185
|
||||||
'Rector\\TypeDeclaration\\Rector\\Param\\ParamTypeFromStrictTypedPropertyRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Param\\ParamTypeFromStrictTypedPropertyRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\AddPropertyTypeDeclarationRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\AddPropertyTypeDeclarationRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/AddPropertyTypeDeclarationRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromAssignsRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromAssignsRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorReadonlyClassRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorReadonlyClassRector.php',
|
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictConstructorRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictGetterMethodReturnTypeRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictGetterMethodReturnTypeRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictGetterMethodReturnTypeRector.php',
|
||||||
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictSetUpRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php',
|
'Rector\\TypeDeclaration\\Rector\\Property\\TypedPropertyFromStrictSetUpRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictSetUpRector.php',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user