Skip to content
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

Converted coroutines to futures #36

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Converted coroutines to futures #36

wants to merge 5 commits into from

Conversation

Bilge
Copy link
Contributor

@Bilge Bilge commented Oct 18, 2022

To be released as 🏷️ 1.0.0. Obviates #35.

📝 Running the examples seems to throw exceptions on connection close. This is somehow not captured by any of the tests (which are all passing).

@Bilge Bilge changed the title Converted coroutines to fibers Converted coroutines to futures Oct 18, 2022
@Bilge Bilge force-pushed the v1 branch 8 times, most recently from 0ffd9fd to 6051009 Compare October 18, 2022 19:38
Bilge added 5 commits October 18, 2022 21:02
Upgraded PHP-CS-Fixer v2 -> v3.
Removed position_after_functions_and_oop_constructs=>same CS rule (reverting to PSR-2).
Added some return types.
@@ -27,7 +26,7 @@
"php_unit_fqcn_annotation" => true,
"phpdoc_summary" => true,
"phpdoc_types" => true,
"psr4" => true,
"psr_autoloading" => true,
"return_type_declaration" => ["space_before" => "none"],
"short_scalar_cast" => true,
"single_blank_line_before_namespace" => true,
Copy link
Member

Choose a reason for hiding this comment

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

This should use our shared config in amphp/php-cs-fixer-config:^2, see https://github.com/amphp/amp/blob/d048ec1d03d47fc313d630e989b7a73053f10fae/.php-cs-fixer.dist.php

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Be that as it may, I do not think this issue needs to hold up this PR, nor even the 1.0 release, since styles can just be fixed after the fact.

Comment on lines +10 to +12
/**
* @var System $systemStats
*/
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't need such comments any longer, because we use proper types instead of generics inside promises.

<phpunit bootstrap="./vendor/autoload.php" colors="true">
<phpunit colors="true">
Copy link
Member

Choose a reason for hiding this comment

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

Is this now automatically included?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't recall a time when it was not. PHPUnit should be launched with bin/phpunit. If you invoke it correctly, it will always include the autoloader. Perhaps if you're one of these people that thinks installing PHPUnit as a global PHAR is a good idea then it might not, but even that is probably no longer the case these days.


/** @var string */
private $tube;
private ?string $tube;
Copy link
Member

Choose a reason for hiding this comment

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

Do we need = null here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know. This is your library, after all. I was hoping I would not need to work on it any more and you could just commit directly to this branch if you want to make changes. I'm not going to protest any change you want to make so just go ahead.

@@ -99,7 +98,8 @@ public function pause(string $tube, int $delay): Promise {
});
}

public function put(string $payload, int $timeout = 60, int $delay = 0, $priority = 0): Promise {
public function put(string $payload, int $timeout = 60, int $delay = 0, $priority = 0)
Copy link
Member

Choose a reason for hiding this comment

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

We should add return types to all of these.

Copy link
Contributor Author

@Bilge Bilge Oct 27, 2022

Choose a reason for hiding this comment

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

I don't know what the return types are. In most cases it seems they would just be mixed anyway. But in principal I agree, as long as we're absolutely sure what the types are and that they're invariant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants