mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-10 13:12:23 +00:00
Updated Rector to commit 58a577c5b3d34cc70ba6ea713e7a6c7bbe66354e
58a577c5b3
[automated] Re-Generate Nodes/Rectors Documentation (#2845)
This commit is contained in:
parent
28e29c8294
commit
41129d129c
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5::getLoader();
|
||||
return ComposerAutoloaderInitfdb93740501731efe70b8ac8c10612a1::getLoader();
|
||||
|
|
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 ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5
|
||||
class ComposerAutoloaderInitfdb93740501731efe70b8ac8c10612a1
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,19 +22,19 @@ class ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitfdb93740501731efe70b8ac8c10612a1', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitfdb93740501731efe70b8ac8c10612a1', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitfdb93740501731efe70b8ac8c10612a1::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInitfdb93740501731efe70b8ac8c10612a1::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire691a01fbc08087d9f951d4371ba1e2b5($fileIdentifier, $file);
|
||||
composerRequirefdb93740501731efe70b8ac8c10612a1($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -46,7 +46,7 @@ class ComposerAutoloaderInit691a01fbc08087d9f951d4371ba1e2b5
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire691a01fbc08087d9f951d4371ba1e2b5($fileIdentifier, $file)
|
||||
function composerRequirefdb93740501731efe70b8ac8c10612a1($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5
|
||||
class ComposerStaticInitfdb93740501731efe70b8ac8c10612a1
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
|
@ -3256,9 +3256,9 @@ class ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit691a01fbc08087d9f951d4371ba1e2b5::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitfdb93740501731efe70b8ac8c10612a1::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitfdb93740501731efe70b8ac8c10612a1::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitfdb93740501731efe70b8ac8c10612a1::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
10
vendor/composer/installed.json
vendored
10
vendor/composer/installed.json
vendored
|
@ -1853,12 +1853,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "e3ad69fb3bf2445faa73ce98780cdb797bd91ea4"
|
||||
"reference": "2eddc311bbdb20214dd629b17da3e751d7ca5ac7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/e3ad69fb3bf2445faa73ce98780cdb797bd91ea4",
|
||||
"reference": "e3ad69fb3bf2445faa73ce98780cdb797bd91ea4",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/2eddc311bbdb20214dd629b17da3e751d7ca5ac7",
|
||||
"reference": "2eddc311bbdb20214dd629b17da3e751d7ca5ac7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1883,7 +1883,7 @@
|
|||
"symplify\/rule-doc-generator": "^11.1",
|
||||
"symplify\/vendor-patches": "^11.1"
|
||||
},
|
||||
"time": "2022-08-24T09:39:28+00:00",
|
||||
"time": "2022-08-29T08:10:38+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
@ -1910,7 +1910,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.14.1"
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-doctrine\/tree\/main"
|
||||
},
|
||||
"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' => 'dev-main c2ec06c'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e3ad69f'), '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' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main efc7ddf'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 38440b9'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 20edb95'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3638a66'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 26e1dcb'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 66ecf4c'));
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c2ec06c'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2eddc31'), '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' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main efc7ddf'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 38440b9'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 20edb95'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 3638a66'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 26e1dcb'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 66ecf4c'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -4,9 +4,14 @@ declare (strict_types=1);
|
|||
namespace Rector\Doctrine\Rector\ClassMethod;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\ComplexType;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprFalseNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Doctrine\NodeAnalyzer\SetterClassMethodAnalyzer;
|
||||
use Rector\Doctrine\PhpDocParser\DoctrineDocBlockResolver;
|
||||
|
@ -46,6 +51,7 @@ class Product
|
|||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="AnotherEntity")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private $anotherEntity;
|
||||
|
||||
|
@ -65,6 +71,7 @@ class Product
|
|||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="AnotherEntity")
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private $anotherEntity;
|
||||
|
||||
|
@ -97,13 +104,46 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
if (!$phpDocInfo->hasByAnnotationClass('Doctrine\\ORM\\Mapping\\ManyToOne')) {
|
||||
$manyToOneAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Doctrine\\ORM\\Mapping\\ManyToOne');
|
||||
if (!$manyToOneAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
return null;
|
||||
}
|
||||
$param = $node->params[0];
|
||||
/** @var NullableType $paramType */
|
||||
$paramType = $param->type;
|
||||
$param->type = $paramType->type;
|
||||
if (!$this->isJoinColumnNullable($phpDocInfo)) {
|
||||
// remove nullable if has one
|
||||
if (!$paramType instanceof NullableType) {
|
||||
return null;
|
||||
}
|
||||
$param->type = $paramType->type;
|
||||
return $node;
|
||||
}
|
||||
// already nullable, lets skip it
|
||||
if ($paramType instanceof NullableType) {
|
||||
return null;
|
||||
}
|
||||
// we skip complex type as multiple or nullable already
|
||||
if ($paramType instanceof ComplexType) {
|
||||
return null;
|
||||
}
|
||||
// no type at all, there is nothing we can do
|
||||
if (!$paramType instanceof Node) {
|
||||
return null;
|
||||
}
|
||||
$param->type = new NullableType($paramType);
|
||||
return $node;
|
||||
}
|
||||
private function isJoinColumnNullable(PhpDocInfo $phpDocInfo) : bool
|
||||
{
|
||||
$joinColumnDoctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Doctrine\\ORM\\Mapping\\JoinColumn');
|
||||
if (!$joinColumnDoctrineAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
// no join column means the join is nullable
|
||||
return \true;
|
||||
}
|
||||
$arrayItemNode = $joinColumnDoctrineAnnotationTagValueNode->getValue('nullable');
|
||||
if (!$arrayItemNode instanceof ArrayItemNode) {
|
||||
return \true;
|
||||
}
|
||||
return !$arrayItemNode->value instanceof ConstExprFalseNode;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user