Skip to content

Commit 81c9ecd

Browse files
committed
Updated Rector to commit 3882cb5a0a0312d17fc202e03bfefaca659a666e
rectorphp/rector-src@3882cb5 fix: allow more nodes to be passed to AttributeGroupNewLiner (#7145)
1 parent 4d72c29 commit 81c9ecd

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

rules/Php81/NodeManipulator/AttributeGroupNewLiner.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
declare (strict_types=1);
44
namespace Rector\Php81\NodeManipulator;
55

6-
use PhpParser\Node\Param;
7-
use PhpParser\Node\Stmt\Class_;
8-
use PhpParser\Node\Stmt\Property;
6+
use PhpParser\Node;
7+
use PhpParser\Node\AttributeGroup;
98
use Rector\ValueObject\Application\File;
9+
use RectorPrefix202508\Webmozart\Assert\Assert;
1010
final class AttributeGroupNewLiner
1111
{
12-
/**
13-
* @param \PhpParser\Node\Stmt\Property|\PhpParser\Node\Param|\PhpParser\Node\Stmt\Class_ $node
14-
*/
15-
public function newLine(File $file, $node) : void
12+
public function newLine(File $file, Node $node) : void
1613
{
14+
$attrGroups = $node->attrGroups ?? [];
15+
if ($attrGroups === []) {
16+
return;
17+
}
18+
Assert::allIsAOf($attrGroups, AttributeGroup::class);
19+
Assert::isArray($attrGroups);
1720
$oldTokens = $file->getOldTokens();
1821
$startTokenPos = $node->getStartTokenPos();
1922
if (!isset($oldTokens[$startTokenPos])) {
@@ -23,11 +26,11 @@ public function newLine(File $file, $node) : void
2326
return;
2427
}
2528
$iteration = 1;
26-
$lastKey = \array_key_last($node->attrGroups);
29+
$lastKey = \array_key_last($attrGroups);
2730
if ($lastKey === null) {
2831
return;
2932
}
30-
$lastAttributeTokenPos = $node->attrGroups[$lastKey]->getEndTokenPos();
33+
$lastAttributeTokenPos = $attrGroups[$lastKey]->getEndTokenPos();
3134
while (isset($oldTokens[$startTokenPos + $iteration])) {
3235
if ($startTokenPos + $iteration === $lastAttributeTokenPos) {
3336
if ($oldTokens[$startTokenPos + $iteration]->text !== ']') {

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 = '85e5e11e71a026bfd91210c3a25f1dee1404e74b';
22+
public const PACKAGE_VERSION = '3882cb5a0a0312d17fc202e03bfefaca659a666e';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-08-13 11:52:04';
27+
public const RELEASE_DATE = '2025-08-13 11:52:30';
2828
/**
2929
* @var int
3030
*/

0 commit comments

Comments
 (0)