mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit 385a9cb5f1235808c7226c2efccdc10fc6de6542
385a9cb5f1
[Php74] Skip parenthesize ternary if on ParenthesizeNestedTernaryRector (#3980)
This commit is contained in:
parent
3267b9499d
commit
c9d2c84bc5
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 ComposerAutoloaderInitf3ff8bd5431753ff80a266535761ae96::getLoader();
|
||||
return ComposerAutoloaderInit9576e7fea326dfc1163ee0d8beba050d::getLoader();
|
||||
|
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 ComposerAutoloaderInitf3ff8bd5431753ff80a266535761ae96
|
||||
class ComposerAutoloaderInit9576e7fea326dfc1163ee0d8beba050d
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInitf3ff8bd5431753ff80a266535761ae96
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitf3ff8bd5431753ff80a266535761ae96', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit9576e7fea326dfc1163ee0d8beba050d', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitf3ff8bd5431753ff80a266535761ae96', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit9576e7fea326dfc1163ee0d8beba050d', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitf3ff8bd5431753ff80a266535761ae96::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit9576e7fea326dfc1163ee0d8beba050d::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitf3ff8bd5431753ff80a266535761ae96::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit9576e7fea326dfc1163ee0d8beba050d::$files;
|
||||
$requireFile = \Closure::bind(static function ($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 ComposerStaticInitf3ff8bd5431753ff80a266535761ae96
|
||||
class ComposerStaticInit9576e7fea326dfc1163ee0d8beba050d
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3089,9 +3089,9 @@ class ComposerStaticInitf3ff8bd5431753ff80a266535761ae96
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitf3ff8bd5431753ff80a266535761ae96::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitf3ff8bd5431753ff80a266535761ae96::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitf3ff8bd5431753ff80a266535761ae96::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit9576e7fea326dfc1163ee0d8beba050d::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit9576e7fea326dfc1163ee0d8beba050d::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit9576e7fea326dfc1163ee0d8beba050d::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
16
vendor/composer/installed.json
vendored
16
vendor/composer/installed.json
vendored
@ -1855,12 +1855,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "259706aac417538825c38414993cea7f880d4922"
|
||||
"reference": "bc6805cc485416b82f0e6fb09f815f07e083f8ba"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/259706aac417538825c38414993cea7f880d4922",
|
||||
"reference": "259706aac417538825c38414993cea7f880d4922",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/bc6805cc485416b82f0e6fb09f815f07e083f8ba",
|
||||
"reference": "bc6805cc485416b82f0e6fb09f815f07e083f8ba",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1887,7 +1887,7 @@
|
||||
"symplify\/rule-doc-generator": "^11.1",
|
||||
"symplify\/vendor-patches": "^11.1"
|
||||
},
|
||||
"time": "2023-05-24T18:36:26+00:00",
|
||||
"time": "2023-05-26T23:58:12+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
@ -2064,12 +2064,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
|
||||
"reference": "3fa995c7677b2ea654e17dc96cfed1a9ed83732b"
|
||||
"reference": "3878c8837ef2ca76b58601a3132f7da9ae87c044"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/3fa995c7677b2ea654e17dc96cfed1a9ed83732b",
|
||||
"reference": "3fa995c7677b2ea654e17dc96cfed1a9ed83732b",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/3878c8837ef2ca76b58601a3132f7da9ae87c044",
|
||||
"reference": "3878c8837ef2ca76b58601a3132f7da9ae87c044",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2099,7 +2099,7 @@
|
||||
"tomasvotruba\/type-coverage": "^0.0.9",
|
||||
"tomasvotruba\/unused-public": "^0.0.34"
|
||||
},
|
||||
"time": "2023-05-19T19:57:51+00:00",
|
||||
"time": "2023-05-26T23:58:27+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' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 259706a'), '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 79bc835'), '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 fdbe413'), '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 3fa995c'));
|
||||
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' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bc6805c'), '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 79bc835'), '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 fdbe413'), '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 3878c88'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
@ -104,8 +104,8 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
$manyToOneAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Doctrine\\ORM\\Mapping\\ManyToOne');
|
||||
if (!$manyToOneAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
$doctrineAnnotationTagValueNode = $phpDocInfo->getByAnnotationClass('Doctrine\\ORM\\Mapping\\ManyToOne');
|
||||
if (!$doctrineAnnotationTagValueNode instanceof DoctrineAnnotationTagValueNode) {
|
||||
return null;
|
||||
}
|
||||
$param = $node->params[0];
|
||||
|
@ -5,11 +5,9 @@ namespace Rector\Doctrine\Rector\Param;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
@ -50,32 +48,38 @@ CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node\Param>>
|
||||
* @return array<class-string<ClassMethod>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [Param::class];
|
||||
return [ClassMethod::class];
|
||||
}
|
||||
/**
|
||||
* @param Node\Param $node
|
||||
* @param ClassMethod $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if (!$this->isObjectType($node, new ObjectType('Doctrine\\ORM\\Event\\LifecycleEventArgs'))) {
|
||||
if ($node->params === []) {
|
||||
return null;
|
||||
}
|
||||
if ($this->isObjectType($node, new ObjectType('Doctrine\\ORM\\Event\\PrePersistEventArgs')) || $this->isObjectType($node, new ObjectType('Doctrine\\ORM\\Event\\PreUpdateEventArgs')) || $this->isObjectType($node, new ObjectType('Doctrine\\ORM\\Event\\PreRemoveEventArgs')) || $this->isObjectType($node, new ObjectType('Doctrine\\ORM\\Event\\PostPersistEventArgs')) || $this->isObjectType($node, new ObjectType('Doctrine\\ORM\\Event\\PostUpdateEventArgs')) || $this->isObjectType($node, new ObjectType('Doctrine\\ORM\\Event\\PostRemoveEventArgs')) || $this->isObjectType($node, new ObjectType('Doctrine\\ORM\\Event\\PostLoadEventArgs'))) {
|
||||
return null;
|
||||
$hasChanged = \false;
|
||||
foreach ($node->params as $param) {
|
||||
if (!$this->isObjectType($param, new ObjectType('Doctrine\\ORM\\Event\\LifecycleEventArgs'))) {
|
||||
continue;
|
||||
}
|
||||
if ($this->isObjectType($param, new ObjectType('Doctrine\\ORM\\Event\\PrePersistEventArgs')) || $this->isObjectType($param, new ObjectType('Doctrine\\ORM\\Event\\PreUpdateEventArgs')) || $this->isObjectType($param, new ObjectType('Doctrine\\ORM\\Event\\PreRemoveEventArgs')) || $this->isObjectType($param, new ObjectType('Doctrine\\ORM\\Event\\PostPersistEventArgs')) || $this->isObjectType($param, new ObjectType('Doctrine\\ORM\\Event\\PostUpdateEventArgs')) || $this->isObjectType($param, new ObjectType('Doctrine\\ORM\\Event\\PostRemoveEventArgs')) || $this->isObjectType($param, new ObjectType('Doctrine\\ORM\\Event\\PostLoadEventArgs'))) {
|
||||
continue;
|
||||
}
|
||||
$eventClass = self::EVENT_CLASSES[$node->name->name] ?? null;
|
||||
if ($eventClass === null) {
|
||||
continue;
|
||||
}
|
||||
$param->type = new FullyQualified($eventClass);
|
||||
$hasChanged = \true;
|
||||
}
|
||||
$classMethod = $node->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$classMethod instanceof ClassMethod) {
|
||||
return null;
|
||||
if ($hasChanged) {
|
||||
return $node;
|
||||
}
|
||||
$eventClass = self::EVENT_CLASSES[$classMethod->name->name] ?? null;
|
||||
if ($eventClass === null) {
|
||||
return null;
|
||||
}
|
||||
$node->type = new FullyQualified($eventClass);
|
||||
return $node;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use PhpParser\NodeTraverser;
|
||||
use Rector\Core\PhpParser\Node\NodeFactory;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
final class OnSuccessLogoutClassMethodFactory
|
||||
{
|
||||
@ -80,17 +80,16 @@ final class OnSuccessLogoutClassMethodFactory
|
||||
}
|
||||
private function replaceRequestWithGetRequest(ClassMethod $classMethod) : void
|
||||
{
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($classMethod, function (Node $node) : ?MethodCall {
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($classMethod, function (Node $node) {
|
||||
if ($node instanceof Param) {
|
||||
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
|
||||
}
|
||||
if (!$node instanceof Variable) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->nodeNameResolver->isName($node, 'request')) {
|
||||
return null;
|
||||
}
|
||||
$parent = $node->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if ($parent instanceof Param) {
|
||||
return null;
|
||||
}
|
||||
return new MethodCall(new Variable(self::LOGOUT_EVENT), 'getRequest');
|
||||
});
|
||||
}
|
||||
|
@ -70,9 +70,9 @@ final class NeighbourClassLikePrinter
|
||||
*/
|
||||
private function resolveDeclares($mainNode) : array
|
||||
{
|
||||
$node = $this->betterNodeFinder->findFirstPreviousOfTypes($mainNode, [Declare_::class]);
|
||||
if ($node instanceof Declare_) {
|
||||
return [$node];
|
||||
$declare = $this->betterNodeFinder->findFirstPreviousOfTypes($mainNode, [Declare_::class]);
|
||||
if ($declare instanceof Declare_) {
|
||||
return [$declare];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
@ -135,8 +135,8 @@ CODE_SAMPLE
|
||||
$arrayItemNodes[] = new ArrayItemNode($symfonyRouteMetadata->getPath(), 'path', String_::KIND_DOUBLE_QUOTED);
|
||||
$arrayItemNodes[] = new ArrayItemNode($symfonyRouteMetadata->getName(), 'name', String_::KIND_DOUBLE_QUOTED);
|
||||
if ($symfonyRouteMetadata->getRequirements() !== []) {
|
||||
$requriementsCurlyList = $this->createCurlyQuoted($symfonyRouteMetadata->getRequirements());
|
||||
$arrayItemNodes[] = new ArrayItemNode($requriementsCurlyList, 'requirements');
|
||||
$curlyListNode = $this->createCurlyQuoted($symfonyRouteMetadata->getRequirements());
|
||||
$arrayItemNodes[] = new ArrayItemNode($curlyListNode, 'requirements');
|
||||
}
|
||||
$optionsWithoutDefaultCompilerClass = $symfonyRouteMetadata->getOptionsWithoutDefaultCompilerClass();
|
||||
if ($optionsWithoutDefaultCompilerClass !== []) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user