8000 Merge pull request #272 from Ngob/fix_php8_jsonSerialize_signature · thecodingmachine/tdbm@fbee465 · GitHub
[go: up one dir, main page]

Skip to content

Commit fbee465

Browse files
Merge pull request #272 from Ngob/fix_php8_jsonSerialize_signature
Adding mixed return type to bean's jsonSerialize
2 parents e606c0e + 8d9d832 commit fbee465

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Utils/BeanDescriptor.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,13 @@ public function generateJsonSerialize(): MethodGenerator
515515
));
516516
$method->setParameter(new ParameterGenerator('stopRecursion', 'bool', false));
517517

518+
/*
519+
* Set jsonSerialize's mixed return type for php >= 8
520+
*/
521+
if (version_compare(PHP_VERSION, '8.0.0', '>=')) {
522+
$method->setReturnType("mixed");
523+
}
524+
518525
if ($parentFk !== null) {
519526
$body = '$array = parent::jsonSerialize($stopRecursion);';
520527
} else {

0 commit comments

Comments
 (0)
0