Skip to content

Commit 0cb5e11

Browse files
committed
Updated Rector to commit ba8614a8d2f09f3baf3c7ef930c0e26eb68e30d0
rectorphp/rector-src@ba8614a [CodeQuality] Skip ArrayDimFetch on IssetOnPropertyObjectToPropertyExistsRector (#6862)
1 parent 3801403 commit 0cb5e11

7 files changed

Lines changed: 37 additions & 25 deletions

File tree

vendor/composer/installed.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,12 +1687,12 @@
16871687
"source": {
16881688
"type": "git",
16891689
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
1690-
"reference": "c9233892e967e8574144f6f6d0e62b3d62da2269"
1690+
"reference": "c2dac7bdb10f6e0a40738924362cb2095a01f690"
16911691
},
16921692
"dist": {
16931693
"type": "zip",
1694-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/c9233892e967e8574144f6f6d0e62b3d62da2269",
1695-
"reference": "c9233892e967e8574144f6f6d0e62b3d62da2269",
1694+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/c2dac7bdb10f6e0a40738924362cb2095a01f690",
1695+
"reference": "c2dac7bdb10f6e0a40738924362cb2095a01f690",
16961696
"shasum": ""
16971697
},
16981698
"require": {
@@ -1702,20 +1702,20 @@
17021702
"require-dev": {
17031703
"doctrine\/doctrine-bundle": "^2.13",
17041704
"doctrine\/orm": "^2.20",
1705+
"phpecs\/phpecs": "^2.1",
17051706
"phpstan\/extension-installer": "^1.4",
17061707
"phpstan\/phpstan": "^2.1.8",
17071708
"phpstan\/phpstan-deprecation-rules": "^2.0",
17081709
"phpstan\/phpstan-webmozart-assert": "^2.0",
17091710
"phpunit\/phpunit": "^11.5",
17101711
"rector\/rector-src": "dev-main",
17111712
"rector\/type-perfect": "^2.0",
1712-
"symplify\/easy-coding-standard": "^12.5",
17131713
"symplify\/phpstan-rules": "^14.0",
17141714
"symplify\/vendor-patches": "^11.3",
17151715
"tomasvotruba\/class-leak": "^2.0",
17161716
"tracy\/tracy": "^2.10"
17171717
},
1718-
"time": "2025-04-06T01:47:44+00:00",
1718+
"time": "2025-04-24T09:25:21+00:00",
17191719
"default-branch": true,
17201720
"type": "rector-extension",
17211721
"extra": {

vendor/composer/installed.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

vendor/rector/extension-installer/src/GeneratedConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
final class GeneratedConfig
1111
{
12-
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main c923389'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main a719629'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 6f67935'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 9a4e2c8'));
12+
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main c2dac7b'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main a719629'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main 6f67935'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 9a4e2c8'));
1313
private function __construct()
1414
{
1515
}

vendor/rector/rector-doctrine/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"phpunit\/phpunit": "^11.5",
1818
"rector\/rector-src": "dev-main",
1919
"rector\/type-perfect": "^2.0",
20-
"symplify\/easy-coding-standard": "^12.5",
20+
"phpecs\/phpecs": "^2.1",
2121
"symplify\/phpstan-rules": "^14.0",
2222
"symplify\/vendor-patches": "^11.3",
2323
"tomasvotruba\/class-leak": "^2.0",

vendor/rector/rector-doctrine/config/sets/doctrine-code-quality.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace RectorPrefix202504;
55

66
use Rector\Config\RectorConfig;
7+
use Rector\Doctrine\Bundle230\Rector\Class_\AddAnnotationToRepositoryRector;
78
use Rector\Doctrine\CodeQuality\Rector\Class_\ExplicitRelationCollectionRector;
89
use Rector\Doctrine\CodeQuality\Rector\Class_\MoveCurrentDateTimeDefaultInEntityToConstructorRector;
910
use Rector\Doctrine\CodeQuality\Rector\Class_\RemoveEmptyTableAttributeRector;
@@ -25,6 +26,8 @@
2526
TypedPropertyFromColumnTypeRector::class,
2627
TypedPropertyFromToOneRelationTypeRector::class,
2728
TypedPropertyFromToManyRelationTypeRector::class,
29+
// annotations generics
30+
AddAnnotationToRepositoryRector::class,
2831
]);
2932
$rectorConfig->ruleWithConfiguration(AttributeKeyToClassConstFetchRector::class, [new AttributeKeyToClassConstFetch('Doctrine\\ORM\\Mapping\\Column', 'type', 'Doctrine\\DBAL\\Types\\Types', ['array' => 'ARRAY', 'ascii_string' => 'ASCII_STRING', 'bigint' => 'BIGINT', 'binary' => 'BINARY', 'blob' => 'BLOB', 'boolean' => 'BOOLEAN', 'date' => 'DATE_MUTABLE', 'date_immutable' => 'DATE_IMMUTABLE', 'dateinterval' => 'DATEINTERVAL', 'datetime' => 'DATETIME_MUTABLE', 'datetime_immutable' => 'DATETIME_IMMUTABLE', 'datetimetz' => 'DATETIMETZ_MUTABLE', 'datetimetz_immutable' => 'DATETIMETZ_IMMUTABLE', 'decimal' => 'DECIMAL', 'float' => 'FLOAT', 'guid' => 'GUID', 'integer' => 'INTEGER', 'json' => 'JSON', 'object' => 'OBJECT', 'simple_array' => 'SIMPLE_ARRAY', 'smallint' => 'SMALLINT', 'string' => 'STRING', 'text' => 'TEXT', 'time' => 'TIME_MUTABLE', 'time_immutable' => 'TIME_IMMUTABLE'])]);
3033
};

vendor/rector/rector-doctrine/config/sets/doctrine-collection-22.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace RectorPrefix202504;
55

66
use Rector\Config\RectorConfig;
7+
use Rector\Doctrine\Collection22\Rector\CriteriaOrderingConstantsDeprecationRector;
78
return static function (RectorConfig $rectorConfig) : void {
8-
$rectorConfig->rules([\Rector\Doctrine\Collection22\Rector\CriteriaOrderingConstantsDeprecationRector::class]);
9+
$rectorConfig->rules([CriteriaOrderingConstantsDeprecationRector::class]);
910
};

vendor/rector/rector-doctrine/rules/Bundle230/Rector/Class_/AddAnnotationToRepositoryRector.php

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,27 @@
33
declare (strict_types=1);
44
namespace Rector\Doctrine\Bundle230\Rector\Class_;
55

6-
use PhpParser\Node\Name;
7-
use PhpParser\Node\Stmt\ClassMethod;
8-
use PhpParser\Node\Stmt\Expression;
9-
use PhpParser\Node\Expr\StaticCall;
10-
use PhpParser\Node\Identifier;
11-
use PhpParser\Node\Arg;
126
use PhpParser\Node;
7+
use PhpParser\Node\Arg;
138
use PhpParser\Node\Expr\ClassConstFetch;
9+
use PhpParser\Node\Expr\StaticCall;
10+
use PhpParser\Node\Name;
1411
use PhpParser\Node\Stmt\Class_;
12+
use PhpParser\Node\Stmt\ClassMethod;
13+
use PhpParser\Node\Stmt\Expression;
1514
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
1615
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
1716
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
1817
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
18+
use Rector\Doctrine\CodeQuality\Enum\DoctrineClass;
1919
use Rector\Rector\AbstractRector;
2020
use Rector\ValueObject\MethodName;
2121
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
2222
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
2323
/**
2424
* @see https://github.com/doctrine/DoctrineBundle/commit/2f12b5302bafac39c70b024e1686119be28b79ab
25+
*
26+
* @see \Rector\Doctrine\Tests\Bundle230\Rector\Class_\AddAnnotationToRepositoryRector\AddAnnotationToRepositoryRectorTest
2527
*/
2628
final class AddAnnotationToRepositoryRector extends AbstractRector
2729
{
@@ -41,6 +43,8 @@ public function __construct(DocBlockUpdater $docBlockUpdater, PhpDocInfoFactory
4143
public function getRuleDefinition() : RuleDefinition
4244
{
4345
return new RuleDefinition('Add @extends ServiceEntityRepository<T> annotation to repository classes', [new CodeSample(<<<'CODE_SAMPLE'
46+
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
47+
4448
final class SomeRepository extends ServiceEntityRepository
4549
{
4650
public function __construct(ManagerRegistry $registry)
@@ -50,7 +54,11 @@ public function __construct(ManagerRegistry $registry)
5054
}
5155
CODE_SAMPLE
5256
, <<<'CODE_SAMPLE'
53-
/** @extends \Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository<\SomeEntity> */
57+
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
58+
59+
/**
60+
* @extends ServiceEntityRepository<\SomeEntity>
61+
*/
5462
final class SomeRepository extends ServiceEntityRepository
5563
{
5664
public function __construct(ManagerRegistry $registry)
@@ -85,18 +93,18 @@ public function refactor(Node $node) : ?Node
8593
}
8694
private function isRepositoryClass(Class_ $class) : bool
8795
{
88-
if ($class->extends instanceof Name) {
89-
return $this->getName($class->extends) === 'Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository';
96+
if (!$class->extends instanceof Name) {
97+
return \false;
9098
}
91-
return \false;
99+
return $this->isName($class->extends, DoctrineClass::SERVICE_ENTITY_REPOSITORY);
92100
}
93101
private function getEntityClassFromConstructor(Class_ $class) : ?string
94102
{
95-
$method = $class->getMethod(MethodName::CONSTRUCT);
96-
if (!$method instanceof ClassMethod || $method->stmts === null) {
103+
$classMethod = $class->getMethod(MethodName::CONSTRUCT);
104+
if (!$classMethod instanceof ClassMethod || $classMethod->stmts === null) {
97105
return null;
98106
}
99-
foreach ($method->stmts as $stmt) {
107+
foreach ($classMethod->stmts as $stmt) {
100108
if (!$stmt instanceof Expression) {
101109
continue;
102110
}
@@ -119,8 +127,8 @@ private function getEntityClassFromConstructor(Class_ $class) : ?string
119127
private function addAnnotationToNode(Class_ $class, string $entityClass) : void
120128
{
121129
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($class);
122-
$annotation = \sprintf('\\Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository<\\%s>', $entityClass);
123-
$phpDocInfo->addPhpDocTagNode(new PhpDocTagNode('@extends', new GenericTagValueNode($annotation)));
130+
$genericsAnnotation = \sprintf('\\%s<\\%s>', DoctrineClass::SERVICE_ENTITY_REPOSITORY, $entityClass);
131+
$phpDocInfo->addPhpDocTagNode(new PhpDocTagNode('@extends', new GenericTagValueNode($genericsAnnotation)));
124132
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($class);
125133
}
126134
private function hasExtendsAnnotation(Class_ $class) : bool
@@ -129,6 +137,6 @@ private function hasExtendsAnnotation(Class_ $class) : bool
129137
}
130138
private function isParentConstructorCall(StaticCall $staticCall) : bool
131139
{
132-
return $staticCall->class instanceof Name && $staticCall->class->toString() === 'parent' && $staticCall->name instanceof Identifier && $staticCall->name->toString() === '__construct' && isset($staticCall->args[1]) && $staticCall->args[1] instanceof Arg && $staticCall->args[1]->value instanceof ClassConstFetch;
140+
return $this->isName($staticCall->class, 'parent') && $this->isName($staticCall->name, '__construct') && isset($staticCall->args[1]) && $staticCall->args[1] instanceof Arg && $staticCall->args[1]->value instanceof ClassConstFetch;
133141
}
134142
}

0 commit comments

Comments
 (0)