From 6bc3404d0f5a01bee96d1f76a0cd6463621b60fe Mon Sep 17 00:00:00 2001 From: Hans van Luttikhuizen-Ross Date: Thu, 7 Apr 2022 15:52:49 +0200 Subject: [PATCH] Fix accessor attributes not working on PHP < 8.1 --- src/Console/ModelsCommand.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index 8fded8e4c..1ee0ad7ba 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -1119,6 +1119,9 @@ protected function hasCamelCaseModelProperties() protected function getAttributeReturnType(Model $model, \ReflectionMethod $reflectionMethod): Collection { + // Private/protected ReflectionMethods require setAccessible prior to PHP 8.1 + $reflectionMethod->setAccessible(true); + /** @var Attribute $attribute */ $attribute = $reflectionMethod->invoke($model);