Skip to content

Commit 31d1a75

Browse files
committed
Updated Rector to commit 3be6fd7636ee24d82606f6166f94d8372fee800d
rectorphp/rector-src@3be6fd7 Clean up repetitive recursive call and flag on ArrayKeyFirstLastRector (#6889)
1 parent 3b6d9f5 commit 31d1a75

File tree

12 files changed

+71
-17
lines changed

12 files changed

+71
-17
lines changed

vendor/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,7 @@
15061506
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeStrStartsWithRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrStartsWithRector.php',
15071507
'Rector\\DowngradePhp80\\Rector\\FunctionLike\\DowngradeMixedTypeDeclarationRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeMixedTypeDeclarationRector.php',
15081508
'Rector\\DowngradePhp80\\Rector\\FunctionLike\\DowngradeUnionTypeDeclarationRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeUnionTypeDeclarationRector.php',
1509+
'Rector\\DowngradePhp80\\Rector\\Instanceof_\\DowngradeInstanceofStringableRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Instanceof_/DowngradeInstanceofStringableRector.php',
15091510
'Rector\\DowngradePhp80\\Rector\\Instanceof_\\DowngradePhp80ResourceReturnToObjectRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Instanceof_/DowngradePhp80ResourceReturnToObjectRector.php',
15101511
'Rector\\DowngradePhp80\\Rector\\MethodCall\\DowngradeNamedArgumentRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeNamedArgumentRector.php',
15111512
'Rector\\DowngradePhp80\\Rector\\MethodCall\\DowngradeReflectionClassGetConstantsFilterRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionClassGetConstantsFilterRector.php',

vendor/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,7 @@ class ComposerStaticInit505aae23228c95129299728105788b45
17251725
'Rector\\DowngradePhp80\\Rector\\FuncCall\\DowngradeStrStartsWithRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FuncCall/DowngradeStrStartsWithRector.php',
17261726
'Rector\\DowngradePhp80\\Rector\\FunctionLike\\DowngradeMixedTypeDeclarationRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeMixedTypeDeclarationRector.php',
17271727
'Rector\\DowngradePhp80\\Rector\\FunctionLike\\DowngradeUnionTypeDeclarationRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/FunctionLike/DowngradeUnionTypeDeclarationRector.php',
1728+
'Rector\\DowngradePhp80\\Rector\\Instanceof_\\DowngradeInstanceofStringableRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Instanceof_/DowngradeInstanceofStringableRector.php',
17281729
'Rector\\DowngradePhp80\\Rector\\Instanceof_\\DowngradePhp80ResourceReturnToObjectRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Instanceof_/DowngradePhp80ResourceReturnToObjectRector.php',
17291730
'Rector\\DowngradePhp80\\Rector\\MethodCall\\DowngradeNamedArgumentRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeNamedArgumentRector.php',
17301731
'Rector\\DowngradePhp80\\Rector\\MethodCall\\DowngradeReflectionClassGetConstantsFilterRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/MethodCall/DowngradeReflectionClassGetConstantsFilterRector.php',

vendor/composer/installed.json

Lines changed: 8 additions & 8 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": "020b7c1e887eabf9f7e787ed837ffd4689c1801b"
1690+
"reference": "d996ef3f34321247938617975e4f6b1ea0ae6961"
16911691
},
16921692
"dist": {
16931693
"type": "zip",
1694-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/020b7c1e887eabf9f7e787ed837ffd4689c1801b",
1695-
"reference": "020b7c1e887eabf9f7e787ed837ffd4689c1801b",
1694+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/d996ef3f34321247938617975e4f6b1ea0ae6961",
1695+
"reference": "d996ef3f34321247938617975e4f6b1ea0ae6961",
16961696
"shasum": ""
16971697
},
16981698
"require": {
@@ -1715,7 +1715,7 @@
17151715
"tomasvotruba\/class-leak": "^2.0",
17161716
"tracy\/tracy": "^2.10"
17171717
},
1718-
"time": "2025-05-09T08:26:30+00:00",
1718+
"time": "2025-05-10T12:53:02+00:00",
17191719
"default-branch": true,
17201720
"type": "rector-extension",
17211721
"extra": {
@@ -1748,12 +1748,12 @@
17481748
"source": {
17491749
"type": "git",
17501750
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
1751-
"reference": "2b141c8042ec2e81b939338da02c847f64616559"
1751+
"reference": "3a83d1d08d10d5c2c461727ffcaed8fea934ee37"
17521752
},
17531753
"dist": {
17541754
"type": "zip",
1755-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/2b141c8042ec2e81b939338da02c847f64616559",
1756-
"reference": "2b141c8042ec2e81b939338da02c847f64616559",
1755+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/3a83d1d08d10d5c2c461727ffcaed8fea934ee37",
1756+
"reference": "3a83d1d08d10d5c2c461727ffcaed8fea934ee37",
17571757
"shasum": ""
17581758
},
17591759
"require": {
@@ -1771,7 +1771,7 @@
17711771
"tomasvotruba\/class-leak": "^1.0",
17721772
"tracy\/tracy": "^2.10"
17731773
},
1774-
"time": "2025-05-02T18:57:43+00:00",
1774+
"time": "2025-05-10T12:53:49+00:00",
17751775
"default-branch": true,
17761776
"type": "rector-extension",
17771777
"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 020b7c1'), '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 2b141c8'), '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 462d1a9'), '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 9cb58c1'));
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 d996ef3'), '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 3a83d1d'), '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 462d1a9'), '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 9cb58c1'));
1313
private function __construct()
1414
{
1515
}

vendor/rector/rector-doctrine/rules/CodeQuality/Enum/CollectionMapping.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ final class CollectionMapping
1010
/**
1111
* @var string[]
1212
*/
13-
public const TO_MANY_CLASSES = [MappingClass::ONE_TO_MANY, MappingClass::MANY_TO_MANY, OdmMappingClass::REFERENCE_MANY];
13+
public const TO_MANY_CLASSES = [MappingClass::ONE_TO_MANY, MappingClass::MANY_TO_MANY, OdmMappingClass::REFERENCE_MANY, OdmMappingClass::EMBED_MANY];
1414
/**
1515
* @var string[]
1616
*/

vendor/rector/rector-doctrine/rules/CodeQuality/Rector/Property/TypedPropertyFromToManyRelationTypeRector.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(PropertyTypeDecorator $propertyTypeDecorator, PhpDoc
6161
}
6262
public function getRuleDefinition() : RuleDefinition
6363
{
64-
return new RuleDefinition('Complete @var annotations or types based on @ORM\\*toMany annotations or attributes', [new CodeSample(<<<'CODE_SAMPLE'
64+
return new RuleDefinition('Complete Collection @var annotations and property type declarations, based on @ORM\\*toMany and @ODM\\*toMany annotations or attributes', [new CodeSample(<<<'CODE_SAMPLE'
6565
use Doctrine\ORM\Mapping as ORM;
6666
6767
class SimpleColumn
@@ -74,14 +74,15 @@ class SimpleColumn
7474
CODE_SAMPLE
7575
, <<<'CODE_SAMPLE'
7676
use Doctrine\ORM\Mapping as ORM;
77+
use Doctrine\Common\Collections\Collection;
7778
7879
class SimpleColumn
7980
{
8081
/**
8182
* @ORM\OneToMany(targetEntity="App\Product")
82-
* @var \Doctrine\Common\Collections\Collection<int, \App\Product>
83+
* @var Collection<int, \App\Product>
8384
*/
84-
private \Doctrine\Common\Collections\Collection $products;
85+
private Collection $products;
8586
}
8687
CODE_SAMPLE
8788
)]);

vendor/rector/rector-doctrine/src/Enum/OdmMappingClass.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ final class OdmMappingClass
1313
* @var string
1414
*/
1515
public const REFERENCE_MANY = 'Doctrine\\ODM\\MongoDB\\Mapping\\Annotations\\ReferenceMany';
16+
public const EMBED_MANY = 'Doctrine\\ODM\\MongoDB\\Mapping\\Annotations\\EmbedMany';
1617
}

vendor/rector/rector-downgrade-php/config/set/downgrade-php80.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Rector\DowngradePhp80\Rector\FuncCall\DowngradeStrStartsWithRector;
2727
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector;
2828
use Rector\DowngradePhp80\Rector\FunctionLike\DowngradeUnionTypeDeclarationRector;
29+
use Rector\DowngradePhp80\Rector\Instanceof_\DowngradeInstanceofStringableRector;
2930
use Rector\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector;
3031
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeNamedArgumentRector;
3132
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionClassGetConstantsFilterRector;
@@ -52,5 +53,5 @@
5253
// Jetbrains\PhpStorm\Language under nette/utils
5354
new DowngradeAttributeToAnnotation('Jetbrains\\PhpStorm\\Language', 'language'),
5455
]);
55-
$rectorConfig->rules([DowngradeNamedArgumentRector::class, DowngradeDereferenceableOperationRector::class, DowngradeUnionTypeTypedPropertyRector::class, DowngradeUnionTypeDeclarationRector::class, DowngradeMixedTypeDeclarationRector::class, DowngradeStaticTypeDeclarationRector::class, DowngradeAbstractPrivateMethodInTraitRector::class, DowngradePropertyPromotionRector::class, DowngradeNonCapturingCatchesRector::class, DowngradeStrContainsRector::class, DowngradeMatchToSwitchRector::class, DowngradeClassOnObjectToGetClassRector::class, DowngradeArbitraryExpressionsSupportRector::class, DowngradeNullsafeToTernaryOperatorRector::class, DowngradeTrailingCommasInParamUseRector::class, DowngradeStrStartsWithRector::class, DowngradeStrEndsWithRector::class, DowngradePhpTokenRector::class, DowngradeThrowExprRector::class, DowngradePhp80ResourceReturnToObjectRector::class, DowngradeReflectionGetAttributesRector::class, DowngradeRecursiveDirectoryIteratorHasChildrenRector::class, DowngradeReflectionPropertyGetDefaultValueRector::class, DowngradeReflectionClassGetConstantsFilterRector::class, DowngradeArrayFilterNullableCallbackRector::class, DowngradeNumberFormatNoFourthArgRector::class, DowngradeStringReturnTypeOnToStringRector::class, DowngradeMixedTypeTypedPropertyRector::class, RemoveReturnTypeDeclarationFromCloneRector::class, DowngradeEnumToConstantListClassRector::class]);
56+
$rectorConfig->rules([DowngradeNamedArgumentRector::class, DowngradeDereferenceableOperationRector::class, DowngradeUnionTypeTypedPropertyRector::class, DowngradeUnionTypeDeclarationRector::class, DowngradeMixedTypeDeclarationRector::class, DowngradeStaticTypeDeclarationRector::class, DowngradeAbstractPrivateMethodInTraitRector::class, DowngradePropertyPromotionRector::class, DowngradeNonCapturingCatchesRector::class, DowngradeStrContainsRector::class, DowngradeMatchToSwitchRector::class, DowngradeClassOnObjectToGetClassRector::class, DowngradeArbitraryExpressionsSupportRector::class, DowngradeNullsafeToTernaryOperatorRector::class, DowngradeTrailingCommasInParamUseRector::class, DowngradeStrStartsWithRector::class, DowngradeStrEndsWithRector::class, DowngradePhpTokenRector::class, DowngradeThrowExprRector::class, DowngradePhp80ResourceReturnToObjectRector::class, DowngradeReflectionGetAttributesRector::class, DowngradeRecursiveDirectoryIteratorHasChildrenRector::class, DowngradeReflectionPropertyGetDefaultValueRector::class, DowngradeReflectionClassGetConstantsFilterRector::class, DowngradeArrayFilterNullableCallbackRector::class, DowngradeNumberFormatNoFourthArgRector::class, DowngradeStringReturnTypeOnToStringRector::class, DowngradeMixedTypeTypedPropertyRector::class, RemoveReturnTypeDeclarationFromCloneRector::class, DowngradeEnumToConstantListClassRector::class, DowngradeInstanceofStringableRector::class]);
5657
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
declare (strict_types=1);
4+
namespace Rector\DowngradePhp80\Rector\Instanceof_;
5+
6+
use PhpParser\Node;
7+
use PhpParser\Node\Expr\Instanceof_;
8+
use PhpParser\Node\Name\FullyQualified;
9+
use PhpParser\Node\Scalar\String_;
10+
use Rector\Rector\AbstractRector;
11+
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
12+
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
13+
/**
14+
* @see https://wiki.php.net/rfc/stringable
15+
* @see \Rector\Tests\DowngradePhp80\Rector\Instanceof_\DowngradeInstanceofStringableRector\DowngradeInstanceofStringableRectorTest
16+
*/
17+
final class DowngradeInstanceofStringableRector extends AbstractRector
18+
{
19+
public function getRuleDefinition() : RuleDefinition
20+
{
21+
return new RuleDefinition('change instanceof Stringable to method_exists', [new CodeSample(<<<'CODE_SAMPLE'
22+
$obj instanceof \Stringable;
23+
CODE_SAMPLE
24+
, <<<'CODE_SAMPLE'
25+
method_exists($obj, '__toString');
26+
CODE_SAMPLE
27+
)]);
28+
}
29+
/**
30+
* @return array<class-string<Node>>
31+
*/
32+
public function getNodeTypes() : array
33+
{
34+
return [Instanceof_::class];
35+
}
36+
/**
37+
* @param Instanceof_ $node
38+
*/
39+
public function refactor(Node $node) : ?Node
40+
{
41+
if (!$node->class instanceof FullyQualified) {
42+
return null;
43+
}
44+
if (!$this->isName($node->class, 'Stringable')) {
45+
return null;
46+
}
47+
return $this->nodeFactory->createFuncCall('method_exists', [$node->expr, new String_('__toString')]);
48+
}
49+
}

0 commit comments

Comments
 (0)