-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix code generation for never
return type
#735
base: 2.15.x
Are you sure you want to change the base?
Conversation
if (PHP_VERSION_ID < 80100) { | ||
self::markTestSkipped('Needs PHP 8.1'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be replace by annotation:
/** @requires PHP >= 8.1 */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar checks have been used in other tests, but yes could be replaced easily if needed.
|
||
if ($originalMethod->returnsReference()) { | ||
if ($originalReturnType instanceof ReflectionNamedType && $originalReturnType->getName() === 'never') { | ||
$method->setBody('throw new \Exception();'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really needed? without anything in the body, php already throws:
TypeError: [...]: never-returning function must not implicitly return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mh, probably is not needed. Don't rembember why I added it honestly, I'll remove that
Fixes #729
Based upon #731 to execute pipeline on PHP 8.1.
I've fixed the deprecations raised by implementing
\Serializable
without the new__serialize/__unserialize
methods, but I needed to disable deprecation report onlazy-loading-value-holder-internal-php-classes.phpt
due to#[\ReturnTypeWillChange]
-related errors.