mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 05:48:21 +01:00
Updated Rector to commit 710e77b2b802a8fdf3ff229775281057dde8e07e
710e77b2b8
[Scoped] Using php-parallel-lint 1.3.1 (#1854)
This commit is contained in:
parent
cc86b38d98
commit
636e1a8227
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'aa1fb8fdef02d9aba7e426f32227559c6a19e1ca';
|
||||
public const PACKAGE_VERSION = '710e77b2b802a8fdf3ff229775281057dde8e07e';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-02-21 12:13:59';
|
||||
public const RELEASE_DATE = '2022-02-21 14:52:56';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20220221\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 ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973::getLoader();
|
||||
return ComposerAutoloaderInit8f0c8ac76d05c220d672e99e494dfd10::getLoader();
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -2494,6 +2494,7 @@ return array(
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\AddDoesNotPerformAssertionToNonAssertingTestRector' => $vendorDir . '/rector/rector-phpunit/src/Rector/ClassMethod/AddDoesNotPerformAssertionToNonAssertingTestRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\ExceptionAnnotationRector' => $vendorDir . '/rector/rector-phpunit/src/Rector/ClassMethod/ExceptionAnnotationRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\RemoveEmptyTestMethodRector' => $vendorDir . '/rector/rector-phpunit/src/Rector/ClassMethod/RemoveEmptyTestMethodRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\ReplaceTestAnnotationWithPrefixedFunctionRector' => $vendorDir . '/rector/rector-phpunit/src/Rector/ClassMethod/ReplaceTestAnnotationWithPrefixedFunctionRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\TryCatchToExpectExceptionRector' => $vendorDir . '/rector/rector-phpunit/src/Rector/ClassMethod/TryCatchToExpectExceptionRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\Class_\\AddProphecyTraitRector' => $vendorDir . '/rector/rector-phpunit/src/Rector/Class_/AddProphecyTraitRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\Class_\\AddSeeTestAnnotationRector' => $vendorDir . '/rector/rector-phpunit/src/Rector/Class_/AddSeeTestAnnotationRector.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 ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973
|
||||
class ComposerAutoloaderInit8f0c8ac76d05c220d672e99e494dfd10
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit8f0c8ac76d05c220d672e99e494dfd10', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit8f0c8ac76d05c220d672e99e494dfd10', '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\ComposerStaticInitc5acab459690c772aad3f151ec2bc973::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit8f0c8ac76d05c220d672e99e494dfd10::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,12 +42,12 @@ class ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitc5acab459690c772aad3f151ec2bc973::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit8f0c8ac76d05c220d672e99e494dfd10::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequirec5acab459690c772aad3f151ec2bc973($fileIdentifier, $file);
|
||||
composerRequire8f0c8ac76d05c220d672e99e494dfd10($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -59,7 +59,7 @@ class ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequirec5acab459690c772aad3f151ec2bc973($fileIdentifier, $file)
|
||||
function composerRequire8f0c8ac76d05c220d672e99e494dfd10($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitc5acab459690c772aad3f151ec2bc973
|
||||
class ComposerStaticInit8f0c8ac76d05c220d672e99e494dfd10
|
||||
{
|
||||
public static $files = array (
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
@ -2868,6 +2868,7 @@ class ComposerStaticInitc5acab459690c772aad3f151ec2bc973
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\AddDoesNotPerformAssertionToNonAssertingTestRector' => __DIR__ . '/..' . '/rector/rector-phpunit/src/Rector/ClassMethod/AddDoesNotPerformAssertionToNonAssertingTestRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\ExceptionAnnotationRector' => __DIR__ . '/..' . '/rector/rector-phpunit/src/Rector/ClassMethod/ExceptionAnnotationRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\RemoveEmptyTestMethodRector' => __DIR__ . '/..' . '/rector/rector-phpunit/src/Rector/ClassMethod/RemoveEmptyTestMethodRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\ReplaceTestAnnotationWithPrefixedFunctionRector' => __DIR__ . '/..' . '/rector/rector-phpunit/src/Rector/ClassMethod/ReplaceTestAnnotationWithPrefixedFunctionRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\ClassMethod\\TryCatchToExpectExceptionRector' => __DIR__ . '/..' . '/rector/rector-phpunit/src/Rector/ClassMethod/TryCatchToExpectExceptionRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\Class_\\AddProphecyTraitRector' => __DIR__ . '/..' . '/rector/rector-phpunit/src/Rector/Class_/AddProphecyTraitRector.php',
|
||||
'Rector\\PHPUnit\\Rector\\Class_\\AddSeeTestAnnotationRector' => __DIR__ . '/..' . '/rector/rector-phpunit/src/Rector/Class_/AddSeeTestAnnotationRector.php',
|
||||
@ -3847,9 +3848,9 @@ class ComposerStaticInitc5acab459690c772aad3f151ec2bc973
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitc5acab459690c772aad3f151ec2bc973::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitc5acab459690c772aad3f151ec2bc973::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitc5acab459690c772aad3f151ec2bc973::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit8f0c8ac76d05c220d672e99e494dfd10::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit8f0c8ac76d05c220d672e99e494dfd10::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit8f0c8ac76d05c220d672e99e494dfd10::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
16
vendor/composer/installed.json
vendored
16
vendor/composer/installed.json
vendored
@ -2272,12 +2272,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "fcfd6c7b38b78dd15ceaea028717788503e0a6c4"
|
||||
"reference": "5574f411aa5de783634ecdd6eab1a72824b5ce4f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/fcfd6c7b38b78dd15ceaea028717788503e0a6c4",
|
||||
"reference": "fcfd6c7b38b78dd15ceaea028717788503e0a6c4",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/5574f411aa5de783634ecdd6eab1a72824b5ce4f",
|
||||
"reference": "5574f411aa5de783634ecdd6eab1a72824b5ce4f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2302,7 +2302,7 @@
|
||||
"symplify\/rule-doc-generator": "^10.0",
|
||||
"symplify\/vendor-patches": "^10.0"
|
||||
},
|
||||
"time": "2022-02-15T20:27:59+00:00",
|
||||
"time": "2022-02-21T14:29:13+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
@ -2628,12 +2628,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "49d312b31dd2eadb8f9bb89a972060b62e1dd063"
|
||||
"reference": "8d5363d0797b19956df60877c4f7cfa15aa5179a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/49d312b31dd2eadb8f9bb89a972060b62e1dd063",
|
||||
"reference": "49d312b31dd2eadb8f9bb89a972060b62e1dd063",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/8d5363d0797b19956df60877c4f7cfa15aa5179a",
|
||||
"reference": "8d5363d0797b19956df60877c4f7cfa15aa5179a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2657,7 +2657,7 @@
|
||||
"symplify\/rule-doc-generator": "^10.0",
|
||||
"symplify\/vendor-patches": "^10.0"
|
||||
},
|
||||
"time": "2022-02-02T20:36:05+00:00",
|
||||
"time": "2022-02-21T12:15:20+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
||||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d1fa93d'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fcfd6c7'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main df58e86'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 6bee428'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fbfa93c'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f23c4bf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 49d312b'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 8aa9a6b'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 85a72f9'));
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d1fa93d'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5574f41'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main df58e86'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 6bee428'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main fbfa93c'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f23c4bf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 8d5363d'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 8aa9a6b'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 85a72f9'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('Doctrine\\DBAL\\Statement', 'fetchColumn', 'fetchOne'),
|
||||
new \Rector\Renaming\ValueObject\MethodCallRename('Doctrine\\DBAL\\Statement', 'fetchAll', 'fetchAllAssociative'),
|
||||
]);
|
||||
$services->set(\Rector\Renaming\Rector\Name\RenameClassRector::class)->configure([\Rector\Renaming\Rector\Name\RenameClassRector::OLD_TO_NEW_CLASSES => [
|
||||
$services->set(\Rector\Renaming\Rector\Name\RenameClassRector::class)->configure([
|
||||
// https://github.com/doctrine/dbal/blob/master/UPGRADE.md#pdo-related-classes-outside-of-the-pdo-namespace-are-deprecated
|
||||
'Doctrine\\DBAL\\Driver\\PDOMySql\\Driver' => 'Doctrine\\DBAL\\Driver\\PDO\\MySQL\\Driver',
|
||||
'Doctrine\\DBAL\\Driver\\PDOOracle\\Driver' => 'Doctrine\\DBAL\\Driver\\PDO\\OCI\\Driver',
|
||||
@ -58,5 +58,5 @@ return static function (\Symfony\Component\DependencyInjection\Loader\Configurat
|
||||
'Doctrine\\DBAL\\Driver\\PDOStatement' => 'Doctrine\\DBAL\\Driver\\PDO\\Statement',
|
||||
// https://github.com/doctrine/dbal/blob/master/UPGRADE.md#deprecated-masterslaveconnection-use-primaryreadreplicaconnection
|
||||
'Doctrine\\DBAL\\Connections\\MasterSlaveConnection' => 'Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection',
|
||||
]]);
|
||||
]);
|
||||
};
|
||||
|
@ -11,9 +11,9 @@ use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode;
|
||||
use Rector\Core\NodeManipulator\ClassInsertManipulator;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use RectorPrefix20220221\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix20220221\Symplify\SimplePhpDocParser\PhpDocNodeTraverser;
|
||||
/**
|
||||
* @see https://github.com/Atlantic18/DoctrineExtensions/blob/v2.4.x/doc/loggable.md
|
||||
* @see https://github.com/KnpLabs/DoctrineBehaviors/blob/4e0677379dd4adf84178f662d08454a9627781a8/docs/loggable.md
|
||||
@ -95,7 +95,7 @@ CODE_SAMPLE
|
||||
// change the node
|
||||
$classPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($class);
|
||||
$hasLoggableAnnotation = \false;
|
||||
$phpDocNodeTraverser = new \RectorPrefix20220221\Symplify\SimplePhpDocParser\PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser = new \RectorPrefix20220221\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser->traverseWithCallable($classPhpDocInfo->getPhpDocNode(), '', function ($node) use(&$hasLoggableAnnotation) {
|
||||
if (!$node instanceof \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode) {
|
||||
return null;
|
||||
@ -108,7 +108,7 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
$hasLoggableAnnotation = \true;
|
||||
return \RectorPrefix20220221\Symplify\SimplePhpDocParser\PhpDocNodeTraverser::NODE_REMOVE;
|
||||
return \RectorPrefix20220221\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser::NODE_REMOVE;
|
||||
});
|
||||
if (!$hasLoggableAnnotation) {
|
||||
return null;
|
||||
@ -124,7 +124,7 @@ CODE_SAMPLE
|
||||
// remove tag from properties
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
$hasChanged = \false;
|
||||
$phpDocNodeTraverser = new \RectorPrefix20220221\Symplify\SimplePhpDocParser\PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser = new \RectorPrefix20220221\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser();
|
||||
$phpDocNodeTraverser->traverseWithCallable($phpDocInfo->getPhpDocNode(), '', function ($node) use($phpDocInfo, &$hasChanged) {
|
||||
if (!$node instanceof \Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode) {
|
||||
return null;
|
||||
@ -137,7 +137,7 @@ CODE_SAMPLE
|
||||
}
|
||||
$phpDocInfo->markAsChanged();
|
||||
$hasChanged = \true;
|
||||
return \RectorPrefix20220221\Symplify\SimplePhpDocParser\PhpDocNodeTraverser::NODE_REMOVE;
|
||||
return \RectorPrefix20220221\Symplify\Astral\PhpDocParser\PhpDocNodeTraverser::NODE_REMOVE;
|
||||
});
|
||||
if (!$hasChanged) {
|
||||
return null;
|
||||
|
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\PHPUnit\Rector\ClassMethod;
|
||||
|
||||
use PhpParser\Comment\Doc;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\PHPUnit\Tests\Rector\ClassMethod\ReplaceTestAnnotationWithPrefixedFunctionRector\ReplaceTestAnnotationWithPrefixedFunctionRectorTest
|
||||
*/
|
||||
final class ReplaceTestAnnotationWithPrefixedFunctionRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer
|
||||
*/
|
||||
private $testsNodeAnalyzer;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover
|
||||
*/
|
||||
private $phpDocTagRemover;
|
||||
public function __construct(\Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer $testsNodeAnalyzer, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover $phpDocTagRemover)
|
||||
{
|
||||
$this->testsNodeAnalyzer = $testsNodeAnalyzer;
|
||||
$this->phpDocTagRemover = $phpDocTagRemover;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Replace @test with prefixed function', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function onePlusOneShouldBeTwo()
|
||||
{
|
||||
$this->assertSame(2, 1+1);
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
class SomeTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testOnePlusOneShouldBeTwo()
|
||||
{
|
||||
$this->assertSame(2, 1+1);
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Stmt\ClassMethod::class];
|
||||
}
|
||||
/**
|
||||
* @param ClassMethod $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
if (!$this->testsNodeAnalyzer->isInTestClass($node)) {
|
||||
return null;
|
||||
}
|
||||
if ($this->isName($node->name, 'test*')) {
|
||||
return null;
|
||||
}
|
||||
$docComment = $node->getDocComment();
|
||||
if (!$docComment instanceof \PhpParser\Comment\Doc) {
|
||||
return null;
|
||||
}
|
||||
if (\strpos($docComment->getText(), '@test') === \false) {
|
||||
return null;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
$this->phpDocTagRemover->removeByName($phpDocInfo, 'test');
|
||||
$node->name->name = 'test' . \ucfirst($node->name->name);
|
||||
return $node;
|
||||
}
|
||||
}
|
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('RectorPrefix20220221\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973', false) && !interface_exists('ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973', false) && !trait_exists('ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973', false)) {
|
||||
spl_autoload_call('RectorPrefix20220221\ComposerAutoloaderInitc5acab459690c772aad3f151ec2bc973');
|
||||
if (!class_exists('ComposerAutoloaderInit8f0c8ac76d05c220d672e99e494dfd10', false) && !interface_exists('ComposerAutoloaderInit8f0c8ac76d05c220d672e99e494dfd10', false) && !trait_exists('ComposerAutoloaderInit8f0c8ac76d05c220d672e99e494dfd10', false)) {
|
||||
spl_autoload_call('RectorPrefix20220221\ComposerAutoloaderInit8f0c8ac76d05c220d672e99e494dfd10');
|
||||
}
|
||||
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('RectorPrefix20220221\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20220221\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequirec5acab459690c772aad3f151ec2bc973')) {
|
||||
function composerRequirec5acab459690c772aad3f151ec2bc973() {
|
||||
return \RectorPrefix20220221\composerRequirec5acab459690c772aad3f151ec2bc973(...func_get_args());
|
||||
if (!function_exists('composerRequire8f0c8ac76d05c220d672e99e494dfd10')) {
|
||||
function composerRequire8f0c8ac76d05c220d672e99e494dfd10() {
|
||||
return \RectorPrefix20220221\composerRequire8f0c8ac76d05c220d672e99e494dfd10(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user