mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-18 06:22:08 +02:00
Updated Rector to commit 596bbc98a25903c525914b4d16ea5f9c76b500fb
596bbc98a2
[tests] Replace wildcard e2e test with unit one (#5000)
This commit is contained in:
parent
9a39b26232
commit
35a66f9d23
@ -10,6 +10,7 @@ final class CurlyListNode extends \Rector\BetterPhpDocParser\ValueObject\PhpDoc\
|
||||
{
|
||||
/**
|
||||
* @var ArrayItemNode[]
|
||||
* @readonly
|
||||
*/
|
||||
private $arrayItemNodes = [];
|
||||
/**
|
||||
|
@ -33,14 +33,14 @@ final class NodeNameResolver
|
||||
* @readonly
|
||||
*/
|
||||
private $nodeNameResolvers = [];
|
||||
/**
|
||||
* @var array<string, NodeNameResolverInterface|null>
|
||||
*/
|
||||
private $nodeNameResolversByClass = [];
|
||||
/**
|
||||
* Used to check if a string might contain a regex or fnmatch pattern
|
||||
*/
|
||||
private const REGEX_WILDCARD_CHARS = ['*', '#', '~', '/'];
|
||||
/**
|
||||
* @var array<string, NodeNameResolverInterface|null>
|
||||
*/
|
||||
private $nodeNameResolversByClass = [];
|
||||
/**
|
||||
* @param NodeNameResolverInterface[] $nodeNameResolvers
|
||||
*/
|
||||
|
@ -3,14 +3,14 @@
|
||||
declare (strict_types=1);
|
||||
namespace Rector\CodingStyle\ClassNameImport;
|
||||
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\GroupUse;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
use PhpParser\Node\Stmt\UseUse;
|
||||
use PhpParser\NodeTraverser;
|
||||
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
final class UseImportsTraverser
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '9e7367ca9296ca986a31abd8bb7d6b3a6b5ef0d8';
|
||||
public const PACKAGE_VERSION = '596bbc98a25903c525914b4d16ea5f9c76b500fb';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-09-11 23:04:21';
|
||||
public const RELEASE_DATE = '2023-09-11 20:30:55';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -8,6 +8,9 @@ use Rector\Core\Configuration\Parameter\SimpleParameterProvider;
|
||||
use Rector\Core\ValueObject\Configuration;
|
||||
use RectorPrefix202309\Symfony\Component\Console\Input\InputInterface;
|
||||
use RectorPrefix202309\Symfony\Component\Console\Style\SymfonyStyle;
|
||||
/**
|
||||
* @see \Rector\Core\Tests\Configuration\ConfigurationFactoryTest
|
||||
*/
|
||||
final class ConfigurationFactory
|
||||
{
|
||||
/**
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitd1b6e5c4ca274f91a852d0f5afa91038::getLoader();
|
||||
return ComposerAutoloaderInitc2db957c3ce342c948d5b630218dd433::getLoader();
|
||||
|
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
@ -1360,7 +1360,6 @@ return array(
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\InitializeDefaultEntityCollectionRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/InitializeDefaultEntityCollectionRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\MoveCurrentDateTimeDefaultInEntityToConstructorRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\RemoveEmptyTableAttributeRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/RemoveEmptyTableAttributeRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\ChangeBigIntEntityPropertyToIntTypeRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ChangeBigIntEntityPropertyToIntTypeRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\CorrectDefaultTypesOnEntityPropertyRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/CorrectDefaultTypesOnEntityPropertyRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\ImproveDoctrineCollectionDocTypeInEntityRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\MakeEntityDateTimePropertyDateTimeInterfaceRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/MakeEntityDateTimePropertyDateTimeInterfaceRector.php',
|
||||
@ -1381,7 +1380,6 @@ return array(
|
||||
'Rector\\Doctrine\\NodeManipulator\\ColumnPropertyTypeResolver' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/ColumnPropertyTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\ConstructorManipulator' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/ConstructorManipulator.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\NullabilityColumnPropertyTypeResolver' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/NullabilityColumnPropertyTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\PropertyTypeManipulator' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/PropertyTypeManipulator.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\ToManyRelationPropertyTypeResolver' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\ToOneRelationPropertyTypeResolver' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/ToOneRelationPropertyTypeResolver.php',
|
||||
'Rector\\Doctrine\\Orm214\\Rector\\Param\\ReplaceLifecycleEventArgsByDedicatedEventArgsRector' => $vendorDir . '/rector/rector-doctrine/rules/Orm214/Rector/Param/ReplaceLifecycleEventArgsByDedicatedEventArgsRector.php',
|
||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitd1b6e5c4ca274f91a852d0f5afa91038
|
||||
class ComposerAutoloaderInitc2db957c3ce342c948d5b630218dd433
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInitd1b6e5c4ca274f91a852d0f5afa91038
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitd1b6e5c4ca274f91a852d0f5afa91038', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitc2db957c3ce342c948d5b630218dd433', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitd1b6e5c4ca274f91a852d0f5afa91038', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitc2db957c3ce342c948d5b630218dd433', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitd1b6e5c4ca274f91a852d0f5afa91038::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitc2db957c3ce342c948d5b630218dd433::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitd1b6e5c4ca274f91a852d0f5afa91038::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitc2db957c3ce342c948d5b630218dd433::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
10
vendor/composer/autoload_static.php
vendored
10
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitd1b6e5c4ca274f91a852d0f5afa91038
|
||||
class ComposerStaticInitc2db957c3ce342c948d5b630218dd433
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -1580,7 +1580,6 @@ class ComposerStaticInitd1b6e5c4ca274f91a852d0f5afa91038
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\InitializeDefaultEntityCollectionRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/InitializeDefaultEntityCollectionRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\MoveCurrentDateTimeDefaultInEntityToConstructorRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\RemoveEmptyTableAttributeRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/RemoveEmptyTableAttributeRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\ChangeBigIntEntityPropertyToIntTypeRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ChangeBigIntEntityPropertyToIntTypeRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\CorrectDefaultTypesOnEntityPropertyRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/CorrectDefaultTypesOnEntityPropertyRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\ImproveDoctrineCollectionDocTypeInEntityRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\MakeEntityDateTimePropertyDateTimeInterfaceRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/MakeEntityDateTimePropertyDateTimeInterfaceRector.php',
|
||||
@ -1601,7 +1600,6 @@ class ComposerStaticInitd1b6e5c4ca274f91a852d0f5afa91038
|
||||
'Rector\\Doctrine\\NodeManipulator\\ColumnPropertyTypeResolver' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/ColumnPropertyTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\ConstructorManipulator' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/ConstructorManipulator.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\NullabilityColumnPropertyTypeResolver' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/NullabilityColumnPropertyTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\PropertyTypeManipulator' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/PropertyTypeManipulator.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\ToManyRelationPropertyTypeResolver' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/ToManyRelationPropertyTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\ToOneRelationPropertyTypeResolver' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/ToOneRelationPropertyTypeResolver.php',
|
||||
'Rector\\Doctrine\\Orm214\\Rector\\Param\\ReplaceLifecycleEventArgsByDedicatedEventArgsRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/Orm214/Rector/Param/ReplaceLifecycleEventArgsByDedicatedEventArgsRector.php',
|
||||
@ -2595,9 +2593,9 @@ class ComposerStaticInitd1b6e5c4ca274f91a852d0f5afa91038
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitd1b6e5c4ca274f91a852d0f5afa91038::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitd1b6e5c4ca274f91a852d0f5afa91038::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitd1b6e5c4ca274f91a852d0f5afa91038::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitc2db957c3ce342c948d5b630218dd433::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitc2db957c3ce342c948d5b630218dd433::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitc2db957c3ce342c948d5b630218dd433::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
36
vendor/composer/installed.json
vendored
36
vendor/composer/installed.json
vendored
@ -1744,12 +1744,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "3ce87fb0df0701fdf3210001ccf2a6cc4d732da4"
|
||||
"reference": "c8420dcc698c05de5f85fc7d21bd05b66ceb60dc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/3ce87fb0df0701fdf3210001ccf2a6cc4d732da4",
|
||||
"reference": "3ce87fb0df0701fdf3210001ccf2a6cc4d732da4",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/c8420dcc698c05de5f85fc7d21bd05b66ceb60dc",
|
||||
"reference": "c8420dcc698c05de5f85fc7d21bd05b66ceb60dc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1774,7 +1774,7 @@
|
||||
"tomasvotruba\/type-coverage": "^0.2",
|
||||
"tomasvotruba\/unused-public": "^0.3"
|
||||
},
|
||||
"time": "2023-09-11T14:45:06+00:00",
|
||||
"time": "2023-09-11T18:26:33+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
@ -1807,12 +1807,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
|
||||
"reference": "8953c00043f49d5b50cbb2c08456dfff6034fb60"
|
||||
"reference": "86f57eee49e0beae650cbef6ff70841849cca6a0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/8953c00043f49d5b50cbb2c08456dfff6034fb60",
|
||||
"reference": "8953c00043f49d5b50cbb2c08456dfff6034fb60",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/86f57eee49e0beae650cbef6ff70841849cca6a0",
|
||||
"reference": "86f57eee49e0beae650cbef6ff70841849cca6a0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1826,7 +1826,7 @@
|
||||
"phpunit\/phpunit": "^10.3",
|
||||
"rector\/phpstan-rules": "^0.7",
|
||||
"rector\/rector-generator": "^0.7.3",
|
||||
"rector\/rector-src": "dev-main",
|
||||
"rector\/rector-src": "dev-tv-narrow-abstract-10",
|
||||
"symplify\/easy-ci": "^11.2",
|
||||
"symplify\/easy-coding-standard": "^12.0",
|
||||
"symplify\/phpstan-extensions": "^11.3",
|
||||
@ -1839,7 +1839,7 @@
|
||||
"tomasvotruba\/unused-public": "^0.2",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2023-09-11T14:50:46+00:00",
|
||||
"time": "2023-09-11T17:45:57+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
@ -1872,12 +1872,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "2ccca33c46032bd54aabc645d4d30e3794032683"
|
||||
"reference": "d4ca7d7e4d5d6d9d61d8aa1695010a6a6df50f47"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/2ccca33c46032bd54aabc645d4d30e3794032683",
|
||||
"reference": "2ccca33c46032bd54aabc645d4d30e3794032683",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/d4ca7d7e4d5d6d9d61d8aa1695010a6a6df50f47",
|
||||
"reference": "d4ca7d7e4d5d6d9d61d8aa1695010a6a6df50f47",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1907,7 +1907,7 @@
|
||||
"tomasvotruba\/unused-public": "^0.3",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2023-09-11T14:32:50+00:00",
|
||||
"time": "2023-09-11T17:34:46+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
@ -1943,12 +1943,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "ce640aa8d61ec8c266e47a4e5708c78949af5ac7"
|
||||
"reference": "6ef9eb731559a91c170f27c6432a0b76176f5655"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/ce640aa8d61ec8c266e47a4e5708c78949af5ac7",
|
||||
"reference": "ce640aa8d61ec8c266e47a4e5708c78949af5ac7",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/6ef9eb731559a91c170f27c6432a0b76176f5655",
|
||||
"reference": "6ef9eb731559a91c170f27c6432a0b76176f5655",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1962,7 +1962,7 @@
|
||||
"phpunit\/phpunit": "^10.3",
|
||||
"rector\/phpstan-rules": "^0.6",
|
||||
"rector\/rector-generator": "^0.7",
|
||||
"rector\/rector-src": "dev-main",
|
||||
"rector\/rector-src": "dev-tv-narrow-abstract-10",
|
||||
"symfony\/config": "^6.3",
|
||||
"symfony\/dependency-injection": "^6.3",
|
||||
"symfony\/routing": "^6.2",
|
||||
@ -1981,7 +1981,7 @@
|
||||
"tomasvotruba\/unused-public": "^0.2",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2023-09-11T14:37:30+00:00",
|
||||
"time": "2023-09-11T17:29:57+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-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 3ce87fb'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 8953c00'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 2ccca33'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main ce640aa'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main c8420dc'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 86f57ee'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main d4ca7d7'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 6ef9eb7'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ use Rector\Doctrine\CodeQuality\Rector\Class_\InitializeDefaultEntityCollectionR
|
||||
use Rector\Doctrine\CodeQuality\Rector\Class_\MoveCurrentDateTimeDefaultInEntityToConstructorRector;
|
||||
use Rector\Doctrine\CodeQuality\Rector\Class_\RemoveEmptyTableAttributeRector;
|
||||
use Rector\Doctrine\CodeQuality\Rector\ClassMethod\MakeEntitySetterNullabilityInSyncWithPropertyRector;
|
||||
use Rector\Doctrine\CodeQuality\Rector\Property\ChangeBigIntEntityPropertyToIntTypeRector;
|
||||
use Rector\Doctrine\CodeQuality\Rector\Property\CorrectDefaultTypesOnEntityPropertyRector;
|
||||
use Rector\Doctrine\CodeQuality\Rector\Property\ImproveDoctrineCollectionDocTypeInEntityRector;
|
||||
use Rector\Doctrine\CodeQuality\Rector\Property\MakeEntityDateTimePropertyDateTimeInterfaceRector;
|
||||
@ -26,7 +25,6 @@ return static function (RectorConfig $rectorConfig) : void {
|
||||
MakeEntityDateTimePropertyDateTimeInterfaceRector::class,
|
||||
MoveCurrentDateTimeDefaultInEntityToConstructorRector::class,
|
||||
CorrectDefaultTypesOnEntityPropertyRector::class,
|
||||
ChangeBigIntEntityPropertyToIntTypeRector::class,
|
||||
ImproveDoctrineCollectionDocTypeInEntityRector::class,
|
||||
RemoveEmptyTableAttributeRector::class,
|
||||
// typed properties in entities from annotations/attributes
|
||||
|
@ -1,29 +1,4 @@
|
||||
# 15 Rules Overview
|
||||
|
||||
## ChangeBigIntEntityPropertyToIntTypeRector
|
||||
|
||||
Change database type "bigint" for @var/type declaration to string
|
||||
|
||||
- class: [`Rector\Doctrine\CodeQuality\Rector\Property\ChangeBigIntEntityPropertyToIntTypeRector`](../rules/CodeQuality/Rector/Property/ChangeBigIntEntityPropertyToIntTypeRector.php)
|
||||
|
||||
```diff
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class SomeEntity
|
||||
{
|
||||
/**
|
||||
- * @var int|null
|
||||
+ * @var string|null
|
||||
* @ORM\Column(type="bigint", nullable=true)
|
||||
*/
|
||||
private $bigNumber;
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
# 14 Rules Overview
|
||||
|
||||
## ChangeCompositeExpressionAddMultipleWithWithRector
|
||||
|
||||
|
@ -1,107 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\Rector\Property;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use PHPStan\Type\BooleanType;
|
||||
use PHPStan\Type\FloatType;
|
||||
use PHPStan\Type\IntegerType;
|
||||
use PHPStan\Type\StringType;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockClassRenamer;
|
||||
use Rector\NodeTypeResolver\ValueObject\OldToNewType;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://www.doctrine-project.org/projects/doctrine-dbal/en/2.10/reference/types.html#bigint
|
||||
*
|
||||
* @see \Rector\Doctrine\Tests\CodeQuality\Rector\Property\ChangeBigIntEntityPropertyToIntTypeRector\ChangeBigIntEntityPropertyToIntTypeRectorTest
|
||||
*/
|
||||
final class ChangeBigIntEntityPropertyToIntTypeRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockClassRenamer
|
||||
*/
|
||||
private $docBlockClassRenamer;
|
||||
public function __construct(DocBlockClassRenamer $docBlockClassRenamer)
|
||||
{
|
||||
$this->docBlockClassRenamer = $docBlockClassRenamer;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Change database type "bigint" for @var/type declaration to string', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class SomeEntity
|
||||
{
|
||||
/**
|
||||
* @var int|null
|
||||
* @ORM\Column(type="bigint", nullable=true)
|
||||
*/
|
||||
private $bigNumber;
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class SomeEntity
|
||||
{
|
||||
/**
|
||||
* @var string|null
|
||||
* @ORM\Column(type="bigint", nullable=true)
|
||||
*/
|
||||
private $bigNumber;
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [Property::class];
|
||||
}
|
||||
/**
|
||||
* @param Property $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Doctrine\\ORM\\Mapping\\Column');
|
||||
if (!$doctrineAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
return null;
|
||||
}
|
||||
$typeArrayItemNode = $doctrineAnnotationTagValueNode->getValue('type');
|
||||
if (!$typeArrayItemNode instanceof ArrayItemNode) {
|
||||
return null;
|
||||
}
|
||||
$typeValue = $typeArrayItemNode->value;
|
||||
if ($typeValue instanceof StringNode) {
|
||||
$typeValue = $typeValue->value;
|
||||
}
|
||||
if ($typeValue !== 'bigint') {
|
||||
return null;
|
||||
}
|
||||
$varTagValueNode = $phpDocInfo->getVarTagValueNode();
|
||||
if (!$varTagValueNode instanceof VarTagValueNode) {
|
||||
return null;
|
||||
}
|
||||
$oldToNewTypes = [new OldToNewType(new IntegerType(), new StringType()), new OldToNewType(new FloatType(), new StringType()), new OldToNewType(new BooleanType(), new StringType())];
|
||||
$this->docBlockClassRenamer->renamePhpDocType($phpDocInfo, $oldToNewTypes);
|
||||
return $node;
|
||||
}
|
||||
}
|
@ -9,8 +9,11 @@ use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\TypeCombinator;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Doctrine\NodeManipulator\PropertyTypeManipulator;
|
||||
use Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockClassRenamer;
|
||||
use Rector\NodeTypeResolver\ValueObject\OldToNewType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
@ -22,12 +25,18 @@ final class MakeEntityDateTimePropertyDateTimeInterfaceRector extends AbstractRe
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\NodeManipulator\PropertyTypeManipulator
|
||||
* @var \Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockClassRenamer
|
||||
*/
|
||||
private $propertyTypeManipulator;
|
||||
public function __construct(PropertyTypeManipulator $propertyTypeManipulator)
|
||||
private $docBlockClassRenamer;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
public function __construct(DocBlockClassRenamer $docBlockClassRenamer, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->propertyTypeManipulator = $propertyTypeManipulator;
|
||||
$this->docBlockClassRenamer = $docBlockClassRenamer;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
@ -84,17 +93,27 @@ CODE_SAMPLE
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNode($node);
|
||||
if ($phpDocInfo instanceof PhpDocInfo) {
|
||||
$varType = $phpDocInfo->getVarType();
|
||||
if ($varType instanceof UnionType) {
|
||||
$varType = TypeCombinator::removeNull($varType);
|
||||
}
|
||||
if (!$varType->equals(new ObjectType('DateTime'))) {
|
||||
return null;
|
||||
}
|
||||
$this->propertyTypeManipulator->changePropertyType($node, 'DateTime', 'DateTimeInterface');
|
||||
return $node;
|
||||
if (!$phpDocInfo instanceof PhpDocInfo) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
$varType = $phpDocInfo->getVarType();
|
||||
if ($varType instanceof UnionType) {
|
||||
$varType = TypeCombinator::removeNull($varType);
|
||||
}
|
||||
if (!$varType->equals(new ObjectType('DateTime'))) {
|
||||
return null;
|
||||
}
|
||||
$this->changePropertyType($node, 'DateTime', 'DateTimeInterface');
|
||||
return $node;
|
||||
}
|
||||
private function changePropertyType(Property $property, string $oldClass, string $newClass) : void
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
$oldToNewTypes = [new OldToNewType(new FullyQualifiedObjectType($oldClass), new FullyQualifiedObjectType($newClass))];
|
||||
$hasChanged = $this->docBlockClassRenamer->renamePhpDocType($phpDocInfo, $oldToNewTypes);
|
||||
if (!$hasChanged) {
|
||||
return;
|
||||
}
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($property);
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\NodeManipulator;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockClassRenamer;
|
||||
use Rector\NodeTypeResolver\ValueObject\OldToNewType;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
final class PropertyTypeManipulator
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockClassRenamer
|
||||
*/
|
||||
private $docBlockClassRenamer;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
public function __construct(DocBlockClassRenamer $docBlockClassRenamer, PhpDocInfoFactory $phpDocInfoFactory)
|
||||
{
|
||||
$this->docBlockClassRenamer = $docBlockClassRenamer;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
}
|
||||
public function changePropertyType(Property $property, string $oldClass, string $newClass) : void
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
$oldToNewTypes = [new OldToNewType(new FullyQualifiedObjectType($oldClass), new FullyQualifiedObjectType($newClass))];
|
||||
$this->docBlockClassRenamer->renamePhpDocType($phpDocInfo, $oldToNewTypes);
|
||||
if ($phpDocInfo->hasChanged()) {
|
||||
// invoke phpdoc reprint
|
||||
$property->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
"phpunit\/phpunit": "^10.3",
|
||||
"rector\/phpstan-rules": "^0.7",
|
||||
"rector\/rector-generator": "^0.7.3",
|
||||
"rector\/rector-src": "dev-main",
|
||||
"rector\/rector-src": "dev-tv-narrow-abstract-10",
|
||||
"symplify\/easy-ci": "^11.2",
|
||||
"symplify\/easy-coding-standard": "^12.0",
|
||||
"symplify\/phpstan-extensions": "^11.3",
|
||||
|
@ -13,6 +13,7 @@ use PhpParser\Node\Stmt\Interface_;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\DowngradePhp80\ValueObject\DowngradeAttributeToAnnotation;
|
||||
@ -32,6 +33,11 @@ final class DowngradeAttributeToAnnotationRector extends AbstractRector implemen
|
||||
* @var \Rector\NodeFactory\DoctrineAnnotationFactory
|
||||
*/
|
||||
private $doctrineAnnotationFactory;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
@ -44,9 +50,10 @@ final class DowngradeAttributeToAnnotationRector extends AbstractRector implemen
|
||||
* @var bool
|
||||
*/
|
||||
private $isDowngraded = \false;
|
||||
public function __construct(DoctrineAnnotationFactory $doctrineAnnotationFactory)
|
||||
public function __construct(DoctrineAnnotationFactory $doctrineAnnotationFactory, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->doctrineAnnotationFactory = $doctrineAnnotationFactory;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
@ -108,10 +115,12 @@ CODE_SAMPLE
|
||||
$this->isDowngraded = \true;
|
||||
if (\strpos($attributeToAnnotation->getTag(), '\\') === \false) {
|
||||
$phpDocInfo->addPhpDocTagNode(new PhpDocTagNode('@' . $attributeToAnnotation->getTag(), new GenericTagValueNode('')));
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
|
||||
continue;
|
||||
}
|
||||
$doctrineAnnotation = $this->doctrineAnnotationFactory->createFromAttribute($attribute, $attributeToAnnotation->getTag());
|
||||
$phpDocInfo->addTagValueNode($doctrineAnnotation);
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
|
||||
}
|
||||
}
|
||||
// cleanup empty attr groups
|
||||
|
@ -18,6 +18,7 @@ use PHPStan\PhpDocParser\Ast\Type\NullableTypeNode;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\DowngradePhp80\NodeAnalyzer\EnumAnalyzer;
|
||||
use Rector\NodeFactory\ClassFromEnumFactory;
|
||||
@ -43,11 +44,17 @@ final class DowngradeEnumToConstantListClassRector extends AbstractRector
|
||||
* @var \Rector\DowngradePhp80\NodeAnalyzer\EnumAnalyzer
|
||||
*/
|
||||
private $enumAnalyzer;
|
||||
public function __construct(ClassFromEnumFactory $classFromEnumFactory, ReflectionProvider $reflectionProvider, EnumAnalyzer $enumAnalyzer)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
public function __construct(ClassFromEnumFactory $classFromEnumFactory, ReflectionProvider $reflectionProvider, EnumAnalyzer $enumAnalyzer, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->classFromEnumFactory = $classFromEnumFactory;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->enumAnalyzer = $enumAnalyzer;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
@ -86,7 +93,7 @@ CODE_SAMPLE
|
||||
return $this->classFromEnumFactory->createFromEnum($node);
|
||||
}
|
||||
$hasChanged = \false;
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
$classMethodPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
foreach ($node->params as $param) {
|
||||
if ($param->type instanceof Name) {
|
||||
$paramType = $param->type;
|
||||
@ -109,14 +116,14 @@ CODE_SAMPLE
|
||||
}
|
||||
$this->refactorParamType($classLikeReflection, $isNullable, $param);
|
||||
$hasChanged = \true;
|
||||
$this->decorateParamDocType($classLikeReflection, $param, $phpDocInfo, $isNullable);
|
||||
$this->decorateParamDocType($classLikeReflection, $param, $classMethodPhpDocInfo, $isNullable, $node);
|
||||
}
|
||||
if ($hasChanged) {
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private function decorateParamDocType(ClassReflection $classReflection, Param $param, PhpDocInfo $phpDocInfo, bool $isNullable) : void
|
||||
private function decorateParamDocType(ClassReflection $classReflection, Param $param, PhpDocInfo $phpDocInfo, bool $isNullable, ClassMethod $classMethod) : void
|
||||
{
|
||||
$constFetchNode = new ConstFetchNode('\\' . $classReflection->getName(), '*');
|
||||
$constTypeNode = new ConstTypeNode($constFetchNode);
|
||||
@ -124,6 +131,7 @@ CODE_SAMPLE
|
||||
$paramTypeNode = $isNullable ? new NullableTypeNode($constTypeNode) : $constTypeNode;
|
||||
$paramTagValueNode = new ParamTagValueNode($paramTypeNode, \false, $paramName, '');
|
||||
$phpDocInfo->addTagValueNode($paramTagValueNode);
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($classMethod);
|
||||
}
|
||||
private function refactorParamType(ClassReflection $classReflection, bool $isNullable, Param $param) : void
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Privatization\NodeManipulator\VisibilityManipulator;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
@ -24,13 +25,19 @@ final class DowngradeReadonlyPropertyRector extends AbstractRector
|
||||
* @var \Rector\Privatization\NodeManipulator\VisibilityManipulator
|
||||
*/
|
||||
private $visibilityManipulator;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const TAGNAME = 'readonly';
|
||||
public function __construct(VisibilityManipulator $visibilityManipulator)
|
||||
public function __construct(VisibilityManipulator $visibilityManipulator, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->visibilityManipulator = $visibilityManipulator;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
@ -89,5 +96,6 @@ CODE_SAMPLE
|
||||
return;
|
||||
}
|
||||
$phpDocInfo->addPhpDocTagNode(new PhpDocTagNode('@' . self::TAGNAME, new GenericTagValueNode('')));
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($property);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\PHPUnit\Naming\TestClassNameResolver;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
@ -35,15 +36,21 @@ final class AddSeeTestAnnotationRector extends AbstractRector
|
||||
* @var \Rector\PHPUnit\Naming\TestClassNameResolver
|
||||
*/
|
||||
private $testClassNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const SEE = 'see';
|
||||
public function __construct(ReflectionProvider $reflectionProvider, PhpDocTagRemover $phpDocTagRemover, TestClassNameResolver $testClassNameResolver)
|
||||
public function __construct(ReflectionProvider $reflectionProvider, PhpDocTagRemover $phpDocTagRemover, TestClassNameResolver $testClassNameResolver, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->phpDocTagRemover = $phpDocTagRemover;
|
||||
$this->testClassNameResolver = $testClassNameResolver;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
@ -105,6 +112,7 @@ CODE_SAMPLE
|
||||
}
|
||||
$phpDocTagNode = $this->createSeePhpDocTagNode($matchingTestClassName);
|
||||
$phpDocInfo->addPhpDocTagNode($phpDocTagNode);
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
|
||||
return $node;
|
||||
}
|
||||
private function shouldSkipClass(Class_ $class) : bool
|
||||
|
@ -7,6 +7,7 @@ use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
|
||||
use Rector\PHPUnit\NodeAnalyzer\AssertCallAnalyzer;
|
||||
@ -42,12 +43,18 @@ final class AddDoesNotPerformAssertionToNonAssertingTestRector extends AbstractR
|
||||
* @var \Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer
|
||||
*/
|
||||
private $phpAttributeAnalyzer;
|
||||
public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, AssertCallAnalyzer $assertCallAnalyzer, MockedVariableAnalyzer $mockedVariableAnalyzer, PhpAttributeAnalyzer $phpAttributeAnalyzer)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
public function __construct(TestsNodeAnalyzer $testsNodeAnalyzer, AssertCallAnalyzer $assertCallAnalyzer, MockedVariableAnalyzer $mockedVariableAnalyzer, PhpAttributeAnalyzer $phpAttributeAnalyzer, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->testsNodeAnalyzer = $testsNodeAnalyzer;
|
||||
$this->assertCallAnalyzer = $assertCallAnalyzer;
|
||||
$this->mockedVariableAnalyzer = $mockedVariableAnalyzer;
|
||||
$this->phpAttributeAnalyzer = $phpAttributeAnalyzer;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
@ -95,6 +102,7 @@ CODE_SAMPLE
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
$phpDocInfo->addPhpDocTagNode(new PhpDocTagNode('@doesNotPerformAssertions', new GenericTagValueNode('')));
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
|
||||
return $node;
|
||||
}
|
||||
private function shouldSkipClassMethod(ClassMethod $classMethod) : bool
|
||||
|
2
vendor/rector/rector-symfony/composer.json
vendored
2
vendor/rector/rector-symfony/composer.json
vendored
@ -14,7 +14,7 @@
|
||||
"phpunit\/phpunit": "^10.3",
|
||||
"rector\/phpstan-rules": "^0.6",
|
||||
"rector\/rector-generator": "^0.7",
|
||||
"rector\/rector-src": "dev-main",
|
||||
"rector\/rector-src": "dev-tv-narrow-abstract-10",
|
||||
"symfony\/config": "^6.3",
|
||||
"symfony\/dependency-injection": "^6.3",
|
||||
"symfony\/routing": "^6.2",
|
||||
|
@ -231,10 +231,7 @@ CODE_SAMPLE
|
||||
private function removeDoctrineAnnotationTagValueNode(ClassMethod $classMethod, DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode) : void
|
||||
{
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod);
|
||||
$hasChanged = $this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $doctrineAnnotationTagValueNode);
|
||||
if ($hasChanged === \false) {
|
||||
return;
|
||||
}
|
||||
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $doctrineAnnotationTagValueNode);
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($classMethod);
|
||||
}
|
||||
private function refactorStmtsAwareNode(StmtsAwareInterface $stmtsAware, DoctrineAnnotationTagValueNode $templateDoctrineAnnotationTagValueNode, bool $hasThisRenderOrReturnsResponse, ClassMethod $classMethod) : void
|
||||
|
@ -8,6 +8,7 @@ use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Symfony\NodeAnalyzer\Annotations\ClassAnnotationAssertResolver;
|
||||
@ -40,11 +41,17 @@ final class LoadValidatorMetadataToAnnotationRector extends AbstractRector
|
||||
* @var \Rector\Symfony\NodeAnalyzer\Annotations\ClassAnnotationAssertResolver
|
||||
*/
|
||||
private $classAnnotationAssertResolver;
|
||||
public function __construct(MethodCallAnnotationAssertResolver $methodCallAnnotationAssertResolver, PropertyAnnotationAssertResolver $propertyAnnotationAssertResolver, ClassAnnotationAssertResolver $classAnnotationAssertResolver)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
public function __construct(MethodCallAnnotationAssertResolver $methodCallAnnotationAssertResolver, PropertyAnnotationAssertResolver $propertyAnnotationAssertResolver, ClassAnnotationAssertResolver $classAnnotationAssertResolver, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->methodCallAnnotationAssertResolver = $methodCallAnnotationAssertResolver;
|
||||
$this->propertyAnnotationAssertResolver = $propertyAnnotationAssertResolver;
|
||||
$this->classAnnotationAssertResolver = $classAnnotationAssertResolver;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
@ -91,7 +98,10 @@ CODE_SAMPLE
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$loadValidatorMetadataClassMethod = $node->getMethod('loadValidatorMetadata');
|
||||
if (!$loadValidatorMetadataClassMethod instanceof ClassMethod || $loadValidatorMetadataClassMethod->stmts === null) {
|
||||
if (!$loadValidatorMetadataClassMethod instanceof ClassMethod) {
|
||||
return null;
|
||||
}
|
||||
if ($loadValidatorMetadataClassMethod->stmts === null) {
|
||||
return null;
|
||||
}
|
||||
foreach ($loadValidatorMetadataClassMethod->stmts as $key => $methodStmt) {
|
||||
@ -127,6 +137,7 @@ CODE_SAMPLE
|
||||
}
|
||||
$getterPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod);
|
||||
$getterPhpDocInfo->addTagValueNode($classMethodAndAnnotation->getDoctrineAnnotationTagValueNode());
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($classMethod);
|
||||
unset($loadValidatorMetadataClassMethod->stmts[$stmtKey]);
|
||||
}
|
||||
}
|
||||
@ -138,6 +149,7 @@ CODE_SAMPLE
|
||||
}
|
||||
$propertyPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
$propertyPhpDocInfo->addTagValueNode($propertyAndAnnotation->getDoctrineAnnotationTagValueNode());
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($property);
|
||||
unset($loadValidatorMetadataClassMethod->stmts[$stmtKey]);
|
||||
}
|
||||
private function refactorClassAnnotation(Class_ $class, DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode, ClassMethod $loadValidatorMetadataClassMethod, int $stmtKey) : void
|
||||
@ -145,5 +157,6 @@ CODE_SAMPLE
|
||||
$classPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($class);
|
||||
$classPhpDocInfo->addTagValueNode($doctrineAnnotationTagValueNode);
|
||||
unset($loadValidatorMetadataClassMethod->stmts[$stmtKey]);
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($class);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ use Rector\BetterPhpDocParser\PhpDoc\StringNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
|
||||
use Rector\BetterPhpDocParser\Printer\PhpDocInfoPrinter;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Symfony\Enum\SensioAttribute;
|
||||
use Rector\Symfony\Enum\SymfonyAnnotation;
|
||||
@ -31,13 +32,13 @@ final class MergeMethodAnnotationToRouteAnnotationRector extends AbstractRector
|
||||
private $phpDocTagRemover;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Printer\PhpDocInfoPrinter
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $phpDocInfoPrinter;
|
||||
public function __construct(PhpDocTagRemover $phpDocTagRemover, PhpDocInfoPrinter $phpDocInfoPrinter)
|
||||
private $docBlockUpdater;
|
||||
public function __construct(PhpDocTagRemover $phpDocTagRemover, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->phpDocTagRemover = $phpDocTagRemover;
|
||||
$this->phpDocInfoPrinter = $phpDocInfoPrinter;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
@ -111,7 +112,7 @@ CODE_SAMPLE
|
||||
}
|
||||
$symfonyDoctrineAnnotationTagValueNode->values[] = new ArrayItemNode($sensioMethods, 'methods');
|
||||
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $sensioDoctrineAnnotationTagValueNode);
|
||||
$this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo);
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($classMethod);
|
||||
$hasChanged = \true;
|
||||
}
|
||||
if ($hasChanged) {
|
||||
|
@ -8,6 +8,7 @@ use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Configuration\RenamedClassesDataCollector;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Symfony\Enum\SymfonyAnnotation;
|
||||
@ -37,11 +38,17 @@ final class ReplaceSensioRouteAnnotationWithSymfonyRector extends AbstractRector
|
||||
* @var \Rector\Core\Configuration\RenamedClassesDataCollector
|
||||
*/
|
||||
private $renamedClassesDataCollector;
|
||||
public function __construct(SymfonyRouteTagValueNodeFactory $symfonyRouteTagValueNodeFactory, PhpDocTagRemover $phpDocTagRemover, RenamedClassesDataCollector $renamedClassesDataCollector)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
public function __construct(SymfonyRouteTagValueNodeFactory $symfonyRouteTagValueNodeFactory, PhpDocTagRemover $phpDocTagRemover, RenamedClassesDataCollector $renamedClassesDataCollector, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->symfonyRouteTagValueNodeFactory = $symfonyRouteTagValueNodeFactory;
|
||||
$this->phpDocTagRemover = $phpDocTagRemover;
|
||||
$this->renamedClassesDataCollector = $renamedClassesDataCollector;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
@ -99,6 +106,7 @@ CODE_SAMPLE
|
||||
$values = $doctrineAnnotationTagValueNode->getValues();
|
||||
$symfonyRouteTagValueNode = $this->symfonyRouteTagValueNodeFactory->createFromItems($values);
|
||||
$phpDocInfo->addTagValueNode($symfonyRouteTagValueNode);
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
|
||||
return $node;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ use PHPStan\Type\ObjectType;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\BetterPhpDocParser\ValueObject\Type\FullyQualifiedIdentifierTypeNode;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Core\Php\PhpVersionProvider;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
@ -31,11 +32,17 @@ final class ReturnTypeDeclarationUpdater
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
public function __construct(PhpVersionProvider $phpVersionProvider, StaticTypeMapper $staticTypeMapper, PhpDocInfoFactory $phpDocInfoFactory)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
public function __construct(PhpVersionProvider $phpVersionProvider, StaticTypeMapper $staticTypeMapper, PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
/**
|
||||
* @param class-string $className
|
||||
@ -59,6 +66,7 @@ final class ReturnTypeDeclarationUpdater
|
||||
if ($returnStaticType instanceof ArrayType || $returnStaticType instanceof UnionType) {
|
||||
$returnTagValueNode->type = new FullyQualifiedIdentifierTypeNode($className);
|
||||
}
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($classMethod);
|
||||
}
|
||||
/**
|
||||
* @param class-string $className
|
||||
|
Loading…
x
Reference in New Issue
Block a user