Skip to content

Commit

Permalink
Fix generator for PHP >= 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
andypost committed Aug 14, 2024
1 parent 6884364 commit 156b48c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Prophecy/Doubler/Generator/ClassCodeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private function generateTypes(TypeNodeAbstract $typeNode): string
}

// When we require PHP 8 we can stop generating ?foo nullables and remove this first block
if ($typeNode->canUseNullShorthand()) {
if (\PHP_VERSION_ID >= 80400 || $typeNode->canUseNullShorthand()) {
return sprintf( '?%s', $typeNode->getNonNullTypes()[0]);
} else {
return join('|', $typeNode->getTypes());
Expand Down

0 comments on commit 156b48c

Please sign in to comment.