Skip to content

Commit

Permalink
Updated Rector to commit defd57b99b2f442199c6d4c63357e786d514253b
Browse files Browse the repository at this point in the history
rectorphp/rector-src@defd57b Move betterNodeFinder,valueResolver,phpDocInfoFactory dependencies from AbstractRector into rules (#5071)
  • Loading branch information
TomasVotruba committed Sep 23, 2023
1 parent fa675a2 commit 718b62b
Show file tree
Hide file tree
Showing 68 changed files with 564 additions and 85 deletions.
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitf75a591f23702408f442b7ec3df1c88f::getLoader();
return ComposerAutoloaderInitd407e2f3f81a0d536d980ea7b859f5cd::getLoader();
10 changes: 5 additions & 5 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitf75a591f23702408f442b7ec3df1c88f
class ComposerAutoloaderInitd407e2f3f81a0d536d980ea7b859f5cd
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInitf75a591f23702408f442b7ec3df1c88f', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitd407e2f3f81a0d536d980ea7b859f5cd', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitf75a591f23702408f442b7ec3df1c88f', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitd407e2f3f81a0d536d980ea7b859f5cd', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitf75a591f23702408f442b7ec3df1c88f::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitd407e2f3f81a0d536d980ea7b859f5cd::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);

$filesToLoad = \Composer\Autoload\ComposerStaticInitf75a591f23702408f442b7ec3df1c88f::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitd407e2f3f81a0d536d980ea7b859f5cd::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInitf75a591f23702408f442b7ec3df1c88f
class ComposerStaticInitd407e2f3f81a0d536d980ea7b859f5cd
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -2601,9 +2601,9 @@ class ComposerStaticInitf75a591f23702408f442b7ec3df1c88f
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitf75a591f23702408f442b7ec3df1c88f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf75a591f23702408f442b7ec3df1c88f::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf75a591f23702408f442b7ec3df1c88f::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitd407e2f3f81a0d536d980ea7b859f5cd::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd407e2f3f81a0d536d980ea7b859f5cd::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitd407e2f3f81a0d536d980ea7b859f5cd::$classMap;

}, null, ClassLoader::class);
}
Expand Down
24 changes: 12 additions & 12 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -1744,12 +1744,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
"reference": "4b2518028cc5bf9266a9069b1f3e287d62a0012d"
"reference": "3596bbff47c4018c0987533cb651fce7cd0b71a4"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/4b2518028cc5bf9266a9069b1f3e287d62a0012d",
"reference": "4b2518028cc5bf9266a9069b1f3e287d62a0012d",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/3596bbff47c4018c0987533cb651fce7cd0b71a4",
"reference": "3596bbff47c4018c0987533cb651fce7cd0b71a4",
"shasum": ""
},
"require": {
Expand All @@ -1775,7 +1775,7 @@
"tomasvotruba\/type-coverage": "^0.2",
"tomasvotruba\/unused-public": "^0.3"
},
"time": "2023-09-15T19:02:03+00:00",
"time": "2023-09-23T12:28:10+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
Expand Down Expand Up @@ -1808,12 +1808,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "2b2a7cd5587c0ee5199804fffd7c99b5b5b5d076"
"reference": "e1b3dabae161de1764cc7fdc199463661d4059c6"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/2b2a7cd5587c0ee5199804fffd7c99b5b5b5d076",
"reference": "2b2a7cd5587c0ee5199804fffd7c99b5b5b5d076",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/e1b3dabae161de1764cc7fdc199463661d4059c6",
"reference": "e1b3dabae161de1764cc7fdc199463661d4059c6",
"shasum": ""
},
"require": {
Expand All @@ -1840,7 +1840,7 @@
"tomasvotruba\/unused-public": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2023-09-21T09:52:02+00:00",
"time": "2023-09-23T12:29:20+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
Expand Down Expand Up @@ -1944,12 +1944,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "ddc8baa2c3e3edb81b34dbeec43d2206edeaadf3"
"reference": "b63fcb21a69b696165deed299530162670283e25"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/ddc8baa2c3e3edb81b34dbeec43d2206edeaadf3",
"reference": "ddc8baa2c3e3edb81b34dbeec43d2206edeaadf3",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/b63fcb21a69b696165deed299530162670283e25",
"reference": "b63fcb21a69b696165deed299530162670283e25",
"shasum": ""
},
"require": {
Expand Down Expand Up @@ -1982,7 +1982,7 @@
"tomasvotruba\/unused-public": "^0.2",
"tracy\/tracy": "^2.10"
},
"time": "2023-09-22T12:14:37+00:00",
"time": "2023-09-23T12:20:24+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion vendor/composer/installed.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/rector/extension-installer/src/GeneratedConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 4b25180'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 2b2a7cd'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 0fe343a'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main ddc8baa'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main 3596bbf'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main e1b3dab'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 0fe343a'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main b63fcb2'));
private function __construct()
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\Rector\AbstractRector;
use Rector\Doctrine\NodeAnalyzer\SetterClassMethodAnalyzer;
use Rector\Doctrine\PhpDocParser\DoctrineDocBlockResolver;
Expand All @@ -34,10 +35,16 @@ final class MakeEntitySetterNullabilityInSyncWithPropertyRector extends Abstract
* @var \Rector\Doctrine\PhpDocParser\DoctrineDocBlockResolver
*/
private $doctrineDocBlockResolver;
public function __construct(SetterClassMethodAnalyzer $setterClassMethodAnalyzer, DoctrineDocBlockResolver $doctrineDocBlockResolver)
/**
* @readonly
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
*/
private $phpDocInfoFactory;
public function __construct(SetterClassMethodAnalyzer $setterClassMethodAnalyzer, DoctrineDocBlockResolver $doctrineDocBlockResolver, PhpDocInfoFactory $phpDocInfoFactory)
{
$this->setterClassMethodAnalyzer = $setterClassMethodAnalyzer;
$this->doctrineDocBlockResolver = $doctrineDocBlockResolver;
$this->phpDocInfoFactory = $phpDocInfoFactory;
}
public function getRuleDefinition() : RuleDefinition
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\MethodName;
use Rector\Doctrine\NodeAnalyzer\ConstructorAssignPropertyAnalyzer;
Expand Down Expand Up @@ -49,16 +51,28 @@ final class MoveCurrentDateTimeDefaultInEntityToConstructorRector extends Abstra
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
*/
private $docBlockUpdater;
/**
* @readonly
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
*/
private $phpDocInfoFactory;
/**
* @readonly
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
*/
private $valueResolver;
/**
* @var bool
*/
private $hasChanged = \false;
public function __construct(ConstructorManipulator $constructorManipulator, ValueAssignFactory $valueAssignFactory, ConstructorAssignPropertyAnalyzer $constructorAssignPropertyAnalyzer, DocBlockUpdater $docBlockUpdater)
public function __construct(ConstructorManipulator $constructorManipulator, ValueAssignFactory $valueAssignFactory, ConstructorAssignPropertyAnalyzer $constructorAssignPropertyAnalyzer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory, ValueResolver $valueResolver)
{
$this->constructorManipulator = $constructorManipulator;
$this->valueAssignFactory = $valueAssignFactory;
$this->constructorAssignPropertyAnalyzer = $constructorAssignPropertyAnalyzer;
$this->docBlockUpdater = $docBlockUpdater;
$this->phpDocInfoFactory = $phpDocInfoFactory;
$this->valueResolver = $valueResolver;
}
public function getRuleDefinition() : RuleDefinition
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\Exception\NotImplementedYetException;
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
Expand All @@ -25,6 +27,21 @@
*/
final class CorrectDefaultTypesOnEntityPropertyRector extends AbstractRector
{
/**
* @readonly
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
*/
private $phpDocInfoFactory;
/**
* @readonly
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
*/
private $valueResolver;
public function __construct(PhpDocInfoFactory $phpDocInfoFactory, ValueResolver $valueResolver)
{
$this->phpDocInfoFactory = $phpDocInfoFactory;
$this->valueResolver = $valueResolver;
}
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Change default value types to match Doctrine annotation type', [new CodeSample(<<<'CODE_SAMPLE'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use PHPStan\Reflection\Php\PhpPropertyReflection;
use PHPStan\Type\Type;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
use Rector\Core\NodeManipulator\AssignManipulator;
use Rector\Core\Rector\AbstractRector;
Expand Down Expand Up @@ -75,7 +76,12 @@ final class ImproveDoctrineCollectionDocTypeInEntityRector extends AbstractRecto
* @var \Rector\Doctrine\NodeAnalyzer\TargetEntityResolver
*/
private $targetEntityResolver;
public function __construct(CollectionTypeFactory $collectionTypeFactory, AssignManipulator $assignManipulator, CollectionTypeResolver $collectionTypeResolver, CollectionVarTagValueNodeResolver $collectionVarTagValueNodeResolver, PhpDocTypeChanger $phpDocTypeChanger, DoctrineDocBlockResolver $doctrineDocBlockResolver, ReflectionResolver $reflectionResolver, AttributeFinder $attributeFinder, TargetEntityResolver $targetEntityResolver)
/**
* @readonly
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
*/
private $phpDocInfoFactory;
public function __construct(CollectionTypeFactory $collectionTypeFactory, AssignManipulator $assignManipulator, CollectionTypeResolver $collectionTypeResolver, CollectionVarTagValueNodeResolver $collectionVarTagValueNodeResolver, PhpDocTypeChanger $phpDocTypeChanger, DoctrineDocBlockResolver $doctrineDocBlockResolver, ReflectionResolver $reflectionResolver, AttributeFinder $attributeFinder, TargetEntityResolver $targetEntityResolver, PhpDocInfoFactory $phpDocInfoFactory)
{
$this->collectionTypeFactory = $collectionTypeFactory;
$this->assignManipulator = $assignManipulator;
Expand All @@ -86,6 +92,7 @@ public function __construct(CollectionTypeFactory $collectionTypeFactory, Assign
$this->reflectionResolver = $reflectionResolver;
$this->attributeFinder = $attributeFinder;
$this->targetEntityResolver = $targetEntityResolver;
$this->phpDocInfoFactory = $phpDocInfoFactory;
}
public function getRuleDefinition() : RuleDefinition
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use PHPStan\Type\TypeCombinator;
use PHPStan\Type\UnionType;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
use Rector\Core\Rector\AbstractRector;
use Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockClassRenamer;
Expand All @@ -33,10 +34,16 @@ final class MakeEntityDateTimePropertyDateTimeInterfaceRector extends AbstractRe
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
*/
private $docBlockUpdater;
public function __construct(DocBlockClassRenamer $docBlockClassRenamer, DocBlockUpdater $docBlockUpdater)
/**
* @readonly
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
*/
private $phpDocInfoFactory;
public function __construct(DocBlockClassRenamer $docBlockClassRenamer, DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory $phpDocInfoFactory)
{
$this->docBlockClassRenamer = $docBlockClassRenamer;
$this->docBlockUpdater = $docBlockUpdater;
$this->phpDocInfoFactory = $phpDocInfoFactory;
}
public function getRuleDefinition() : RuleDefinition
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use PhpParser\Node;
use PhpParser\Node\Attribute;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Property;
use Rector\Core\Rector\AbstractRector;
Expand Down Expand Up @@ -75,9 +74,6 @@ public function refactor(Node $node) : ?Node
if (!isset($nodeAttribute->args[0]->value->items[0])) {
return null;
}
if (!$nodeAttribute->args[0]->value->items[0] instanceof ArrayItem) {
return null;
}
if (!$nodeAttribute->args[0]->value->items[0]->value instanceof String_) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
use PHPStan\Type\UnionType;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\Doctrine\NodeManipulator\ColumnPropertyTypeResolver;
Expand Down Expand Up @@ -38,11 +39,17 @@ final class TypedPropertyFromColumnTypeRector extends AbstractRector implements
* @var \Rector\Doctrine\NodeManipulator\NullabilityColumnPropertyTypeResolver
*/
private $nullabilityColumnPropertyTypeResolver;
public function __construct(PropertyTypeDecorator $propertyTypeDecorator, ColumnPropertyTypeResolver $columnPropertyTypeResolver, NullabilityColumnPropertyTypeResolver $nullabilityColumnPropertyTypeResolver)
/**
* @readonly
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
*/
private $phpDocInfoFactory;
public function __construct(PropertyTypeDecorator $propertyTypeDecorator, ColumnPropertyTypeResolver $columnPropertyTypeResolver, NullabilityColumnPropertyTypeResolver $nullabilityColumnPropertyTypeResolver, PhpDocInfoFactory $phpDocInfoFactory)
{
$this->propertyTypeDecorator = $propertyTypeDecorator;
$this->columnPropertyTypeResolver = $columnPropertyTypeResolver;
$this->nullabilityColumnPropertyTypeResolver = $nullabilityColumnPropertyTypeResolver;
$this->phpDocInfoFactory = $phpDocInfoFactory;
}
public function getRuleDefinition() : RuleDefinition
{
Expand Down Expand Up @@ -95,7 +102,7 @@ public function refactor(Node $node) : ?\PhpParser\Node\Stmt\Property
$propertyType = TypeCombinator::addNull($propertyType);
}
$typeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($propertyType, TypeKind::PROPERTY);
if ($typeNode === null) {
if (!$typeNode instanceof Node) {
return null;
}
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
Expand Down
Loading

0 comments on commit 718b62b

Please sign in to comment.