mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 08:20:53 +00:00
Updated Rector to commit b218e334ca
b218e334ca
[DowngradePhp74] Add DowngradePreviouslyImplementedInterfaceRector (#1159)
This commit is contained in:
parent
ff1ad0ced7
commit
4286dd4a43
|
@ -13,6 +13,7 @@ use Rector\DowngradePhp74\Rector\Coalesce\DowngradeNullCoalescingOperatorRector;
|
|||
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeArrayMergeCallWithoutArgumentsRector;
|
||||
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeStripTagsCallWithArrayRector;
|
||||
use Rector\DowngradePhp74\Rector\Identical\DowngradeFreadFwriteFalsyToNegationRector;
|
||||
use Rector\DowngradePhp74\Rector\Interface_\DowngradePreviouslyImplementedInterfaceRector;
|
||||
use Rector\DowngradePhp74\Rector\LNumber\DowngradeNumericLiteralSeparatorRector;
|
||||
use Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
@ -30,4 +31,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
|
|||
$services->set(\Rector\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector::class);
|
||||
$services->set(\Rector\DowngradePhp74\Rector\FuncCall\DowngradeArrayMergeCallWithoutArgumentsRector::class);
|
||||
$services->set(\Rector\DowngradePhp74\Rector\Identical\DowngradeFreadFwriteFalsyToNegationRector::class);
|
||||
$services->set(\Rector\DowngradePhp74\Rector\Interface_\DowngradePreviouslyImplementedInterfaceRector::class);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# 476 Rules Overview
|
||||
# 477 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
- [DowngradePhp73](#downgradephp73) (6)
|
||||
|
||||
- [DowngradePhp74](#downgradephp74) (10)
|
||||
- [DowngradePhp74](#downgradephp74) (11)
|
||||
|
||||
- [DowngradePhp80](#downgradephp80) (18)
|
||||
|
||||
|
@ -4921,6 +4921,25 @@ Remove "_" as thousands separator in numbers
|
|||
|
||||
<br>
|
||||
|
||||
### DowngradePreviouslyImplementedInterfaceRector
|
||||
|
||||
Downgrade previously implemented interface
|
||||
|
||||
- class: [`Rector\DowngradePhp74\Rector\Interface_\DowngradePreviouslyImplementedInterfaceRector`](../rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php)
|
||||
|
||||
```diff
|
||||
interface ContainerExceptionInterface extends Throwable
|
||||
{
|
||||
}
|
||||
|
||||
-interface ExceptionInterface extends ContainerExceptionInterface, Throwable
|
||||
+interface ExceptionInterface extends ContainerExceptionInterface
|
||||
{
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### DowngradeStripTagsCallWithArrayRector
|
||||
|
||||
Convert 2nd param to `strip_tags` from array to string
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\DowngradePhp74\Rector\Interface_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Stmt\Interface_;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\Tests\DowngradePhp74\Rector\Interface_\DowngradePreviouslyImplementedInterfaceRector\DowngradePreviouslyImplementedInterfaceRectorTest
|
||||
*/
|
||||
final class DowngradePreviouslyImplementedInterfaceRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var \Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer
|
||||
*/
|
||||
private $familyRelationsAnalyzer;
|
||||
public function __construct(\Rector\FamilyTree\Reflection\FamilyRelationsAnalyzer $familyRelationsAnalyzer)
|
||||
{
|
||||
$this->familyRelationsAnalyzer = $familyRelationsAnalyzer;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Downgrade previously implemented interface', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
interface ContainerExceptionInterface extends Throwable
|
||||
{
|
||||
}
|
||||
|
||||
interface ExceptionInterface extends ContainerExceptionInterface, Throwable
|
||||
{
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
interface ContainerExceptionInterface extends Throwable
|
||||
{
|
||||
}
|
||||
|
||||
interface ExceptionInterface extends ContainerExceptionInterface
|
||||
{
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Stmt\Interface_::class];
|
||||
}
|
||||
/**
|
||||
* @param Interface_ $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
$extends = $node->extends;
|
||||
if ($extends === []) {
|
||||
return null;
|
||||
}
|
||||
if (\count($extends) === 1) {
|
||||
return null;
|
||||
}
|
||||
$collectInterfaces = [];
|
||||
$isCleaned = \false;
|
||||
foreach ($extends as $key => $extend) {
|
||||
if (!$extend instanceof \PhpParser\Node\Name\FullyQualified) {
|
||||
continue;
|
||||
}
|
||||
if (\in_array($extend->toString(), $collectInterfaces, \true)) {
|
||||
unset($extends[$key]);
|
||||
$isCleaned = \true;
|
||||
continue;
|
||||
}
|
||||
$collectInterfaces = \array_merge($collectInterfaces, $this->familyRelationsAnalyzer->getClassLikeAncestorNames($extend));
|
||||
}
|
||||
if (!$isCleaned) {
|
||||
return null;
|
||||
}
|
||||
$node->extends = $extends;
|
||||
return $node;
|
||||
}
|
||||
}
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'e79aa9d760803cb2c7179bbe9822486805a92f5b';
|
||||
public const PACKAGE_VERSION = 'b218e334cae2644a56004c25ab2aa637437b2935';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-11-05 23:53:40';
|
||||
public const RELEASE_DATE = '2021-11-05 23:22:41';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20211105\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6::getLoader();
|
||||
return ComposerAutoloaderInitde09d5a98aba4e33ea7edf20bc357990::getLoader();
|
||||
|
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
|
@ -1838,6 +1838,7 @@ return array(
|
|||
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeArrayMergeCallWithoutArgumentsRector' => $baseDir . '/rules/DowngradePhp74/Rector/FuncCall/DowngradeArrayMergeCallWithoutArgumentsRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeStripTagsCallWithArrayRector' => $baseDir . '/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\Identical\\DowngradeFreadFwriteFalsyToNegationRector' => $baseDir . '/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\Interface_\\DowngradePreviouslyImplementedInterfaceRector' => $baseDir . '/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\LNumber\\DowngradeNumericLiteralSeparatorRector' => $baseDir . '/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\Property\\DowngradeTypedPropertyRector' => $baseDir . '/rules/DowngradePhp74/Rector/Property/DowngradeTypedPropertyRector.php',
|
||||
'Rector\\DowngradePhp80\\NodeAnalyzer\\NamedToUnnamedArgs' => $baseDir . '/rules/DowngradePhp80/NodeAnalyzer/NamedToUnnamedArgs.php',
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6
|
||||
class ComposerAutoloaderInitde09d5a98aba4e33ea7edf20bc357990
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitde09d5a98aba4e33ea7edf20bc357990', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitde09d5a98aba4e33ea7edf20bc357990', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitd4cb78f26bd1b7e1763b12f0c073efa6::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitde09d5a98aba4e33ea7edf20bc357990::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitd4cb78f26bd1b7e1763b12f0c073efa6::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitde09d5a98aba4e33ea7edf20bc357990::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequired4cb78f26bd1b7e1763b12f0c073efa6($fileIdentifier, $file);
|
||||
composerRequirede09d5a98aba4e33ea7edf20bc357990($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequired4cb78f26bd1b7e1763b12f0c073efa6($fileIdentifier, $file)
|
||||
function composerRequirede09d5a98aba4e33ea7edf20bc357990($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitd4cb78f26bd1b7e1763b12f0c073efa6
|
||||
class ComposerStaticInitde09d5a98aba4e33ea7edf20bc357990
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -2168,6 +2168,7 @@ class ComposerStaticInitd4cb78f26bd1b7e1763b12f0c073efa6
|
|||
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeArrayMergeCallWithoutArgumentsRector' => __DIR__ . '/../..' . '/rules/DowngradePhp74/Rector/FuncCall/DowngradeArrayMergeCallWithoutArgumentsRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeStripTagsCallWithArrayRector' => __DIR__ . '/../..' . '/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\Identical\\DowngradeFreadFwriteFalsyToNegationRector' => __DIR__ . '/../..' . '/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\Interface_\\DowngradePreviouslyImplementedInterfaceRector' => __DIR__ . '/../..' . '/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\LNumber\\DowngradeNumericLiteralSeparatorRector' => __DIR__ . '/../..' . '/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php',
|
||||
'Rector\\DowngradePhp74\\Rector\\Property\\DowngradeTypedPropertyRector' => __DIR__ . '/../..' . '/rules/DowngradePhp74/Rector/Property/DowngradeTypedPropertyRector.php',
|
||||
'Rector\\DowngradePhp80\\NodeAnalyzer\\NamedToUnnamedArgs' => __DIR__ . '/../..' . '/rules/DowngradePhp80/NodeAnalyzer/NamedToUnnamedArgs.php',
|
||||
|
@ -3522,9 +3523,9 @@ class ComposerStaticInitd4cb78f26bd1b7e1763b12f0c073efa6
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitd4cb78f26bd1b7e1763b12f0c073efa6::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitd4cb78f26bd1b7e1763b12f0c073efa6::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitd4cb78f26bd1b7e1763b12f0c073efa6::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitde09d5a98aba4e33ea7edf20bc357990::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitde09d5a98aba4e33ea7edf20bc357990::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitde09d5a98aba4e33ea7edf20bc357990::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
|
@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
|
|||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||
spl_autoload_call('RectorPrefix20211105\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6', false) && !interface_exists('ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6', false) && !trait_exists('ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6', false)) {
|
||||
spl_autoload_call('RectorPrefix20211105\ComposerAutoloaderInitd4cb78f26bd1b7e1763b12f0c073efa6');
|
||||
if (!class_exists('ComposerAutoloaderInitde09d5a98aba4e33ea7edf20bc357990', false) && !interface_exists('ComposerAutoloaderInitde09d5a98aba4e33ea7edf20bc357990', false) && !trait_exists('ComposerAutoloaderInitde09d5a98aba4e33ea7edf20bc357990', false)) {
|
||||
spl_autoload_call('RectorPrefix20211105\ComposerAutoloaderInitde09d5a98aba4e33ea7edf20bc357990');
|
||||
}
|
||||
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
|
||||
spl_autoload_call('RectorPrefix20211105\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
|
@ -3306,9 +3306,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20211105\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequired4cb78f26bd1b7e1763b12f0c073efa6')) {
|
||||
function composerRequired4cb78f26bd1b7e1763b12f0c073efa6() {
|
||||
return \RectorPrefix20211105\composerRequired4cb78f26bd1b7e1763b12f0c073efa6(...func_get_args());
|
||||
if (!function_exists('composerRequirede09d5a98aba4e33ea7edf20bc357990')) {
|
||||
function composerRequirede09d5a98aba4e33ea7edf20bc357990() {
|
||||
return \RectorPrefix20211105\composerRequirede09d5a98aba4e33ea7edf20bc357990(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
|
@ -17,6 +17,6 @@ use RectorPrefix20211105\Psr\Container\ContainerExceptionInterface;
|
|||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Bulat Shakirzyanov <bulat@theopenskyproject.com>
|
||||
*/
|
||||
interface ExceptionInterface extends \RectorPrefix20211105\Psr\Container\ContainerExceptionInterface, \Throwable
|
||||
interface ExceptionInterface extends \RectorPrefix20211105\Psr\Container\ContainerExceptionInterface
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user