Skip to content

[2.x] Ensure void return type translates to null #63

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

Merged
merged 1 commit into from
Feb 8, 2025

Conversation

WyriHaximus
Copy link
Contributor

No description provided.

@WyriHaximus WyriHaximus added the Enhancement ✨ New feature or request label Jan 10, 2025
@WyriHaximus WyriHaximus added this to the 2.0.0 milestone Jan 10, 2025
@boring-cyborg boring-cyborg bot added Dependencies 📦 Pull requests that update a dependency file JSON 👨‍💼 NEON 🦹‍♂️ PHP 🐘 Hypertext Pre Processor Tests 🧪 labels Jan 10, 2025
Copy link

github-actions bot commented Jan 10, 2025

🚧 Composer Development Dependency changes 🚧

Dev Packages Operation Base Target Link
composer/ca-bundle Upgraded 1.5.4 1.5.5 Compare
composer/class-map-generator Upgraded 1.5.0 1.6.0 Compare
composer/composer Upgraded 2.8.4 2.8.5 Compare
ergebnis/phpstan-rules Upgraded 2.5.0 2.5.2 Compare
filp/whoops Upgraded 2.16.0 2.17.0 Compare
orklah/psalm-insane-comparison Upgraded v2.3.0 v2.4.0 Compare
phpstan/phpstan Upgraded 1.12.14 1.12.17 Compare
phpstan/phpstan-strict-rules Upgraded 1.6.1 1.6.2 Compare
react-parallel/stubs Upgraded 1.1.0 1.2.0 Compare
squizlabs/php_codesniffer Upgraded 3.11.2 3.11.3 Compare
symfony/property-access Upgraded v6.4.13 v6.4.18 Compare
symfony/property-info Upgraded v6.4.17 v6.4.18 Compare
symfony/serializer Upgraded v6.4.15 v6.4.18 Compare
symfony/validator Upgraded v6.4.17 v6.4.18 Compare
symfony/yaml Upgraded v6.4.13 v6.4.18 Compare

tests/Types.php Outdated
@@ -26,13 +26,30 @@
/**
* Await
*/
assertType('bool', $bridge->await(run(static function (): bool {
return true;
assertType('null', $bridge->await(run(static function (): void {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

@reactphp-parallel reactphp-parallel deleted a comment from github-actions bot Feb 8, 2025
@WyriHaximus WyriHaximus force-pushed the 2.x-ensure-void-returntype-translates-to-null branch from 1f721d7 to d354da3 Compare February 8, 2025 20:33
@WyriHaximus WyriHaximus force-pushed the 2.x-ensure-void-returntype-translates-to-null branch from d354da3 to a5ff1b3 Compare February 8, 2025 20:39
@WyriHaximus WyriHaximus merged commit 0d2261f into 2.x Feb 8, 2025
137 of 185 checks passed
@WyriHaximus WyriHaximus deleted the 2.x-ensure-void-returntype-translates-to-null branch February 8, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies 📦 Pull requests that update a dependency file Enhancement ✨ New feature or request JSON 👨‍💼 NEON 🦹‍♂️ PHP 🐘 Hypertext Pre Processor Tests 🧪
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants