Skip to content

Commit 6bc3404

Browse files
committed
Fix accessor attributes not working on PHP < 8.1
1 parent ff66fdf commit 6bc3404

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Console/ModelsCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,9 @@ protected function hasCamelCaseModelProperties()
11191119

11201120
protected function getAttributeReturnType(Model $model, \ReflectionMethod $reflectionMethod): Collection
11211121
{
1122+
// Private/protected ReflectionMethods require setAccessible prior to PHP 8.1
1123+
$reflectionMethod->setAccessible(true);
1124+
11221125
/** @var Attribute $attribute */
11231126
$attribute = $reflectionMethod->invoke($model);
11241127

0 commit comments

Comments
 (0)