mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
Updated Rector to commit a787d4c8f6b15ba3590e91746326241efeec8656
a787d4c8f6
Remove deprecated and empty FinalizeClassesWithoutChildrenRector + FinalizePublicClassConstantRector (#5980)
This commit is contained in:
parent
62cf2ca921
commit
48397d3f81
@ -1,4 +1,4 @@
|
|||||||
# 382 Rules Overview
|
# 380 Rules Overview
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
- [Php80](#php80) (16)
|
- [Php80](#php80) (16)
|
||||||
|
|
||||||
- [Php81](#php81) (9)
|
- [Php81](#php81) (8)
|
||||||
|
|
||||||
- [Php82](#php82) (5)
|
- [Php82](#php82) (5)
|
||||||
|
|
||||||
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
- [Php84](#php84) (1)
|
- [Php84](#php84) (1)
|
||||||
|
|
||||||
- [Privatization](#privatization) (5)
|
- [Privatization](#privatization) (4)
|
||||||
|
|
||||||
- [Removing](#removing) (5)
|
- [Removing](#removing) (5)
|
||||||
|
|
||||||
@ -5211,22 +5211,6 @@ Add `Stringable` interface to classes with `__toString()` method
|
|||||||
|
|
||||||
## Php81
|
## Php81
|
||||||
|
|
||||||
### FinalizePublicClassConstantRector
|
|
||||||
|
|
||||||
Add final to constants that does not have children
|
|
||||||
|
|
||||||
- class: [`Rector\Php81\Rector\ClassConst\FinalizePublicClassConstantRector`](../rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php)
|
|
||||||
|
|
||||||
```diff
|
|
||||||
class SomeClass
|
|
||||||
{
|
|
||||||
- public const NAME = 'value';
|
|
||||||
+ final public const NAME = 'value';
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
### FirstClassCallableRector
|
### FirstClassCallableRector
|
||||||
|
|
||||||
Upgrade array callable to first class callable
|
Upgrade array callable to first class callable
|
||||||
@ -5552,25 +5536,6 @@ Make implicit nullable param to explicit
|
|||||||
|
|
||||||
## Privatization
|
## Privatization
|
||||||
|
|
||||||
### FinalizeClassesWithoutChildrenRector
|
|
||||||
|
|
||||||
Finalize every class that has no children
|
|
||||||
|
|
||||||
- class: [`Rector\Privatization\Rector\Class_\FinalizeClassesWithoutChildrenRector`](../rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php)
|
|
||||||
|
|
||||||
```diff
|
|
||||||
-class FirstClass extends SecondClass
|
|
||||||
+final class FirstClass extends SecondClass
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
class SecondClass
|
|
||||||
{
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||
### FinalizeTestCaseClassRector
|
### FinalizeTestCaseClassRector
|
||||||
|
|
||||||
PHPUnit test case will be finalized
|
PHPUnit test case will be finalized
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace Rector\Php81\Rector\ClassConst;
|
|
||||||
|
|
||||||
use PhpParser\Node;
|
|
||||||
use PhpParser\Node\Stmt\Class_;
|
|
||||||
use Rector\Rector\AbstractRector;
|
|
||||||
use Rector\ValueObject\PhpVersionFeature;
|
|
||||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|
||||||
/**
|
|
||||||
* @deprecated This was deprecated, as its functionality caused bugs. Without knowing the full dependency tree, its risky to change
|
|
||||||
*/
|
|
||||||
final class FinalizePublicClassConstantRector extends AbstractRector implements MinPhpVersionInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
private $hasWarned = \false;
|
|
||||||
public function getRuleDefinition() : RuleDefinition
|
|
||||||
{
|
|
||||||
return new RuleDefinition('Add final to constants that does not have children', [new CodeSample(<<<'CODE_SAMPLE'
|
|
||||||
class SomeClass
|
|
||||||
{
|
|
||||||
public const NAME = 'value';
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
, <<<'CODE_SAMPLE'
|
|
||||||
class SomeClass
|
|
||||||
{
|
|
||||||
final public const NAME = 'value';
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
)]);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return array<class-string<Node>>
|
|
||||||
*/
|
|
||||||
public function getNodeTypes() : array
|
|
||||||
{
|
|
||||||
return [Class_::class];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param Class_ $node
|
|
||||||
*/
|
|
||||||
public function refactor(Node $node) : ?Node
|
|
||||||
{
|
|
||||||
if ($this->hasWarned) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
\trigger_error(\sprintf('The "%s" rule was deprecated, as its functionality caused bugs. Without knowing the full dependency tree, its risky to change.', self::class));
|
|
||||||
\sleep(3);
|
|
||||||
$this->hasWarned = \true;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public function provideMinPhpVersion() : int
|
|
||||||
{
|
|
||||||
return PhpVersionFeature::FINAL_CLASS_CONSTANTS;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare (strict_types=1);
|
|
||||||
namespace Rector\Privatization\Rector\Class_;
|
|
||||||
|
|
||||||
use PhpParser\Node;
|
|
||||||
use PhpParser\Node\Stmt\Class_;
|
|
||||||
use Rector\Rector\AbstractRector;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|
||||||
/**
|
|
||||||
* @deprecated This was deprecated, as its functionality caused bugs. Without knowing the full dependency tree, its very risky to use. Use https://github.com/TomasVotruba/finalize instead as it runs with full context.
|
|
||||||
*/
|
|
||||||
final class FinalizeClassesWithoutChildrenRector extends AbstractRector
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
private $hasWarned = \false;
|
|
||||||
public function getRuleDefinition() : RuleDefinition
|
|
||||||
{
|
|
||||||
return new RuleDefinition('Finalize every class that has no children', [new CodeSample(<<<'CODE_SAMPLE'
|
|
||||||
class FirstClass extends SecondClass
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
class SecondClass
|
|
||||||
{
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
, <<<'CODE_SAMPLE'
|
|
||||||
final class FirstClass extends SecondClass
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
class SecondClass
|
|
||||||
{
|
|
||||||
}
|
|
||||||
CODE_SAMPLE
|
|
||||||
)]);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return array<class-string<Node>>
|
|
||||||
*/
|
|
||||||
public function getNodeTypes() : array
|
|
||||||
{
|
|
||||||
return [Class_::class];
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param Class_ $node
|
|
||||||
*/
|
|
||||||
public function refactor(Node $node) : ?Node
|
|
||||||
{
|
|
||||||
if ($this->hasWarned) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
\trigger_error(\sprintf('The "%s" rule was deprecated, as its functionality caused bugs. Without knowing the full dependency tree, its risky to change. Use "%s" instead', self::class, 'https://github.com/rectorphp/swiss-knife#4-finalize-classes-without-children'));
|
|
||||||
\sleep(3);
|
|
||||||
$this->hasWarned = \true;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '69872ef5930d31c13bb7c9b1650ff4137269c1a4';
|
public const PACKAGE_VERSION = 'a787d4c8f6b15ba3590e91746326241efeec8656';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2024-06-19 15:52:02';
|
public const RELEASE_DATE = '2024-06-19 17:37:29';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
@ -361,15 +361,6 @@ final class PhpDocInfo
|
|||||||
{
|
{
|
||||||
return $this->phpDocNode->getTemplateTagValues();
|
return $this->phpDocNode->getTemplateTagValues();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @deprecated Change doc block and print directly in the node instead
|
|
||||||
* Should be handled by attributes of phpdoc node - if stard_and_end is missing in one of nodes, it has been changed
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
public function markAsChanged() : void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
public function makeMultiLined() : void
|
public function makeMultiLined() : void
|
||||||
{
|
{
|
||||||
$this->isSingleLine = \false;
|
$this->isSingleLine = \false;
|
||||||
|
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
@ -1929,7 +1929,6 @@ return array(
|
|||||||
'Rector\\Php81\\NodeAnalyzer\\ComplexNewAnalyzer' => $baseDir . '/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php',
|
'Rector\\Php81\\NodeAnalyzer\\ComplexNewAnalyzer' => $baseDir . '/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php',
|
||||||
'Rector\\Php81\\NodeFactory\\EnumFactory' => $baseDir . '/rules/Php81/NodeFactory/EnumFactory.php',
|
'Rector\\Php81\\NodeFactory\\EnumFactory' => $baseDir . '/rules/Php81/NodeFactory/EnumFactory.php',
|
||||||
'Rector\\Php81\\Rector\\Array_\\FirstClassCallableRector' => $baseDir . '/rules/Php81/Rector/Array_/FirstClassCallableRector.php',
|
'Rector\\Php81\\Rector\\Array_\\FirstClassCallableRector' => $baseDir . '/rules/Php81/Rector/Array_/FirstClassCallableRector.php',
|
||||||
'Rector\\Php81\\Rector\\ClassConst\\FinalizePublicClassConstantRector' => $baseDir . '/rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php',
|
|
||||||
'Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector' => $baseDir . '/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php',
|
'Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector' => $baseDir . '/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php',
|
||||||
'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php',
|
'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php',
|
||||||
'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php',
|
'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => $baseDir . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php',
|
||||||
@ -2013,7 +2012,6 @@ return array(
|
|||||||
'Rector\\Privatization\\Guard\\ParentPropertyLookupGuard' => $baseDir . '/rules/Privatization/Guard/ParentPropertyLookupGuard.php',
|
'Rector\\Privatization\\Guard\\ParentPropertyLookupGuard' => $baseDir . '/rules/Privatization/Guard/ParentPropertyLookupGuard.php',
|
||||||
'Rector\\Privatization\\NodeManipulator\\VisibilityManipulator' => $baseDir . '/rules/Privatization/NodeManipulator/VisibilityManipulator.php',
|
'Rector\\Privatization\\NodeManipulator\\VisibilityManipulator' => $baseDir . '/rules/Privatization/NodeManipulator/VisibilityManipulator.php',
|
||||||
'Rector\\Privatization\\Rector\\ClassMethod\\PrivatizeFinalClassMethodRector' => $baseDir . '/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php',
|
'Rector\\Privatization\\Rector\\ClassMethod\\PrivatizeFinalClassMethodRector' => $baseDir . '/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php',
|
||||||
'Rector\\Privatization\\Rector\\Class_\\FinalizeClassesWithoutChildrenRector' => $baseDir . '/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php',
|
|
||||||
'Rector\\Privatization\\Rector\\Class_\\FinalizeTestCaseClassRector' => $baseDir . '/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php',
|
'Rector\\Privatization\\Rector\\Class_\\FinalizeTestCaseClassRector' => $baseDir . '/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php',
|
||||||
'Rector\\Privatization\\Rector\\MethodCall\\PrivatizeLocalGetterToPropertyRector' => $baseDir . '/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php',
|
'Rector\\Privatization\\Rector\\MethodCall\\PrivatizeLocalGetterToPropertyRector' => $baseDir . '/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php',
|
||||||
'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => $baseDir . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php',
|
'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => $baseDir . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php',
|
||||||
|
2
vendor/composer/autoload_static.php
vendored
2
vendor/composer/autoload_static.php
vendored
@ -2148,7 +2148,6 @@ class ComposerStaticInitc6bcdb63495c7f1cc77baa21ee134e8a
|
|||||||
'Rector\\Php81\\NodeAnalyzer\\ComplexNewAnalyzer' => __DIR__ . '/../..' . '/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php',
|
'Rector\\Php81\\NodeAnalyzer\\ComplexNewAnalyzer' => __DIR__ . '/../..' . '/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php',
|
||||||
'Rector\\Php81\\NodeFactory\\EnumFactory' => __DIR__ . '/../..' . '/rules/Php81/NodeFactory/EnumFactory.php',
|
'Rector\\Php81\\NodeFactory\\EnumFactory' => __DIR__ . '/../..' . '/rules/Php81/NodeFactory/EnumFactory.php',
|
||||||
'Rector\\Php81\\Rector\\Array_\\FirstClassCallableRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Array_/FirstClassCallableRector.php',
|
'Rector\\Php81\\Rector\\Array_\\FirstClassCallableRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Array_/FirstClassCallableRector.php',
|
||||||
'Rector\\Php81\\Rector\\ClassConst\\FinalizePublicClassConstantRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php',
|
|
||||||
'Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php',
|
'Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php',
|
||||||
'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php',
|
'Rector\\Php81\\Rector\\Class_\\MyCLabsClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/MyCLabsClassToEnumRector.php',
|
||||||
'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php',
|
'Rector\\Php81\\Rector\\Class_\\SpatieEnumClassToEnumRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/Class_/SpatieEnumClassToEnumRector.php',
|
||||||
@ -2232,7 +2231,6 @@ class ComposerStaticInitc6bcdb63495c7f1cc77baa21ee134e8a
|
|||||||
'Rector\\Privatization\\Guard\\ParentPropertyLookupGuard' => __DIR__ . '/../..' . '/rules/Privatization/Guard/ParentPropertyLookupGuard.php',
|
'Rector\\Privatization\\Guard\\ParentPropertyLookupGuard' => __DIR__ . '/../..' . '/rules/Privatization/Guard/ParentPropertyLookupGuard.php',
|
||||||
'Rector\\Privatization\\NodeManipulator\\VisibilityManipulator' => __DIR__ . '/../..' . '/rules/Privatization/NodeManipulator/VisibilityManipulator.php',
|
'Rector\\Privatization\\NodeManipulator\\VisibilityManipulator' => __DIR__ . '/../..' . '/rules/Privatization/NodeManipulator/VisibilityManipulator.php',
|
||||||
'Rector\\Privatization\\Rector\\ClassMethod\\PrivatizeFinalClassMethodRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php',
|
'Rector\\Privatization\\Rector\\ClassMethod\\PrivatizeFinalClassMethodRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php',
|
||||||
'Rector\\Privatization\\Rector\\Class_\\FinalizeClassesWithoutChildrenRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Class_/FinalizeClassesWithoutChildrenRector.php',
|
|
||||||
'Rector\\Privatization\\Rector\\Class_\\FinalizeTestCaseClassRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php',
|
'Rector\\Privatization\\Rector\\Class_\\FinalizeTestCaseClassRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Class_/FinalizeTestCaseClassRector.php',
|
||||||
'Rector\\Privatization\\Rector\\MethodCall\\PrivatizeLocalGetterToPropertyRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php',
|
'Rector\\Privatization\\Rector\\MethodCall\\PrivatizeLocalGetterToPropertyRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php',
|
||||||
'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php',
|
'Rector\\Privatization\\Rector\\Property\\PrivatizeFinalClassPropertyRector' => __DIR__ . '/../..' . '/rules/Privatization/Rector/Property/PrivatizeFinalClassPropertyRector.php',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user