Skip to content

Commit 1c7b259

Browse files
committed
Updated Rector to commit b43b958840405f3a896acfafb81c389ed4018920
rectorphp/rector-src@b43b958 Rectify (#6973)
1 parent be3a452 commit 1c7b259

5 files changed

Lines changed: 36 additions & 11 deletions

File tree

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '2.0.18';
22+
public const PACKAGE_VERSION = 'b43b958840405f3a896acfafb81c389ed4018920';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-06-10 19:22:47';
27+
public const RELEASE_DATE = '2025-06-11 11:34:34';
2828
/**
2929
* @var int
3030
*/

vendor/composer/installed.json

Lines changed: 4 additions & 4 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": "cea5e6617d0296b59b904bf95f950700ea12c36f"
1690+
"reference": "8389f0d9e5ca30932fb8682ad404af552960b031"
16911691
},
16921692
"dist": {
16931693
"type": "zip",
1694-
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/cea5e6617d0296b59b904bf95f950700ea12c36f",
1695-
"reference": "cea5e6617d0296b59b904bf95f950700ea12c36f",
1694+
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/8389f0d9e5ca30932fb8682ad404af552960b031",
1695+
"reference": "8389f0d9e5ca30932fb8682ad404af552960b031",
16961696
"shasum": ""
16971697
},
16981698
"require": {
@@ -1715,7 +1715,7 @@
17151715
"tomasvotruba\/class-leak": "^2.0",
17161716
"tracy\/tracy": "^2.10"
17171717
},
1718-
"time": "2025-06-11T10:41:42+00:00",
1718+
"time": "2025-06-11T11:31:18+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 cea5e66'), '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 1454a52'), '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 3bc079d'), '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 1a199fc'));
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 8389f0d'), '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 1454a52'), '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 3bc079d'), '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 1a199fc'));
1313
private function __construct()
1414
{
1515
}

vendor/rector/rector-doctrine/rules/TypedCollections/Rector/ClassMethod/RemoveNullFromNullableCollectionTypeRector.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
use PhpParser\Node\Stmt\ClassMethod;
1010
use PhpParser\Node\Stmt\Property;
1111
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
12+
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
1213
use PHPStan\PhpDocParser\Ast\Type\NullableTypeNode;
14+
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
1315
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
1416
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
1517
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
@@ -124,15 +126,32 @@ private function refactorProperty(Property $property) : ?Property
124126
if (!$varTagValueNode instanceof VarTagValueNode) {
125127
return null;
126128
}
129+
if ($varTagValueNode->type instanceof UnionTypeNode) {
130+
$hasChanged = \false;
131+
$unionTypeNode = $varTagValueNode->type;
132+
foreach ($unionTypeNode->types as $key => $unionedType) {
133+
if ($unionedType instanceof IdentifierTypeNode && $unionedType->name === 'null') {
134+
unset($unionTypeNode->types[$key]);
135+
$hasChanged = \true;
136+
}
137+
}
138+
if ($hasChanged) {
139+
// only one type left, lets use it directly
140+
if (\count($unionTypeNode->types) === 1) {
141+
$onlyType = \array_pop($unionTypeNode->types);
142+
$varTagValueNode->type = $onlyType;
143+
}
144+
$this->updateVarTagValueNode($phpDocInfo, $varTagValueNode, $property);
145+
return $property;
146+
}
147+
}
127148
// remove nullable if has one
128149
if (!$varTagValueNode->type instanceof NullableTypeNode) {
129150
return null;
130151
}
131152
// unwrap nullable type
132153
$varTagValueNode->type = $varTagValueNode->type->type;
133-
$phpDocInfo->removeByType(VarTagValueNode::class);
134-
$phpDocInfo->addTagValueNode($varTagValueNode);
135-
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($property);
154+
$this->updateVarTagValueNode($phpDocInfo, $varTagValueNode, $property);
136155
return $property;
137156
}
138157
private function hasNativeCollectionType(Property $property) : bool
@@ -142,4 +161,10 @@ private function hasNativeCollectionType(Property $property) : bool
142161
}
143162
return $this->isName($property->type, DoctrineClass::COLLECTION);
144163
}
164+
private function updateVarTagValueNode(PhpDocInfo $phpDocInfo, VarTagValueNode $varTagValueNode, Property $property) : void
165+
{
166+
$phpDocInfo->removeByType(VarTagValueNode::class);
167+
$phpDocInfo->addTagValueNode($varTagValueNode);
168+
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($property);
169+
}
145170
}

0 commit comments

Comments
 (0)