File tree Expand file tree Collapse file tree 4 files changed +16
-12
lines changed
Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 55use Attribute ;
66use PhpParser \Node ;
77use PHPStan \Analyser \Scope ;
8+ use PHPStan \Node \InArrowFunctionNode ;
89use PHPStan \Rules \AttributesCheck ;
910use PHPStan \Rules \Rule ;
1011
1112/**
12- * @implements Rule<Node\Expr\ArrowFunction >
13+ * @implements Rule<InArrowFunctionNode >
1314 */
1415final class ArrowFunctionAttributesRule implements Rule
1516{
@@ -20,14 +21,14 @@ public function __construct(private AttributesCheck $attributesCheck)
2021
2122 public function getNodeType (): string
2223 {
23- return Node \ Expr \ArrowFunction ::class;
24+ return InArrowFunctionNode ::class;
2425 }
2526
2627 public function processNode (Node $ node , Scope $ scope ): array
2728 {
2829 return $ this ->attributesCheck ->check (
2930 $ scope ,
30- $ node ->attrGroups ,
31+ $ node ->getOriginalNode ()-> attrGroups ,
3132 Attribute::TARGET_FUNCTION ,
3233 'function ' ,
3334 );
Original file line number Diff line number Diff line change 55use Attribute ;
66use PhpParser \Node ;
77use PHPStan \Analyser \Scope ;
8+ use PHPStan \Node \InClosureNode ;
89use PHPStan \Rules \AttributesCheck ;
910use PHPStan \Rules \Rule ;
1011
1112/**
12- * @implements Rule<Node\Expr\Closure >
13+ * @implements Rule<InClosureNode >
1314 */
1415final class ClosureAttributesRule implements Rule
1516{
@@ -20,14 +21,14 @@ public function __construct(private AttributesCheck $attributesCheck)
2021
2122 public function getNodeType (): string
2223 {
23- return Node \ Expr \Closure ::class;
24+ return InClosureNode ::class;
2425 }
2526
2627 public function processNode (Node $ node , Scope $ scope ): array
2728 {
2829 return $ this ->attributesCheck ->check (
2930 $ scope ,
30- $ node ->attrGroups ,
31+ $ node ->getOriginalNode ()-> attrGroups ,
3132 Attribute::TARGET_FUNCTION ,
3233 'function ' ,
3334 );
Original file line number Diff line number Diff line change 55use Attribute ;
66use PhpParser \Node ;
77use PHPStan \Analyser \Scope ;
8+ use PHPStan \Node \InFunctionNode ;
89use PHPStan \Rules \AttributesCheck ;
910use PHPStan \Rules \Rule ;
1011
1112/**
12- * @implements Rule<Node\Stmt\Function_ >
13+ * @implements Rule<InFunctionNode >
1314 */
1415final class FunctionAttributesRule implements Rule
1516{
@@ -20,14 +21,14 @@ public function __construct(private AttributesCheck $attributesCheck)
2021
2122 public function getNodeType (): string
2223 {
23- return Node \ Stmt \Function_ ::class;
24+ return InFunctionNode ::class;
2425 }
2526
2627 public function processNode (Node $ node , Scope $ scope ): array
2728 {
2829 return $ this ->attributesCheck ->check (
2930 $ scope ,
30- $ node ->attrGroups ,
31+ $ node ->getOriginalNode ()-> attrGroups ,
3132 Attribute::TARGET_FUNCTION ,
3233 'function ' ,
3334 );
Original file line number Diff line number Diff line change 55use Attribute ;
66use PhpParser \Node ;
77use PHPStan \Analyser \Scope ;
8+ use PHPStan \Node \InClassMethodNode ;
89use PHPStan \Rules \AttributesCheck ;
910use PHPStan \Rules \Rule ;
1011
1112/**
12- * @implements Rule<Node\Stmt\ClassMethod >
13+ * @implements Rule<InClassMethodNode >
1314 */
1415final class MethodAttributesRule implements Rule
1516{
@@ -20,14 +21,14 @@ public function __construct(private AttributesCheck $attributesCheck)
2021
2122 public function getNodeType (): string
2223 {
23- return Node \ Stmt \ClassMethod ::class;
24+ return InClassMethodNode ::class;
2425 }
2526
2627 public function processNode (Node $ node , Scope $ scope ): array
2728 {
2829 return $ this ->attributesCheck ->check (
2930 $ scope ,
30- $ node ->attrGroups ,
31+ $ node ->getOriginalNode ()-> attrGroups ,
3132 Attribute::TARGET_METHOD ,
3233 'method ' ,
3334 );
You can’t perform that action at this time.
0 commit comments