File tree 4 files changed +16
-12
lines changed
4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 5
5
use Attribute ;
6
6
use PhpParser \Node ;
7
7
use PHPStan \Analyser \Scope ;
8
+ use PHPStan \Node \InArrowFunctionNode ;
8
9
use PHPStan \Rules \AttributesCheck ;
9
10
use PHPStan \Rules \Rule ;
10
11
11
12
/**
12
- * @implements Rule<Node\Expr\ArrowFunction >
13
+ * @implements Rule<InArrowFunctionNode >
13
14
*/
14
15
final class ArrowFunctionAttributesRule implements Rule
15
16
{
@@ -20,14 +21,14 @@ public function __construct(private AttributesCheck $attributesCheck)
20
21
21
22
public function getNodeType (): string
22
23
{
23
- return Node \ Expr \ArrowFunction ::class;
24
+ return InArrowFunctionNode ::class;
24
25
}
25
26
26
27
public function processNode (Node $ node , Scope $ scope ): array
27
28
{
28
29
return $ this ->attributesCheck ->check (
29
30
$ scope ,
30
- $ node ->attrGroups ,
31
+ $ node ->getOriginalNode ()-> attrGroups ,
31
32
Attribute::TARGET_FUNCTION ,
32
33
'function ' ,
33
34
);
Original file line number Diff line number Diff line change 5
5
use Attribute ;
6
6
use PhpParser \Node ;
7
7
use PHPStan \Analyser \Scope ;
8
+ use PHPStan \Node \InClosureNode ;
8
9
use PHPStan \Rules \AttributesCheck ;
9
10
use PHPStan \Rules \Rule ;
10
11
11
12
/**
12
- * @implements Rule<Node\Expr\Closure >
13
+ * @implements Rule<InClosureNode >
13
14
*/
14
15
final class ClosureAttributesRule implements Rule
15
16
{
@@ -20,14 +21,14 @@ public function __construct(private AttributesCheck $attributesCheck)
20
21
21
22
public function getNodeType (): string
22
23
{
23
- return Node \ Expr \Closure ::class;
24
+ return InClosureNode ::class;
24
25
}
25
26
26
27
public function processNode (Node $ node , Scope $ scope ): array
27
28
{
28
29
return $ this ->attributesCheck ->check (
29
30
$ scope ,
30
- $ node ->attrGroups ,
31
+ $ node ->getOriginalNode ()-> attrGroups ,
31
32
Attribute::TARGET_FUNCTION ,
32
33
'function ' ,
33
34
);
Original file line number Diff line number Diff line change 5
5
use Attribute ;
6
6
use PhpParser \Node ;
7
7
use PHPStan \Analyser \Scope ;
8
+ use PHPStan \Node \InFunctionNode ;
8
9
use PHPStan \Rules \AttributesCheck ;
9
10
use PHPStan \Rules \Rule ;
10
11
11
12
/**
12
- * @implements Rule<Node\Stmt\Function_ >
13
+ * @implements Rule<InFunctionNode >
13
14
*/
14
15
final class FunctionAttributesRule implements Rule
15
16
{
@@ -20,14 +21,14 @@ public function __construct(private AttributesCheck $attributesCheck)
20
21
21
22
public function getNodeType (): string
22
23
{
23
- return Node \ Stmt \Function_ ::class;
24
+ return InFunctionNode ::class;
24
25
}
25
26
26
27
public function processNode (Node $ node , Scope $ scope ): array
27
28
{
28
29
return $ this ->attributesCheck ->check (
29
30
$ scope ,
30
- $ node ->attrGroups ,
31
+ $ node ->getOriginalNode ()-> attrGroups ,
31
32
Attribute::TARGET_FUNCTION ,
32
33
'function ' ,
33
34
);
Original file line number Diff line number Diff line change 5
5
use Attribute ;
6
6
use PhpParser \Node ;
7
7
use PHPStan \Analyser \Scope ;
8
+ use PHPStan \Node \InClassMethodNode ;
8
9
use PHPStan \Rules \AttributesCheck ;
9
10
use PHPStan \Rules \Rule ;
10
11
11
12
/**
12
- * @implements Rule<Node\Stmt\ClassMethod >
13
+ * @implements Rule<InClassMethodNode >
13
14
*/
14
15
final class MethodAttributesRule implements Rule
15
16
{
@@ -20,14 +21,14 @@ public function __construct(private AttributesCheck $attributesCheck)
20
21
21
22
public function getNodeType (): string
22
23
{
23
- return Node \ Stmt \ClassMethod ::class;
24
+ return InClassMethodNode ::class;
24
25
}
25
26
26
27
public function processNode (Node $ node , Scope $ scope ): array
27
28
{
28
29
return $ this ->attributesCheck ->check (
29
30
$ scope ,
30
- $ node ->attrGroups ,
31
+ $ node ->getOriginalNode ()-> attrGroups ,
31
32
Attribute::TARGET_METHOD ,
32
33
'method ' ,
33
34
);
You can’t perform that action at this time.
0 commit comments