[2.x] Ensure void return type translates to null#63
Merged
WyriHaximus merged 1 commit into2.xfrom Feb 8, 2025
Merged
Conversation
|
🚧 Composer Development Dependency changes 🚧
|
Ocramius
suggested changes
Jan 10, 2025
tests/Types.php
Outdated
| */ | ||
| assertType('bool', $bridge->await(run(static function (): bool { | ||
| return true; | ||
| assertType('null', $bridge->await(run(static function (): void { |
There was a problem hiding this comment.
This assertion is misplaced here too.
Same as reactphp-parallel/infinite-pool#60 (comment)
You cannot take the value of a void expression, as it is has no possible value.
You can turn it into an expression by having a closure around it:
-assertType('null', $bridge->await(run(static function (): void {
+assertType('Closure(): void', (fn () => $bridge->await(run(static function (): void {1f721d7 to
d354da3
Compare
d354da3 to
a5ff1b3
Compare
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.
No description provided.