-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
base: master
Are you sure you want to change the base?
Conversation
0ffd9fd
to
6051009
Compare
Upgraded PHP-CS-Fixer v2 -> v3. Removed position_after_functions_and_oop_constructs=>same CS rule (reverting to PSR-2). Added some return types.
Fixed IntegrationTest.
@@ -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, |
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.
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
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.
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.
/** | ||
* @var System $systemStats | ||
*/ |
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.
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"> |
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 now automatically included?
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.
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; |
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.
Do we need = null
here?
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.
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) |
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.
We should add return types to all of these.
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.
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.
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).