File tree Expand file tree Collapse file tree 3 files changed +2
-33
lines changed
PHPStan/Scope/NodeVisitor Expand file tree Collapse file tree 3 files changed +2
-33
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,12 @@ final class VersionResolver
19
19
* @api
20
20
* @var string
21
21
*/
22
- public const PACKAGE_VERSION = 'e3ad355409775a85349aed5ba8e803b7a93fc4dc ' ;
22
+ public const PACKAGE_VERSION = '05f832313c704757b3ff3925f6c0da45b5fb3cc7 ' ;
23
23
/**
24
24
* @api
25
25
* @var string
26
26
*/
27
- public const RELEASE_DATE = '2024-08-22 13:30:44 ' ;
27
+ public const RELEASE_DATE = '2024-08-22 21:16:19 ' ;
28
28
/**
29
29
* @var int
30
30
*/
Original file line number Diff line number Diff line change @@ -154,10 +154,6 @@ final class AttributeKey
154
154
* @var string
155
155
*/
156
156
public const IS_MULTI_ASSIGN = 'is_multi_assign ' ;
157
- /**
158
- * @var string
159
- */
160
- public const STATEMENT_DEPTH = 'statementDepth ' ;
161
157
/**
162
158
* @var string
163
159
*/
Original file line number Diff line number Diff line change 6
6
use PhpParser \Node ;
7
7
use PhpParser \Node \Stmt \ClassLike ;
8
8
use PhpParser \Node \Stmt \Declare_ ;
9
- use PhpParser \Node \Stmt \Namespace_ ;
10
9
use PhpParser \NodeVisitorAbstract ;
11
10
use Rector \Contract \PhpParser \Node \StmtsAwareInterface ;
12
11
use Rector \NodeTypeResolver \Node \AttributeKey ;
13
12
use Rector \NodeTypeResolver \PHPStan \Scope \Contract \NodeVisitor \ScopeResolverNodeVisitorInterface ;
14
13
final class StmtKeyNodeVisitor extends NodeVisitorAbstract implements ScopeResolverNodeVisitorInterface
15
14
{
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
- }
42
15
public function enterNode (Node $ node ) : ?Node
43
16
{
44
17
if (!$ node instanceof StmtsAwareInterface && !$ node instanceof ClassLike && !$ node instanceof Declare_) {
You can’t perform that action at this time.
0 commit comments