Skip to content

Commit 0981ded

Browse files
committed
Updated Rector to commit 05f832313c704757b3ff3925f6c0da45b5fb3cc7
rectorphp/rector-src@05f8323 [AttributeKey] Drop statementDepth attribute (#6249)
1 parent afeb012 commit 0981ded

File tree

3 files changed

+2
-33
lines changed

3 files changed

+2
-33
lines changed

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 = 'e3ad355409775a85349aed5ba8e803b7a93fc4dc';
22+
public const PACKAGE_VERSION = '05f832313c704757b3ff3925f6c0da45b5fb3cc7';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2024-08-22 13:30:44';
27+
public const RELEASE_DATE = '2024-08-22 21:16:19';
2828
/**
2929
* @var int
3030
*/

src/NodeTypeResolver/Node/AttributeKey.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ final class AttributeKey
154154
* @var string
155155
*/
156156
public const IS_MULTI_ASSIGN = 'is_multi_assign';
157-
/**
158-
* @var string
159-
*/
160-
public const STATEMENT_DEPTH = 'statementDepth';
161157
/**
162158
* @var string
163159
*/

src/NodeTypeResolver/PHPStan/Scope/NodeVisitor/StmtKeyNodeVisitor.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,12 @@
66
use PhpParser\Node;
77
use PhpParser\Node\Stmt\ClassLike;
88
use PhpParser\Node\Stmt\Declare_;
9-
use PhpParser\Node\Stmt\Namespace_;
109
use PhpParser\NodeVisitorAbstract;
1110
use Rector\Contract\PhpParser\Node\StmtsAwareInterface;
1211
use Rector\NodeTypeResolver\Node\AttributeKey;
1312
use Rector\NodeTypeResolver\PHPStan\Scope\Contract\NodeVisitor\ScopeResolverNodeVisitorInterface;
1413
final class StmtKeyNodeVisitor extends NodeVisitorAbstract implements ScopeResolverNodeVisitorInterface
1514
{
16-
/**
17-
* @param Node[] $nodes
18-
*/
19-
public function beforeTraverse(array $nodes) : ?array
20-
{
21-
if ($nodes === []) {
22-
return null;
23-
}
24-
if (!$nodes[0] instanceof Declare_ && !$nodes[0] instanceof Namespace_) {
25-
return null;
26-
}
27-
// on target node or no other root stmt, eg: only namespace without declare, no need to index
28-
if (\count($nodes) === 1) {
29-
return null;
30-
}
31-
// ensure statement depth is 0 to avoid declare in deep statements
32-
// eg: declare(ticks=1) @see https://www.php.net/manual/en/control-structures.declare.php#123674
33-
$statementDepth = $nodes[0]->getAttribute(AttributeKey::STATEMENT_DEPTH);
34-
if ($statementDepth > 0 || $statementDepth === null) {
35-
return null;
36-
}
37-
foreach ($nodes as $key => $node) {
38-
$node->setAttribute(AttributeKey::STMT_KEY, $key);
39-
}
40-
return $nodes;
41-
}
4215
public function enterNode(Node $node) : ?Node
4316
{
4417
if (!$node instanceof StmtsAwareInterface && !$node instanceof ClassLike && !$node instanceof Declare_) {

0 commit comments

Comments
 (0)