Skip to content

Commit 4daf89c

Browse files
committed
Fix up reflection access
1 parent 82cb7c3 commit 4daf89c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Annotator/AbstractAnnotator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,10 @@ protected function getModelAnnotations(array $usedModels, string $content): arra
823823
*/
824824
protected function invokeProperty(&$object, string $name) {
825825
$reflection = new ReflectionClass(get_class($object));
826+
if (!$reflection->hasProperty($name)) {
827+
return null;
828+
}
826829
$property = $reflection->getProperty($name);
827-
$property->setAccessible(true);
828830

829831
return $property->getValue($object);
830832
}

src/Generator/Task/TableFinderTask.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ protected function getCustomFinders(): array {
152152
*/
153153
protected function invokeProperty(&$object, string $name) {
154154
$reflection = new ReflectionClass(get_class($object));
155+
if (!$reflection->hasProperty($name)) {
156+
return null;
157+
}
155158
$property = $reflection->getProperty($name);
156-
$property->setAccessible(true);
157159

158160
return $property->getValue($object);
159161
}

0 commit comments

Comments
 (0)