Skip to content

Commit

Permalink
Merge pull request #272 from Ngob/fix_php8_jsonSerialize_signature
Browse files Browse the repository at this point in the history
Adding mixed return type to bean's jsonSerialize
  • Loading branch information
homersimpsons committed May 16, 2022
2 parents e606c0e + 8d9d832 commit fbee465
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Utils/BeanDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,13 @@ public function generateJsonSerialize(): MethodGenerator
));
$method->setParameter(new ParameterGenerator('stopRecursion', 'bool', false));

/*
* Set jsonSerialize's mixed return type for php >= 8
*/
if (version_compare(PHP_VERSION, '8.0.0', '>=')) {
$method->setReturnType("mixed");
}

if ($parentFk !== null) {
$body = '$array = parent::jsonSerialize($stopRecursion);';
} else {
Expand Down

0 comments on commit fbee465

Please sign in to comment.