Skip to content

Commit 6adb1cd

Browse files
committed
Rework property hook check
1 parent 3d635d5 commit 6adb1cd

12 files changed

+22
-20
lines changed

src/Rules/AttributesCheck.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public function check(
4040
array $attrGroups,
4141
int $requiredTarget,
4242
string $targetName,
43-
bool $isPropertyHook,
4443
): array
4544
{
4645
$errors = [];
@@ -82,12 +81,6 @@ public function check(
8281
->identifier('attribute.target')
8382
->line($attribute->getStartLine())
8483
->build();
85-
} elseif ($isPropertyHook && strtolower($name) === 'nodiscard') {
86-
// #[\NoDiscard] cannot be used on property hooks
87-
$errors[] = RuleErrorBuilder::message(sprintf('Attribute class %s cannot be used on property hooks.', $name))
88-
->identifier('attribute.target')
89-
->line($attribute->getStartLine())
90-
->build();
9184
}
9285

9386
if (($flags & Attribute::IS_REPEATABLE) === 0) {

src/Rules/Classes/ClassAttributesRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function processNode(Node $node, Scope $scope): array
3838
$classLikeNode->attrGroups,
3939
Attribute::TARGET_CLASS,
4040
'class',
41-
false,
4241
);
4342

4443
$classReflection = $node->getClassReflection();

src/Rules/Classes/ClassConstantAttributesRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function processNode(Node $node, Scope $scope): array
3232
$node->attrGroups,
3333
Attribute::TARGET_CLASS_CONSTANT,
3434
'class constant',
35-
false,
3635
);
3736
}
3837

src/Rules/EnumCases/EnumCaseAttributesRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function processNode(Node $node, Scope $scope): array
3232
$node->attrGroups,
3333
Attribute::TARGET_CLASS_CONSTANT,
3434
'class constant',
35-
false,
3635
);
3736
}
3837

src/Rules/Functions/ArrowFunctionAttributesRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function processNode(Node $node, Scope $scope): array
3333
$node->getOriginalNode()->attrGroups,
3434
Attribute::TARGET_FUNCTION,
3535
'function',
36-
false,
3736
);
3837
}
3938

src/Rules/Functions/ClosureAttributesRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function processNode(Node $node, Scope $scope): array
3333
$node->getOriginalNode()->attrGroups,
3434
Attribute::TARGET_FUNCTION,
3535
'function',
36-
false,
3736
);
3837
}
3938

src/Rules/Functions/FunctionAttributesRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function processNode(Node $node, Scope $scope): array
3333
$node->getOriginalNode()->attrGroups,
3434
Attribute::TARGET_FUNCTION,
3535
'function',
36-
false,
3736
);
3837
}
3938

src/Rules/Functions/ParamAttributesRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function processNode(Node $node, Scope $scope): array
3939
$node->attrGroups,
4040
$targetType,
4141
$targetName,
42-
false,
4342
);
4443
}
4544

src/Rules/Methods/MethodAttributesRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function processNode(Node $node, Scope $scope): array
3333
$node->getOriginalNode()->attrGroups,
3434
Attribute::TARGET_METHOD,
3535
'method',
36-
false,
3736
);
3837
}
3938

src/Rules/Properties/PropertyAttributesRule.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function processNode(Node $node, Scope $scope): array
3232
$node->attrGroups,
3333
Attribute::TARGET_PROPERTY,
3434
'property',
35-
false,
3635
);
3736
}
3837

0 commit comments

Comments
 (0)