Fix code generation for never return type#735
Open
alekitto wants to merge 7 commits intoOcramius:2.15.xfrom
Open
Fix code generation for never return type#735alekitto wants to merge 7 commits intoOcramius:2.15.xfrom
never return type#735alekitto wants to merge 7 commits intoOcramius:2.15.xfrom
Conversation
Comment on lines
+1530
to
+1532
| if (PHP_VERSION_ID < 80100) { | ||
| self::markTestSkipped('Needs PHP 8.1'); | ||
| } |
There was a problem hiding this comment.
Can be replace by annotation:
/** @requires PHP >= 8.1 */
Author
There was a problem hiding this comment.
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();'); |
Contributor
There was a problem hiding this comment.
Is this really needed? without anything in the body, php already throws:
TypeError: [...]: never-returning function must not implicitly return
Author
There was a problem hiding this comment.
Mh, probably is not needed. Don't rembember why I added it honestly, I'll remove that
Co-authored-by: Paweł Niedzielski <pawel.tadeusz.niedzielski@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #729
Based upon #731 to execute pipeline on PHP 8.1.
I've fixed the deprecations raised by implementing
\Serializablewithout the new__serialize/__unserializemethods, but I needed to disable deprecation report onlazy-loading-value-holder-internal-php-classes.phptdue to#[\ReturnTypeWillChange]-related errors.