mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 23:10:51 +00:00
Updated Rector to commit b44261f1d5
b44261f1d5
bump rector-doctrine 0.11.5
This commit is contained in:
parent
8f25ba84d6
commit
d587cc94bb
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'be0591c6d5d0a7ab693b6e94cb5f97b5e5419b85';
|
||||
public const PACKAGE_VERSION = 'b44261f1d5c3f4d97ab879c3dac80fa56578e8ae';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-06-15 16:14:58';
|
||||
public const RELEASE_DATE = '2021-06-15 17:20:29';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210615\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 ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613::getLoader();
|
||||
return ComposerAutoloaderInit2e644cbe0c61a4efff797ceb4745adab::getLoader();
|
||||
|
|
10
vendor/composer/autoload_classmap.php
vendored
10
vendor/composer/autoload_classmap.php
vendored
|
@ -2048,11 +2048,16 @@ return array(
|
|||
'Rector\\Doctrine\\Contract\\PhpDoc\\Node\\DoctrineTagNodeInterface' => $vendorDir . '/rector/rector-doctrine/src/Contract/PhpDoc/Node/DoctrineTagNodeInterface.php',
|
||||
'Rector\\Doctrine\\Contract\\PhpDoc\\Node\\InversedByNodeInterface' => $vendorDir . '/rector/rector-doctrine/src/Contract/PhpDoc/Node/InversedByNodeInterface.php',
|
||||
'Rector\\Doctrine\\Contract\\PhpDoc\\Node\\MappedByNodeInterface' => $vendorDir . '/rector/rector-doctrine/src/Contract/PhpDoc/Node/MappedByNodeInterface.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\AssignPropertyFetchAnalyzer' => $vendorDir . '/rector/rector-doctrine/src/NodeAnalyzer/AssignPropertyFetchAnalyzer.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\ConstructorAssignPropertyAnalyzer' => $vendorDir . '/rector/rector-doctrine/src/NodeAnalyzer/ConstructorAssignPropertyAnalyzer.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\EntityObjectTypeResolver' => $vendorDir . '/rector/rector-doctrine/src/NodeAnalyzer/EntityObjectTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\MethodCallNameOnTypeResolver' => $vendorDir . '/rector/rector-doctrine/src/NodeAnalyzer/MethodCallNameOnTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\SetterClassMethodAnalyzer' => $vendorDir . '/rector/rector-doctrine/src/NodeAnalyzer/SetterClassMethodAnalyzer.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\TranslatablePropertyCollectorAndRemover' => $vendorDir . '/rector/rector-doctrine/src/NodeAnalyzer/TranslatablePropertyCollectorAndRemover.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\ConstructClassMethodFactory' => $vendorDir . '/rector/rector-doctrine/src/NodeFactory/ConstructClassMethodFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\ConstructorClassMethodAssignFactory' => $vendorDir . '/rector/rector-doctrine/src/NodeFactory/ConstructorClassMethodAssignFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\EntityIdNodeFactory' => $vendorDir . '/rector/rector-doctrine/src/NodeFactory/EntityIdNodeFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\ParamFactory' => $vendorDir . '/rector/rector-doctrine/src/NodeFactory/ParamFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\RepositoryAssignFactory' => $vendorDir . '/rector/rector-doctrine/src/NodeFactory/RepositoryAssignFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\RepositoryNodeFactory' => $vendorDir . '/rector/rector-doctrine/src/NodeFactory/RepositoryNodeFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\TranslationClassNodeFactory' => $vendorDir . '/rector/rector-doctrine/src/NodeFactory/TranslationClassNodeFactory.php',
|
||||
|
@ -2060,6 +2065,7 @@ return array(
|
|||
'Rector\\Doctrine\\NodeManipulator\\ConstructorManipulator' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/ConstructorManipulator.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\DependencyRemover' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/DependencyRemover.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\DoctrineItemDefaultValueManipulator' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/DoctrineItemDefaultValueManipulator.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\IssetDimFetchCleaner' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/IssetDimFetchCleaner.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\PropertyTypeManipulator' => $vendorDir . '/rector/rector-doctrine/src/NodeManipulator/PropertyTypeManipulator.php',
|
||||
'Rector\\Doctrine\\PhpDocParser\\DoctrineDocBlockResolver' => $vendorDir . '/rector/rector-doctrine/src/PhpDocParser/DoctrineDocBlockResolver.php',
|
||||
'Rector\\Doctrine\\Rector\\ClassMethod\\MakeEntitySetterNullabilityInSyncWithPropertyRector' => $vendorDir . '/rector/rector-doctrine/src/Rector/ClassMethod/MakeEntitySetterNullabilityInSyncWithPropertyRector.php',
|
||||
|
@ -2093,6 +2099,10 @@ return array(
|
|||
'Rector\\Doctrine\\TypeAnalyzer\\CollectionVarTagValueNodeResolver' => $vendorDir . '/rector/rector-doctrine/src/TypeAnalyzer/CollectionVarTagValueNodeResolver.php',
|
||||
'Rector\\Doctrine\\TypeAnalyzer\\TypeFinder' => $vendorDir . '/rector/rector-doctrine/src/TypeAnalyzer/TypeFinder.php',
|
||||
'Rector\\Doctrine\\Type\\RepositoryTypeFactory' => $vendorDir . '/rector/rector-doctrine/src/Type/RepositoryTypeFactory.php',
|
||||
'Rector\\Doctrine\\ValueObject\\AssignToPropertyFetch' => $vendorDir . '/rector/rector-doctrine/src/ValueObject/AssignToPropertyFetch.php',
|
||||
'Rector\\Doctrine\\ValueObject\\OptionalAndRequiredParamNames' => $vendorDir . '/rector/rector-doctrine/src/ValueObject/OptionalAndRequiredParamNames.php',
|
||||
'Rector\\Doctrine\\ValueObject\\PropertyNameAndPhpDocInfo' => $vendorDir . '/rector/rector-doctrine/src/ValueObject/PropertyNameAndPhpDocInfo.php',
|
||||
'Rector\\Doctrine\\ValueObject\\PropertyNamesAndPhpDocInfos' => $vendorDir . '/rector/rector-doctrine/src/ValueObject/PropertyNamesAndPhpDocInfos.php',
|
||||
'Rector\\DowngradePhp53\\Rector\\Dir\\DirConstToFileConstRector' => $baseDir . '/rules/DowngradePhp53/Rector/Dir/DirConstToFileConstRector.php',
|
||||
'Rector\\DowngradePhp70\\NodeFactory\\ClassFromAnonymousFactory' => $baseDir . '/rules/DowngradePhp70/NodeFactory/ClassFromAnonymousFactory.php',
|
||||
'Rector\\DowngradePhp70\\Rector\\Coalesce\\DowngradeNullCoalesceRector' => $baseDir . '/rules/DowngradePhp70/Rector/Coalesce/DowngradeNullCoalesceRector.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 ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613
|
||||
class ComposerAutoloaderInit2e644cbe0c61a4efff797ceb4745adab
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2e644cbe0c61a4efff797ceb4745adab', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2e644cbe0c61a4efff797ceb4745adab', '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\ComposerStaticInit8b11201017e5626a81ab44a9e5eec613::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit2e644cbe0c61a4efff797ceb4745adab::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit8b11201017e5626a81ab44a9e5eec613::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit2e644cbe0c61a4efff797ceb4745adab::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire8b11201017e5626a81ab44a9e5eec613($fileIdentifier, $file);
|
||||
composerRequire2e644cbe0c61a4efff797ceb4745adab($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire8b11201017e5626a81ab44a9e5eec613($fileIdentifier, $file)
|
||||
function composerRequire2e644cbe0c61a4efff797ceb4745adab($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
|
18
vendor/composer/autoload_static.php
vendored
18
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit8b11201017e5626a81ab44a9e5eec613
|
||||
class ComposerStaticInit2e644cbe0c61a4efff797ceb4745adab
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -2403,11 +2403,16 @@ class ComposerStaticInit8b11201017e5626a81ab44a9e5eec613
|
|||
'Rector\\Doctrine\\Contract\\PhpDoc\\Node\\DoctrineTagNodeInterface' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Contract/PhpDoc/Node/DoctrineTagNodeInterface.php',
|
||||
'Rector\\Doctrine\\Contract\\PhpDoc\\Node\\InversedByNodeInterface' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Contract/PhpDoc/Node/InversedByNodeInterface.php',
|
||||
'Rector\\Doctrine\\Contract\\PhpDoc\\Node\\MappedByNodeInterface' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Contract/PhpDoc/Node/MappedByNodeInterface.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\AssignPropertyFetchAnalyzer' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeAnalyzer/AssignPropertyFetchAnalyzer.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\ConstructorAssignPropertyAnalyzer' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeAnalyzer/ConstructorAssignPropertyAnalyzer.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\EntityObjectTypeResolver' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeAnalyzer/EntityObjectTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\MethodCallNameOnTypeResolver' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeAnalyzer/MethodCallNameOnTypeResolver.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\SetterClassMethodAnalyzer' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeAnalyzer/SetterClassMethodAnalyzer.php',
|
||||
'Rector\\Doctrine\\NodeAnalyzer\\TranslatablePropertyCollectorAndRemover' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeAnalyzer/TranslatablePropertyCollectorAndRemover.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\ConstructClassMethodFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeFactory/ConstructClassMethodFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\ConstructorClassMethodAssignFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeFactory/ConstructorClassMethodAssignFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\EntityIdNodeFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeFactory/EntityIdNodeFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\ParamFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeFactory/ParamFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\RepositoryAssignFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeFactory/RepositoryAssignFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\RepositoryNodeFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeFactory/RepositoryNodeFactory.php',
|
||||
'Rector\\Doctrine\\NodeFactory\\TranslationClassNodeFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeFactory/TranslationClassNodeFactory.php',
|
||||
|
@ -2415,6 +2420,7 @@ class ComposerStaticInit8b11201017e5626a81ab44a9e5eec613
|
|||
'Rector\\Doctrine\\NodeManipulator\\ConstructorManipulator' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/ConstructorManipulator.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\DependencyRemover' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/DependencyRemover.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\DoctrineItemDefaultValueManipulator' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/DoctrineItemDefaultValueManipulator.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\IssetDimFetchCleaner' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/IssetDimFetchCleaner.php',
|
||||
'Rector\\Doctrine\\NodeManipulator\\PropertyTypeManipulator' => __DIR__ . '/..' . '/rector/rector-doctrine/src/NodeManipulator/PropertyTypeManipulator.php',
|
||||
'Rector\\Doctrine\\PhpDocParser\\DoctrineDocBlockResolver' => __DIR__ . '/..' . '/rector/rector-doctrine/src/PhpDocParser/DoctrineDocBlockResolver.php',
|
||||
'Rector\\Doctrine\\Rector\\ClassMethod\\MakeEntitySetterNullabilityInSyncWithPropertyRector' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Rector/ClassMethod/MakeEntitySetterNullabilityInSyncWithPropertyRector.php',
|
||||
|
@ -2448,6 +2454,10 @@ class ComposerStaticInit8b11201017e5626a81ab44a9e5eec613
|
|||
'Rector\\Doctrine\\TypeAnalyzer\\CollectionVarTagValueNodeResolver' => __DIR__ . '/..' . '/rector/rector-doctrine/src/TypeAnalyzer/CollectionVarTagValueNodeResolver.php',
|
||||
'Rector\\Doctrine\\TypeAnalyzer\\TypeFinder' => __DIR__ . '/..' . '/rector/rector-doctrine/src/TypeAnalyzer/TypeFinder.php',
|
||||
'Rector\\Doctrine\\Type\\RepositoryTypeFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/src/Type/RepositoryTypeFactory.php',
|
||||
'Rector\\Doctrine\\ValueObject\\AssignToPropertyFetch' => __DIR__ . '/..' . '/rector/rector-doctrine/src/ValueObject/AssignToPropertyFetch.php',
|
||||
'Rector\\Doctrine\\ValueObject\\OptionalAndRequiredParamNames' => __DIR__ . '/..' . '/rector/rector-doctrine/src/ValueObject/OptionalAndRequiredParamNames.php',
|
||||
'Rector\\Doctrine\\ValueObject\\PropertyNameAndPhpDocInfo' => __DIR__ . '/..' . '/rector/rector-doctrine/src/ValueObject/PropertyNameAndPhpDocInfo.php',
|
||||
'Rector\\Doctrine\\ValueObject\\PropertyNamesAndPhpDocInfos' => __DIR__ . '/..' . '/rector/rector-doctrine/src/ValueObject/PropertyNamesAndPhpDocInfos.php',
|
||||
'Rector\\DowngradePhp53\\Rector\\Dir\\DirConstToFileConstRector' => __DIR__ . '/../..' . '/rules/DowngradePhp53/Rector/Dir/DirConstToFileConstRector.php',
|
||||
'Rector\\DowngradePhp70\\NodeFactory\\ClassFromAnonymousFactory' => __DIR__ . '/../..' . '/rules/DowngradePhp70/NodeFactory/ClassFromAnonymousFactory.php',
|
||||
'Rector\\DowngradePhp70\\Rector\\Coalesce\\DowngradeNullCoalesceRector' => __DIR__ . '/../..' . '/rules/DowngradePhp70/Rector/Coalesce/DowngradeNullCoalesceRector.php',
|
||||
|
@ -3864,9 +3874,9 @@ class ComposerStaticInit8b11201017e5626a81ab44a9e5eec613
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit8b11201017e5626a81ab44a9e5eec613::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit8b11201017e5626a81ab44a9e5eec613::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit8b11201017e5626a81ab44a9e5eec613::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2e644cbe0c61a4efff797ceb4745adab::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2e644cbe0c61a4efff797ceb4745adab::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2e644cbe0c61a4efff797ceb4745adab::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
15
vendor/composer/installed.json
vendored
15
vendor/composer/installed.json
vendored
|
@ -1167,17 +1167,17 @@
|
|||
},
|
||||
{
|
||||
"name": "rector\/rector-doctrine",
|
||||
"version": "0.11.4",
|
||||
"version_normalized": "0.11.4.0",
|
||||
"version": "0.11.5",
|
||||
"version_normalized": "0.11.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "e890a52131d6f05808c1f78f18faeb1d5c597e46"
|
||||
"reference": "644d83f5ae42634c3b8861fedbdb07b58b51391b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/e890a52131d6f05808c1f78f18faeb1d5c597e46",
|
||||
"reference": "e890a52131d6f05808c1f78f18faeb1d5c597e46",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/644d83f5ae42634c3b8861fedbdb07b58b51391b",
|
||||
"reference": "644d83f5ae42634c3b8861fedbdb07b58b51391b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1190,6 +1190,7 @@
|
|||
"doctrine\/orm": "^2.9",
|
||||
"phpstan\/extension-installer": "^1.1",
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"rector\/phpstan-rules": "^0.3.2",
|
||||
"rector\/rector-generator": "^0.2",
|
||||
"rector\/rector-src": "^0.11.2",
|
||||
"symplify\/easy-coding-standard": "^9.2",
|
||||
|
@ -1197,7 +1198,7 @@
|
|||
"symplify\/phpstan-rules": "^9.2",
|
||||
"symplify\/rule-doc-generator": "^9.2"
|
||||
},
|
||||
"time": "2021-06-14T22:51:40+00:00",
|
||||
"time": "2021-06-15T15:19:05+00:00",
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@ -1222,7 +1223,7 @@
|
|||
"description": "Rector upgrades rules for Doctrine",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/rectorphp\/rector-doctrine\/issues",
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-doctrine\/tree\/0.11.4"
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-doctrine\/tree\/0.11.5"
|
||||
},
|
||||
"install-path": "..\/rector\/rector-doctrine"
|
||||
},
|
||||
|
|
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' => '0.11.2'), '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' => '0.11.4'), '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' => '0.11.1'), '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' => '0.11.4'), 'rector/rector-nette-to-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette-to-symfony', 'relative_install_path' => '../../rector-nette-to-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), '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' => '0.11.1'), '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' => '0.11.5'), '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' => 'v0.11.16'));
|
||||
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' => '0.11.2'), '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' => '0.11.5'), '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' => '0.11.1'), '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' => '0.11.4'), 'rector/rector-nette-to-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette-to-symfony', 'relative_install_path' => '../../rector-nette-to-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => '0.11.3'), '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' => '0.11.1'), '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' => '0.11.5'), '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' => 'v0.11.16'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
1
vendor/rector/rector-doctrine/composer.json
vendored
1
vendor/rector/rector-doctrine/composer.json
vendored
|
@ -8,6 +8,7 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"phpstan\/extension-installer": "^1.1",
|
||||
"rector\/phpstan-rules": "^0.3.2",
|
||||
"phpunit\/phpunit": "^9.5",
|
||||
"symplify\/phpstan-rules": "^9.2",
|
||||
"symplify\/phpstan-extensions": "^9.2",
|
||||
|
|
|
@ -7,5 +7,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
|||
return static function (\Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $containerConfigurator) : void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->defaults()->public()->autowire()->autoconfigure();
|
||||
$services->load('Rector\\Doctrine\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/Rector']);
|
||||
$services->load('Rector\\Doctrine\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/Rector', __DIR__ . '/../src/ValueObject']);
|
||||
};
|
||||
|
|
46
vendor/rector/rector-doctrine/src/NodeAnalyzer/AssignPropertyFetchAnalyzer.php
vendored
Normal file
46
vendor/rector/rector-doctrine/src/NodeAnalyzer/AssignPropertyFetchAnalyzer.php
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Doctrine\ValueObject\AssignToPropertyFetch;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
final class AssignPropertyFetchAnalyzer
|
||||
{
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
public function __construct(\Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
}
|
||||
/**
|
||||
* @return AssignToPropertyFetch[]
|
||||
*/
|
||||
public function resolveAssignToPropertyFetch(\PhpParser\Node\Stmt\ClassMethod $classMethod) : array
|
||||
{
|
||||
/** @var Assign[] $assigns */
|
||||
$assigns = $this->betterNodeFinder->findInstanceOf((array) $classMethod->stmts, \PhpParser\Node\Expr\Assign::class);
|
||||
$assignsToPropertyFetch = [];
|
||||
foreach ($assigns as $assign) {
|
||||
if (!$assign->var instanceof \PhpParser\Node\Expr\PropertyFetch) {
|
||||
continue;
|
||||
}
|
||||
$propertyFetch = $assign->var;
|
||||
/** @var string $propertyName */
|
||||
$propertyName = $this->nodeNameResolver->getName($propertyFetch);
|
||||
$assignsToPropertyFetch[] = new \Rector\Doctrine\ValueObject\AssignToPropertyFetch($assign, $propertyFetch, $propertyName);
|
||||
}
|
||||
return $assignsToPropertyFetch;
|
||||
}
|
||||
}
|
58
vendor/rector/rector-doctrine/src/NodeAnalyzer/TranslatablePropertyCollectorAndRemover.php
vendored
Normal file
58
vendor/rector/rector-doctrine/src/NodeAnalyzer/TranslatablePropertyCollectorAndRemover.php
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
|
||||
use Rector\Doctrine\ValueObject\PropertyNameAndPhpDocInfo;
|
||||
use Rector\Doctrine\ValueObject\PropertyNamesAndPhpDocInfos;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeRemoval\NodeRemover;
|
||||
final class TranslatablePropertyCollectorAndRemover
|
||||
{
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover
|
||||
*/
|
||||
private $phpDocTagRemover;
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
/**
|
||||
* @var \Rector\NodeRemoval\NodeRemover
|
||||
*/
|
||||
private $nodeRemover;
|
||||
/**
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
public function __construct(\Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover $phpDocTagRemover, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory $phpDocInfoFactory, \Rector\NodeRemoval\NodeRemover $nodeRemover, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->phpDocTagRemover = $phpDocTagRemover;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
$this->nodeRemover = $nodeRemover;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
}
|
||||
public function processClass(\PhpParser\Node\Stmt\Class_ $class) : \Rector\Doctrine\ValueObject\PropertyNamesAndPhpDocInfos
|
||||
{
|
||||
$propertyNameAndPhpDocInfos = [];
|
||||
foreach ($class->getProperties() as $property) {
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
if ($phpDocInfo->hasByAnnotationClass('Gedmo\\Mapping\\Annotation\\Locale')) {
|
||||
$this->nodeRemover->removeNode($property);
|
||||
continue;
|
||||
}
|
||||
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Gedmo\\Mapping\\Annotation\\Translatable');
|
||||
if (!$doctrineAnnotationTagValueNode) {
|
||||
continue;
|
||||
}
|
||||
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $doctrineAnnotationTagValueNode);
|
||||
$propertyName = $this->nodeNameResolver->getName($property);
|
||||
$propertyNameAndPhpDocInfos[] = new \Rector\Doctrine\ValueObject\PropertyNameAndPhpDocInfo($propertyName, $phpDocInfo);
|
||||
$this->nodeRemover->removeNode($property);
|
||||
}
|
||||
return new \Rector\Doctrine\ValueObject\PropertyNamesAndPhpDocInfos($propertyNameAndPhpDocInfos);
|
||||
}
|
||||
}
|
89
vendor/rector/rector-doctrine/src/NodeFactory/ConstructClassMethodFactory.php
vendored
Normal file
89
vendor/rector/rector-doctrine/src/NodeFactory/ConstructClassMethodFactory.php
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\NodeFactory;
|
||||
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
use RectorPrefix20210615\Symplify\Astral\ValueObject\NodeBuilder\MethodBuilder;
|
||||
final class ConstructClassMethodFactory
|
||||
{
|
||||
/**
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
*/
|
||||
private $staticTypeMapper;
|
||||
public function __construct(\Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
}
|
||||
public function createFromPublicClassProperties(\PhpParser\Node\Stmt\Class_ $class) : ?\PhpParser\Node\Stmt\ClassMethod
|
||||
{
|
||||
$publicProperties = $this->resolvePublicProperties($class);
|
||||
if ($publicProperties === []) {
|
||||
return null;
|
||||
}
|
||||
$params = [];
|
||||
$assigns = [];
|
||||
foreach ($publicProperties as $publicProperty) {
|
||||
/** @var string $propertyName */
|
||||
$propertyName = $this->nodeNameResolver->getName($publicProperty);
|
||||
$params[] = $this->createParam($publicProperty, $propertyName);
|
||||
$assigns[] = $this->createAssign($propertyName);
|
||||
}
|
||||
$methodBuilder = new \RectorPrefix20210615\Symplify\Astral\ValueObject\NodeBuilder\MethodBuilder(\Rector\Core\ValueObject\MethodName::CONSTRUCT);
|
||||
$methodBuilder->makePublic();
|
||||
$methodBuilder->addParams($params);
|
||||
$methodBuilder->addStmts($assigns);
|
||||
return $methodBuilder->getNode();
|
||||
}
|
||||
/**
|
||||
* @return Property[]
|
||||
*/
|
||||
private function resolvePublicProperties(\PhpParser\Node\Stmt\Class_ $class) : array
|
||||
{
|
||||
$publicProperties = [];
|
||||
foreach ($class->getProperties() as $property) {
|
||||
if (!$property->isPublic()) {
|
||||
continue;
|
||||
}
|
||||
$publicProperties[] = $property;
|
||||
}
|
||||
return $publicProperties;
|
||||
}
|
||||
private function createAssign(string $name) : \PhpParser\Node\Stmt\Expression
|
||||
{
|
||||
$propertyFetch = new \PhpParser\Node\Expr\PropertyFetch(new \PhpParser\Node\Expr\Variable('this'), $name);
|
||||
$variable = new \PhpParser\Node\Expr\Variable($name);
|
||||
$assign = new \PhpParser\Node\Expr\Assign($propertyFetch, $variable);
|
||||
return new \PhpParser\Node\Stmt\Expression($assign);
|
||||
}
|
||||
private function createParam(\PhpParser\Node\Stmt\Property $property, string $propertyName) : \PhpParser\Node\Param
|
||||
{
|
||||
$propertyType = $this->nodeTypeResolver->resolve($property);
|
||||
$propertyTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($propertyType);
|
||||
$paramVariable = new \PhpParser\Node\Expr\Variable($propertyName);
|
||||
$param = new \PhpParser\Node\Param($paramVariable);
|
||||
$param->type = $propertyTypeNode;
|
||||
return $param;
|
||||
}
|
||||
}
|
26
vendor/rector/rector-doctrine/src/NodeFactory/ConstructorClassMethodAssignFactory.php
vendored
Normal file
26
vendor/rector/rector-doctrine/src/NodeFactory/ConstructorClassMethodAssignFactory.php
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\NodeFactory;
|
||||
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
final class ConstructorClassMethodAssignFactory
|
||||
{
|
||||
/**
|
||||
* @param string[] $paramNames
|
||||
* @return Expression[]
|
||||
*/
|
||||
public function createFromParamNames(array $paramNames) : array
|
||||
{
|
||||
$expressions = [];
|
||||
foreach ($paramNames as $paramName) {
|
||||
$propertyFetch = new \PhpParser\Node\Expr\PropertyFetch(new \PhpParser\Node\Expr\Variable('this'), $paramName);
|
||||
$assign = new \PhpParser\Node\Expr\Assign($propertyFetch, new \PhpParser\Node\Expr\Variable($paramName));
|
||||
$expressions[] = new \PhpParser\Node\Stmt\Expression($assign);
|
||||
}
|
||||
return $expressions;
|
||||
}
|
||||
}
|
79
vendor/rector/rector-doctrine/src/NodeFactory/ParamFactory.php
vendored
Normal file
79
vendor/rector/rector-doctrine/src/NodeFactory/ParamFactory.php
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\NodeFactory;
|
||||
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\UnionType;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\PhpParser\Node\NodeFactory;
|
||||
use Rector\Doctrine\ValueObject\AssignToPropertyFetch;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use Rector\StaticTypeMapper\StaticTypeMapper;
|
||||
final class ParamFactory
|
||||
{
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
/**
|
||||
* @var \Rector\StaticTypeMapper\StaticTypeMapper
|
||||
*/
|
||||
private $staticTypeMapper;
|
||||
/**
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(\Rector\NodeTypeResolver\NodeTypeResolver $nodeTypeResolver, \Rector\StaticTypeMapper\StaticTypeMapper $staticTypeMapper, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\Core\PhpParser\Node\NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->staticTypeMapper = $staticTypeMapper;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
/**
|
||||
* @param AssignToPropertyFetch[] $assignsToPropertyFetch
|
||||
* @param string[] $optionalParamNames
|
||||
* @return Param[]
|
||||
*/
|
||||
public function createFromAssignsToPropertyFetch(array $assignsToPropertyFetch, array $optionalParamNames) : array
|
||||
{
|
||||
$params = [];
|
||||
foreach ($assignsToPropertyFetch as $assignToPropertyFetch) {
|
||||
$propertyFetch = $assignToPropertyFetch->getPropertyFetch();
|
||||
$params[] = $this->createFromPropertyFetch($propertyFetch, $optionalParamNames);
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
/**
|
||||
* @param string[] $optionalParamNames
|
||||
*/
|
||||
public function createFromPropertyFetch(\PhpParser\Node\Expr\PropertyFetch $propertyFetch, array $optionalParamNames) : \PhpParser\Node\Param
|
||||
{
|
||||
$propertyName = $this->nodeNameResolver->getName($propertyFetch->name);
|
||||
if ($propertyName === null) {
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
$variable = new \PhpParser\Node\Expr\Variable($propertyName);
|
||||
$param = new \PhpParser\Node\Param($variable);
|
||||
$paramType = $this->nodeTypeResolver->getStaticType($propertyFetch);
|
||||
$paramTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($paramType);
|
||||
// the param is optional - make it nullable
|
||||
if (\in_array($propertyName, $optionalParamNames, \true)) {
|
||||
if (!$paramTypeNode instanceof \PhpParser\Node\UnionType && $paramTypeNode !== null && !$paramTypeNode instanceof \PhpParser\Node\NullableType) {
|
||||
$paramTypeNode = new \PhpParser\Node\NullableType($paramTypeNode);
|
||||
}
|
||||
$param->default = $this->nodeFactory->createNull();
|
||||
}
|
||||
$param->type = $paramTypeNode;
|
||||
return $param;
|
||||
}
|
||||
}
|
132
vendor/rector/rector-doctrine/src/NodeManipulator/IssetDimFetchCleaner.php
vendored
Normal file
132
vendor/rector/rector-doctrine/src/NodeManipulator/IssetDimFetchCleaner.php
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\NodeManipulator;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Expr\Isset_;
|
||||
use PhpParser\Node\Expr\Throw_;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Throw_ as ThrowStmt;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||
use Rector\NodeRemoval\NodeRemover;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
final class IssetDimFetchCleaner
|
||||
{
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
|
||||
*/
|
||||
private $valueResolver;
|
||||
/**
|
||||
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
|
||||
*/
|
||||
private $nodeComparator;
|
||||
/**
|
||||
* @var \Rector\NodeRemoval\NodeRemover
|
||||
*/
|
||||
private $nodeRemover;
|
||||
public function __construct(\Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \Rector\Core\PhpParser\Node\Value\ValueResolver $valueResolver, \Rector\Core\PhpParser\Comparing\NodeComparator $nodeComparator, \Rector\NodeRemoval\NodeRemover $nodeRemover)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->valueResolver = $valueResolver;
|
||||
$this->nodeComparator = $nodeComparator;
|
||||
$this->nodeRemover = $nodeRemover;
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function resolveOptionalParamNames(\PhpParser\Node\Stmt\ClassMethod $classMethod, \PhpParser\Node\Expr\Variable $paramVariable) : array
|
||||
{
|
||||
$optionalParamNames = [];
|
||||
foreach ((array) $classMethod->stmts as $stmt) {
|
||||
if (!$stmt instanceof \PhpParser\Node\Stmt\If_) {
|
||||
continue;
|
||||
}
|
||||
/** @var If_ $if */
|
||||
$if = $stmt;
|
||||
/** @var Isset_|null $isset */
|
||||
$isset = $this->betterNodeFinder->findFirstInstanceOf($if->cond, \PhpParser\Node\Expr\Isset_::class);
|
||||
if (!$isset instanceof \PhpParser\Node\Expr\Isset_) {
|
||||
continue;
|
||||
}
|
||||
$issetParent = $isset->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
foreach ($isset->vars as $var) {
|
||||
$dimFetchValue = $this->matchArrayDimFetchValue($var, $paramVariable);
|
||||
if (!\is_string($dimFetchValue)) {
|
||||
continue;
|
||||
}
|
||||
// is required or optional?
|
||||
if ($this->isRequiredIsset($isset, $if)) {
|
||||
// contains exception? → required param → skip
|
||||
continue;
|
||||
}
|
||||
// else optional param
|
||||
$optionalParamNames[] = $dimFetchValue;
|
||||
}
|
||||
}
|
||||
return $optionalParamNames;
|
||||
}
|
||||
public function removeArrayDimFetchIssets(\PhpParser\Node\Stmt\ClassMethod $classMethod, \PhpParser\Node\Expr\Variable $paramVariable) : void
|
||||
{
|
||||
foreach ((array) $classMethod->stmts as $stmt) {
|
||||
if (!$stmt instanceof \PhpParser\Node\Stmt\If_) {
|
||||
continue;
|
||||
}
|
||||
/** @var If_ $if */
|
||||
$if = $stmt;
|
||||
/** @var Isset_|null $isset */
|
||||
$isset = $this->betterNodeFinder->findFirstInstanceOf($if->cond, \PhpParser\Node\Expr\Isset_::class);
|
||||
if (!$isset instanceof \PhpParser\Node\Expr\Isset_) {
|
||||
continue;
|
||||
}
|
||||
foreach ($isset->vars as $var) {
|
||||
if (!$this->isArrayDimFetchOnVariable($var, $paramVariable)) {
|
||||
continue;
|
||||
}
|
||||
// remove if stmt, this check is not part of __constuct() contract
|
||||
$this->nodeRemover->removeNode($if);
|
||||
}
|
||||
}
|
||||
}
|
||||
private function isArrayDimFetchOnVariable(\PhpParser\Node\Expr $var, \PhpParser\Node\Expr\Variable $desiredVariable) : bool
|
||||
{
|
||||
if (!$var instanceof \PhpParser\Node\Expr\ArrayDimFetch) {
|
||||
return \false;
|
||||
}
|
||||
return $this->nodeComparator->areNodesEqual($desiredVariable, $var->var);
|
||||
}
|
||||
/**
|
||||
* @return mixed|mixed[]|string|null
|
||||
*/
|
||||
private function matchArrayDimFetchValue(\PhpParser\Node\Expr $expr, \PhpParser\Node\Expr\Variable $variable)
|
||||
{
|
||||
if (!$expr instanceof \PhpParser\Node\Expr\ArrayDimFetch) {
|
||||
return null;
|
||||
}
|
||||
if ($expr->dim === null) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isArrayDimFetchOnVariable($expr, $variable)) {
|
||||
return null;
|
||||
}
|
||||
return $this->valueResolver->getValue($expr->dim);
|
||||
}
|
||||
private function isRequiredIsset(\PhpParser\Node\Expr\Isset_ $isset, \PhpParser\Node\Stmt\If_ $if) : bool
|
||||
{
|
||||
$issetParent = $isset->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
if (!$issetParent instanceof \PhpParser\Node\Expr\BooleanNot) {
|
||||
return \false;
|
||||
}
|
||||
return $this->betterNodeFinder->hasInstancesOf($if->stmts, [\PhpParser\Node\Expr\Throw_::class, \PhpParser\Node\Stmt\Throw_::class]);
|
||||
}
|
||||
}
|
|
@ -4,16 +4,22 @@ declare (strict_types=1);
|
|||
namespace Rector\Doctrine\Rector\Class_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\Type\ArrayType;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Core\NodeManipulator\ClassInsertManipulator;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Doctrine\NodeAnalyzer\AssignPropertyFetchAnalyzer;
|
||||
use Rector\Doctrine\NodeFactory\ConstructClassMethodFactory;
|
||||
use Rector\Doctrine\NodeFactory\ConstructorClassMethodAssignFactory;
|
||||
use Rector\Doctrine\NodeFactory\ParamFactory;
|
||||
use Rector\Doctrine\NodeManipulator\IssetDimFetchCleaner;
|
||||
use Rector\Doctrine\ValueObject\AssignToPropertyFetch;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
|
@ -23,6 +29,39 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
*/
|
||||
final class ClassAnnotationToNamedArgumentConstructorRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var \Rector\Doctrine\NodeFactory\ParamFactory
|
||||
*/
|
||||
private $paramFactory;
|
||||
/**
|
||||
* @var \Rector\Doctrine\NodeFactory\ConstructClassMethodFactory
|
||||
*/
|
||||
private $constructClassMethodFactory;
|
||||
/**
|
||||
* @var \Rector\Core\NodeManipulator\ClassInsertManipulator
|
||||
*/
|
||||
private $classInsertManipulator;
|
||||
/**
|
||||
* @var \Rector\Doctrine\NodeAnalyzer\AssignPropertyFetchAnalyzer
|
||||
*/
|
||||
private $assignPropertyFetchAnalyzer;
|
||||
/**
|
||||
* @var \Rector\Doctrine\NodeManipulator\IssetDimFetchCleaner
|
||||
*/
|
||||
private $issetDimFetchCleaner;
|
||||
/**
|
||||
* @var \Rector\Doctrine\NodeFactory\ConstructorClassMethodAssignFactory
|
||||
*/
|
||||
private $constructorClassMethodAssignFactory;
|
||||
public function __construct(\Rector\Doctrine\NodeFactory\ParamFactory $paramFactory, \Rector\Doctrine\NodeFactory\ConstructClassMethodFactory $constructClassMethodFactory, \Rector\Core\NodeManipulator\ClassInsertManipulator $classInsertManipulator, \Rector\Doctrine\NodeAnalyzer\AssignPropertyFetchAnalyzer $assignPropertyFetchAnalyzer, \Rector\Doctrine\NodeManipulator\IssetDimFetchCleaner $issetDimFetchCleaner, \Rector\Doctrine\NodeFactory\ConstructorClassMethodAssignFactory $constructorClassMethodAssignFactory)
|
||||
{
|
||||
$this->paramFactory = $paramFactory;
|
||||
$this->constructClassMethodFactory = $constructClassMethodFactory;
|
||||
$this->classInsertManipulator = $classInsertManipulator;
|
||||
$this->assignPropertyFetchAnalyzer = $assignPropertyFetchAnalyzer;
|
||||
$this->issetDimFetchCleaner = $issetDimFetchCleaner;
|
||||
$this->constructorClassMethodAssignFactory = $constructorClassMethodAssignFactory;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Decorate classic array-based class annotation with named parameters', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
|
@ -43,9 +82,11 @@ class SomeAnnotation
|
|||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @\Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor
|
||||
* @NamedArgumentConstructor
|
||||
*/
|
||||
class SomeAnnotation
|
||||
{
|
||||
|
@ -78,55 +119,75 @@ CODE_SAMPLE
|
|||
if ($phpDocInfo === null) {
|
||||
return null;
|
||||
}
|
||||
if (!$phpDocInfo->hasByNames(['annotation', 'Annotation'])) {
|
||||
return null;
|
||||
}
|
||||
if ($phpDocInfo->hasByAnnotationClass('Doctrine\\Common\\Annotations\\Annotation\\NamedArgumentConstructor')) {
|
||||
if ($this->shouldSkipPhpDocInfo($phpDocInfo)) {
|
||||
return null;
|
||||
}
|
||||
$doctrineAnnotationTagValueNode = new \Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode('Doctrine\\Common\\Annotations\\Annotation\\NamedArgumentConstructor');
|
||||
$phpDocInfo->addTagValueNode($doctrineAnnotationTagValueNode);
|
||||
$classMethod = $node->getMethod(\Rector\Core\ValueObject\MethodName::CONSTRUCT);
|
||||
if (!$classMethod instanceof \PhpParser\Node\Stmt\ClassMethod) {
|
||||
return $this->decorateClassWithAssignClassMethod($node);
|
||||
}
|
||||
if (!$this->hasSingleArrayParam($classMethod)) {
|
||||
return null;
|
||||
}
|
||||
/** @var Variable $paramVariable */
|
||||
$paramVariable = $classMethod->params[0]->var;
|
||||
$optionalParamNames = $this->issetDimFetchCleaner->resolveOptionalParamNames($classMethod, $paramVariable);
|
||||
$this->issetDimFetchCleaner->removeArrayDimFetchIssets($classMethod, $paramVariable);
|
||||
$assignsToPropertyFetch = $this->assignPropertyFetchAnalyzer->resolveAssignToPropertyFetch($classMethod);
|
||||
$this->replaceAssignsByParam($assignsToPropertyFetch);
|
||||
$classMethod->params = $this->paramFactory->createFromAssignsToPropertyFetch($assignsToPropertyFetch, $optionalParamNames);
|
||||
// include assigns for optional params - these do not have assign in the root, as they're hidden in if isset/check
|
||||
// so we have to add them
|
||||
$assigns = $this->constructorClassMethodAssignFactory->createFromParamNames($optionalParamNames);
|
||||
if ($assigns !== []) {
|
||||
$classMethod->stmts = \array_merge((array) $classMethod->stmts, $assigns);
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
private function shouldSkipPhpDocInfo(\Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfo) : bool
|
||||
{
|
||||
if (!$phpDocInfo->hasByNames(['annotation', 'Annotation'])) {
|
||||
return \true;
|
||||
}
|
||||
return $phpDocInfo->hasByAnnotationClass('Doctrine\\Common\\Annotations\\Annotation\\NamedArgumentConstructor');
|
||||
}
|
||||
private function hasSingleArrayParam(\PhpParser\Node\Stmt\ClassMethod $classMethod) : bool
|
||||
{
|
||||
if (\count($classMethod->params) !== 1) {
|
||||
return null;
|
||||
return \false;
|
||||
}
|
||||
$onlyParam = $classMethod->params[0];
|
||||
// change array to properites
|
||||
if ($onlyParam->type) {
|
||||
$paramType = $this->nodeTypeResolver->getStaticType($onlyParam);
|
||||
// we have a match
|
||||
if (!$paramType instanceof \PHPStan\Type\ArrayType) {
|
||||
return null;
|
||||
}
|
||||
if (!$onlyParam->type) {
|
||||
return \false;
|
||||
}
|
||||
/** @var Assign[] $assigns */
|
||||
$assigns = $this->betterNodeFinder->findInstanceOf($node->stmts, \PhpParser\Node\Expr\Assign::class);
|
||||
$params = [];
|
||||
foreach ($assigns as $assign) {
|
||||
if (!$assign->var instanceof \PhpParser\Node\Expr\PropertyFetch) {
|
||||
continue;
|
||||
}
|
||||
// decorate property fetches to params
|
||||
$propertyFetch = $assign->var;
|
||||
$propertyName = $this->nodeNameResolver->getName($propertyFetch->name);
|
||||
if ($propertyName === null) {
|
||||
continue;
|
||||
}
|
||||
$variable = new \PhpParser\Node\Expr\Variable($propertyName);
|
||||
$params[] = $this->createParam($propertyFetch, $variable);
|
||||
$assign->expr = $variable;
|
||||
}
|
||||
$classMethod->params = $params;
|
||||
return $node;
|
||||
$paramType = $this->nodeTypeResolver->getStaticType($onlyParam);
|
||||
// we have a match
|
||||
return $paramType instanceof \PHPStan\Type\ArrayType;
|
||||
}
|
||||
private function createParam(\PhpParser\Node\Expr\PropertyFetch $propertyFetch, \PhpParser\Node\Expr\Variable $variable) : \PhpParser\Node\Param
|
||||
/**
|
||||
* @param AssignToPropertyFetch[] $assignsToPropertyFetch
|
||||
*/
|
||||
private function replaceAssignsByParam(array $assignsToPropertyFetch) : void
|
||||
{
|
||||
$param = new \PhpParser\Node\Param($variable);
|
||||
$paramType = $this->nodeTypeResolver->getStaticType($propertyFetch);
|
||||
$param->type = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($paramType);
|
||||
return $param;
|
||||
foreach ($assignsToPropertyFetch as $assignToPropertyFetch) {
|
||||
$assign = $assignToPropertyFetch->getAssign();
|
||||
$assign->expr = new \PhpParser\Node\Expr\Variable($assignToPropertyFetch->getPropertyName());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return \PhpParser\Node\Stmt\Class_|null
|
||||
*/
|
||||
private function decorateClassWithAssignClassMethod(\PhpParser\Node\Stmt\Class_ $class)
|
||||
{
|
||||
// complete public properties
|
||||
$constructClassMethod = $this->constructClassMethodFactory->createFromPublicClassProperties($class);
|
||||
if ($constructClassMethod === null) {
|
||||
return null;
|
||||
}
|
||||
$this->classInsertManipulator->addAsFirstMethod($class, $constructClassMethod);
|
||||
return $class;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,13 +8,13 @@ use PhpParser\Node\Name\FullyQualified;
|
|||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
|
||||
use Rector\Core\Exception\ShouldNotHappenException;
|
||||
use Rector\Core\NodeManipulator\ClassInsertManipulator;
|
||||
use Rector\Core\NodeManipulator\ClassManipulator;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Doctrine\NodeAnalyzer\TranslatablePropertyCollectorAndRemover;
|
||||
use Rector\Doctrine\NodeFactory\TranslationClassNodeFactory;
|
||||
use Rector\Doctrine\ValueObject\PropertyNamesAndPhpDocInfos;
|
||||
use Rector\FileSystemRector\ValueObject\AddedFileWithNodes;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
|
@ -42,15 +42,15 @@ final class TranslationBehaviorRector extends \Rector\Core\Rector\AbstractRector
|
|||
*/
|
||||
private $translationClassNodeFactory;
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover
|
||||
* @var \Rector\Doctrine\NodeAnalyzer\TranslatablePropertyCollectorAndRemover
|
||||
*/
|
||||
private $phpDocTagRemover;
|
||||
public function __construct(\Rector\Core\NodeManipulator\ClassInsertManipulator $classInsertManipulator, \Rector\Core\NodeManipulator\ClassManipulator $classManipulator, \Rector\Doctrine\NodeFactory\TranslationClassNodeFactory $translationClassNodeFactory, \Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover $phpDocTagRemover)
|
||||
private $translatablePropertyCollectorAndRemover;
|
||||
public function __construct(\Rector\Core\NodeManipulator\ClassInsertManipulator $classInsertManipulator, \Rector\Core\NodeManipulator\ClassManipulator $classManipulator, \Rector\Doctrine\NodeFactory\TranslationClassNodeFactory $translationClassNodeFactory, \Rector\Doctrine\NodeAnalyzer\TranslatablePropertyCollectorAndRemover $translatablePropertyCollectorAndRemover)
|
||||
{
|
||||
$this->classInsertManipulator = $classInsertManipulator;
|
||||
$this->classManipulator = $classManipulator;
|
||||
$this->translationClassNodeFactory = $translationClassNodeFactory;
|
||||
$this->phpDocTagRemover = $phpDocTagRemover;
|
||||
$this->translatablePropertyCollectorAndRemover = $translatablePropertyCollectorAndRemover;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
|
@ -70,12 +70,6 @@ class Article implements Translatable
|
|||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @Gedmo\Translatable
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
private $content;
|
||||
|
||||
/**
|
||||
* @Gedmo\Locale
|
||||
*/
|
||||
|
@ -91,16 +85,6 @@ class Article implements Translatable
|
|||
return $this->title;
|
||||
}
|
||||
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
public function setTranslatableLocale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
@ -128,11 +112,6 @@ class SomeClassTranslation implements TranslationInterface
|
|||
* @ORM\Column(length=128)
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
private $content;
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
|
@ -157,35 +136,11 @@ CODE_SAMPLE
|
|||
$this->classManipulator->removeInterface($node, 'Gedmo\\Translatable\\Translatable');
|
||||
$this->classInsertManipulator->addAsFirstTrait($node, 'Knp\\DoctrineBehaviors\\Model\\Translatable\\TranslatableTrait');
|
||||
$node->implements[] = new \PhpParser\Node\Name\FullyQualified('Knp\\DoctrineBehaviors\\Contract\\Entity\\TranslatableInterface');
|
||||
$removedPropertyNameToPhpDocInfo = $this->collectAndRemoveTranslatableProperties($node);
|
||||
$removePropertyNames = \array_keys($removedPropertyNameToPhpDocInfo);
|
||||
$this->removeSetAndGetMethods($node, $removePropertyNames);
|
||||
$this->dumpEntityTranslation($node, $removedPropertyNameToPhpDocInfo);
|
||||
$propertyNamesAndPhpDocInfos = $this->translatablePropertyCollectorAndRemover->processClass($node);
|
||||
$this->removeSetAndGetMethods($node, $propertyNamesAndPhpDocInfos->getPropertyNames());
|
||||
$this->dumpEntityTranslation($node, $propertyNamesAndPhpDocInfos);
|
||||
return $node;
|
||||
}
|
||||
/**
|
||||
* @return array<string, PhpDocInfo>
|
||||
*/
|
||||
private function collectAndRemoveTranslatableProperties(\PhpParser\Node\Stmt\Class_ $class) : array
|
||||
{
|
||||
$removedPropertyNameToPhpDocInfo = [];
|
||||
foreach ($class->getProperties() as $property) {
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
if ($phpDocInfo->hasByAnnotationClass('Gedmo\\Mapping\\Annotation\\Locale')) {
|
||||
$this->removeNode($property);
|
||||
continue;
|
||||
}
|
||||
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Gedmo\\Mapping\\Annotation\\Translatable');
|
||||
if (!$doctrineAnnotationTagValueNode) {
|
||||
continue;
|
||||
}
|
||||
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $doctrineAnnotationTagValueNode);
|
||||
$propertyName = $this->getName($property);
|
||||
$removedPropertyNameToPhpDocInfo[$propertyName] = $phpDocInfo;
|
||||
$this->removeNode($property);
|
||||
}
|
||||
return $removedPropertyNameToPhpDocInfo;
|
||||
}
|
||||
/**
|
||||
* @param string[] $removedPropertyNames
|
||||
*/
|
||||
|
@ -205,10 +160,7 @@ CODE_SAMPLE
|
|||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param PhpDocInfo[] $translatedPropertyToPhpDocInfos
|
||||
*/
|
||||
private function dumpEntityTranslation(\PhpParser\Node\Stmt\Class_ $class, array $translatedPropertyToPhpDocInfos) : void
|
||||
private function dumpEntityTranslation(\PhpParser\Node\Stmt\Class_ $class, \Rector\Doctrine\ValueObject\PropertyNamesAndPhpDocInfos $propertyNamesAndPhpDocInfos) : void
|
||||
{
|
||||
$fileInfo = $this->file->getSmartFileInfo();
|
||||
$classShortName = $class->name . 'Translation';
|
||||
|
@ -219,9 +171,9 @@ CODE_SAMPLE
|
|||
}
|
||||
$namespace = new \PhpParser\Node\Stmt\Namespace_($namespace->name);
|
||||
$class = $this->translationClassNodeFactory->create($classShortName);
|
||||
foreach ($translatedPropertyToPhpDocInfos as $translatedPropertyName => $translatedPhpDocInfo) {
|
||||
$property = $this->nodeFactory->createPrivateProperty($translatedPropertyName);
|
||||
$property->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, $translatedPhpDocInfo);
|
||||
foreach ($propertyNamesAndPhpDocInfos->all() as $propertyNameAndPhpDocInfo) {
|
||||
$property = $this->nodeFactory->createPrivateProperty($propertyNameAndPhpDocInfo->getPropertyName());
|
||||
$property->setAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO, $propertyNameAndPhpDocInfo->getPhpDocInfo());
|
||||
$class->stmts[] = $property;
|
||||
}
|
||||
$namespace->stmts[] = $class;
|
||||
|
|
40
vendor/rector/rector-doctrine/src/ValueObject/AssignToPropertyFetch.php
vendored
Normal file
40
vendor/rector/rector-doctrine/src/ValueObject/AssignToPropertyFetch.php
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\ValueObject;
|
||||
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
final class AssignToPropertyFetch
|
||||
{
|
||||
/**
|
||||
* @var \PhpParser\Node\Expr\Assign
|
||||
*/
|
||||
private $assign;
|
||||
/**
|
||||
* @var \PhpParser\Node\Expr\PropertyFetch
|
||||
*/
|
||||
private $propertyFetch;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $propertyName;
|
||||
public function __construct(\PhpParser\Node\Expr\Assign $assign, \PhpParser\Node\Expr\PropertyFetch $propertyFetch, string $propertyName)
|
||||
{
|
||||
$this->assign = $assign;
|
||||
$this->propertyFetch = $propertyFetch;
|
||||
$this->propertyName = $propertyName;
|
||||
}
|
||||
public function getAssign() : \PhpParser\Node\Expr\Assign
|
||||
{
|
||||
return $this->assign;
|
||||
}
|
||||
public function getPropertyFetch() : \PhpParser\Node\Expr\PropertyFetch
|
||||
{
|
||||
return $this->propertyFetch;
|
||||
}
|
||||
public function getPropertyName() : string
|
||||
{
|
||||
return $this->propertyName;
|
||||
}
|
||||
}
|
39
vendor/rector/rector-doctrine/src/ValueObject/OptionalAndRequiredParamNames.php
vendored
Normal file
39
vendor/rector/rector-doctrine/src/ValueObject/OptionalAndRequiredParamNames.php
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\ValueObject;
|
||||
|
||||
final class OptionalAndRequiredParamNames
|
||||
{
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $optionalParamNames;
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $requiredParamNames;
|
||||
/**
|
||||
* @param string[] $optionalParamNames
|
||||
* @param string[] $requiredParamNames
|
||||
*/
|
||||
public function __construct(array $optionalParamNames, array $requiredParamNames)
|
||||
{
|
||||
$this->optionalParamNames = $optionalParamNames;
|
||||
$this->requiredParamNames = $requiredParamNames;
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getOptionalParamNames() : array
|
||||
{
|
||||
return $this->optionalParamNames;
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getRequiredParamNames() : array
|
||||
{
|
||||
return $this->requiredParamNames;
|
||||
}
|
||||
}
|
30
vendor/rector/rector-doctrine/src/ValueObject/PropertyNameAndPhpDocInfo.php
vendored
Normal file
30
vendor/rector/rector-doctrine/src/ValueObject/PropertyNameAndPhpDocInfo.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\ValueObject;
|
||||
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
final class PropertyNameAndPhpDocInfo
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $propertyName;
|
||||
/**
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
|
||||
*/
|
||||
private $phpDocInfos;
|
||||
public function __construct(string $propertyName, \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo $phpDocInfos)
|
||||
{
|
||||
$this->propertyName = $propertyName;
|
||||
$this->phpDocInfos = $phpDocInfos;
|
||||
}
|
||||
public function getPropertyName() : string
|
||||
{
|
||||
return $this->propertyName;
|
||||
}
|
||||
public function getPhpDocInfo() : \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo
|
||||
{
|
||||
return $this->phpDocInfos;
|
||||
}
|
||||
}
|
49
vendor/rector/rector-doctrine/src/ValueObject/PropertyNamesAndPhpDocInfos.php
vendored
Normal file
49
vendor/rector/rector-doctrine/src/ValueObject/PropertyNamesAndPhpDocInfos.php
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\ValueObject;
|
||||
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
final class PropertyNamesAndPhpDocInfos
|
||||
{
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $propertyNameAndPhpDocInfos;
|
||||
/**
|
||||
* @param PropertyNameAndPhpDocInfo[] $propertyNameAndPhpDocInfos
|
||||
*/
|
||||
public function __construct(array $propertyNameAndPhpDocInfos)
|
||||
{
|
||||
$this->propertyNameAndPhpDocInfos = $propertyNameAndPhpDocInfos;
|
||||
}
|
||||
/**
|
||||
* @return PhpDocInfo[]
|
||||
*/
|
||||
public function getPhpDocInfos() : array
|
||||
{
|
||||
$phpDocInfos = [];
|
||||
foreach ($this->propertyNameAndPhpDocInfos as $propertyNameAndPhpDocInfo) {
|
||||
$phpDocInfos[] = $propertyNameAndPhpDocInfo->getPhpDocInfo();
|
||||
}
|
||||
return $phpDocInfos;
|
||||
}
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPropertyNames() : array
|
||||
{
|
||||
$propertyNames = [];
|
||||
foreach ($this->propertyNameAndPhpDocInfos as $propertyNameAndPhpDocInfo) {
|
||||
$propertyNames[] = $propertyNameAndPhpDocInfo->getPropertyName();
|
||||
}
|
||||
return $propertyNames;
|
||||
}
|
||||
/**
|
||||
* @return PropertyNameAndPhpDocInfo[]
|
||||
*/
|
||||
public function all() : array
|
||||
{
|
||||
return $this->propertyNameAndPhpDocInfos;
|
||||
}
|
||||
}
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
|
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
|||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210615\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613', false) && !interface_exists('ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613', false) && !trait_exists('ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613', false)) {
|
||||
spl_autoload_call('RectorPrefix20210615\ComposerAutoloaderInit8b11201017e5626a81ab44a9e5eec613');
|
||||
if (!class_exists('ComposerAutoloaderInit2e644cbe0c61a4efff797ceb4745adab', false) && !interface_exists('ComposerAutoloaderInit2e644cbe0c61a4efff797ceb4745adab', false) && !trait_exists('ComposerAutoloaderInit2e644cbe0c61a4efff797ceb4745adab', false)) {
|
||||
spl_autoload_call('RectorPrefix20210615\ComposerAutoloaderInit2e644cbe0c61a4efff797ceb4745adab');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210615\Doctrine\Inflector\Inflector');
|
||||
|
@ -3323,9 +3323,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210615\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire8b11201017e5626a81ab44a9e5eec613')) {
|
||||
function composerRequire8b11201017e5626a81ab44a9e5eec613() {
|
||||
return \RectorPrefix20210615\composerRequire8b11201017e5626a81ab44a9e5eec613(...func_get_args());
|
||||
if (!function_exists('composerRequire2e644cbe0c61a4efff797ceb4745adab')) {
|
||||
function composerRequire2e644cbe0c61a4efff797ceb4745adab() {
|
||||
return \RectorPrefix20210615\composerRequire2e644cbe0c61a4efff797ceb4745adab(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user