Skip to content

Commit ab1dfdc

Browse files
committed
use $propertyReflection->isHooked()
1 parent 7b67fd6 commit ab1dfdc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Reflection/Php/PhpPropertyReflection.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ public function hasHook(string $hookType): bool
256256
return $this->setHook !== null;
257257
}
258258

259+
public function isHooked(): bool
260+
{
261+
return $this->getHook !== null || $this->setHook !== null;
262+
}
263+
259264
public function getHook(string $hookType): ExtendedMethodReflection
260265
{
261266
if ($hookType === 'get') {

src/Rules/Variables/UnsetRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private function canBeUnset(Node $node, Scope $scope): ?IdentifierRuleError
104104
->build();
105105
}
106106

107-
if ($propertyReflection->getNativeReflection()->getHooks() !== []) {
107+
if ($propertyReflection->isHooked()) {
108108
return RuleErrorBuilder::message(
109109
sprintf(
110110
'Cannot unset hooked %s::$%s property.',

0 commit comments

Comments
 (0)