mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-14 20:39:43 +01:00
Updated Rector to commit 2e80e00913eacfcfded3af426cc7691a58d7f886
2e80e00913
Refactor from PARENT_NODE in AddArrayDefaultToArrayPropertyRector (#3951)
This commit is contained in:
parent
06e1c20df4
commit
a1e2ba76d0
@ -18,7 +18,6 @@ use PHPStan\Type\Type;
|
||||
use Rector\CodingStyle\TypeAnalyzer\IterableTypeAnalyzer;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Privatization\NodeManipulator\VisibilityManipulator;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
@ -114,24 +113,22 @@ CODE_SAMPLE
|
||||
{
|
||||
$propertyNames = [];
|
||||
$this->traverseNodesWithCallable($class, function (Node $node) use(&$propertyNames) {
|
||||
if (!$node instanceof PropertyProperty) {
|
||||
if (!$node instanceof Property) {
|
||||
return null;
|
||||
}
|
||||
if ($node->default instanceof Expr) {
|
||||
return null;
|
||||
foreach ($node->props as $propertyProperty) {
|
||||
if ($propertyProperty->default instanceof Expr) {
|
||||
continue;
|
||||
}
|
||||
$varType = $this->resolveVarType($node);
|
||||
if (!$this->iterableTypeAnalyzer->detect($varType)) {
|
||||
continue;
|
||||
}
|
||||
if ($this->visibilityManipulator->isReadonly($node)) {
|
||||
return null;
|
||||
}
|
||||
$propertyNames[] = $this->getName($propertyProperty);
|
||||
}
|
||||
$varType = $this->resolveVarType($node);
|
||||
if (!$this->iterableTypeAnalyzer->detect($varType)) {
|
||||
return null;
|
||||
}
|
||||
$property = $node->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$property instanceof Property) {
|
||||
return null;
|
||||
}
|
||||
if ($this->visibilityManipulator->isReadonly($property)) {
|
||||
return null;
|
||||
}
|
||||
$propertyNames[] = $this->getName($node);
|
||||
return null;
|
||||
});
|
||||
return $propertyNames;
|
||||
@ -202,11 +199,9 @@ CODE_SAMPLE
|
||||
return $node;
|
||||
});
|
||||
}
|
||||
private function resolveVarType(PropertyProperty $propertyProperty) : Type
|
||||
private function resolveVarType(Property $property) : Type
|
||||
{
|
||||
/** @var Property $propertyNode */
|
||||
$propertyNode = $propertyProperty->getAttribute(AttributeKey::PARENT_NODE);
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($propertyNode);
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
return $phpDocInfo->getVarType();
|
||||
}
|
||||
/**
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '49561b6c81580ca995de4a8a00184f6935bec7db';
|
||||
public const PACKAGE_VERSION = '2e80e00913eacfcfded3af426cc7691a58d7f886';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-05-24 14:08:15';
|
||||
public const RELEASE_DATE = '2023-05-24 14:15:17';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
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 ComposerAutoloaderInit9b405a16759380d07fe795e47a593129::getLoader();
|
||||
return ComposerAutoloaderInitab5765415f46a737a2fd8351125e4dcd::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 ComposerAutoloaderInit9b405a16759380d07fe795e47a593129
|
||||
class ComposerAutoloaderInitab5765415f46a737a2fd8351125e4dcd
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit9b405a16759380d07fe795e47a593129
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit9b405a16759380d07fe795e47a593129', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitab5765415f46a737a2fd8351125e4dcd', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit9b405a16759380d07fe795e47a593129', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitab5765415f46a737a2fd8351125e4dcd', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit9b405a16759380d07fe795e47a593129::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitab5765415f46a737a2fd8351125e4dcd::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit9b405a16759380d07fe795e47a593129::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitab5765415f46a737a2fd8351125e4dcd::$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 ComposerStaticInit9b405a16759380d07fe795e47a593129
|
||||
class ComposerStaticInitab5765415f46a737a2fd8351125e4dcd
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3105,9 +3105,9 @@ class ComposerStaticInit9b405a16759380d07fe795e47a593129
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit9b405a16759380d07fe795e47a593129::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit9b405a16759380d07fe795e47a593129::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit9b405a16759380d07fe795e47a593129::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitab5765415f46a737a2fd8351125e4dcd::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitab5765415f46a737a2fd8351125e4dcd::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitab5765415f46a737a2fd8351125e4dcd::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user