-
-
Notifications
You must be signed in to change notification settings - Fork 132
PeclEvLoop: Add new PeclEvLoop (PECL ext-ev) #97
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
Conversation
The existing libev driver seems to function only with a non-official, out of date libev extension for PHP. This PeclEvLoop class is a very similar clone of the LibEvLoop library but for the officially documented libev extension. Changes are mostly to constants and function parameter order.
Sorry, I forgot to add travis configuration for PECL ev extension (which is necessary for |
@kaduev13 tbh no need to close your PR for that, just add another commit fixing that. Or just squash it in your last commit. (@clue is our resident Git guru) |
@WyriHaximus ok, thank you. I'm very new to open-source, but I will learn fast ;) Btw, it's fixed now. |
src/PeclEvLoop.php
Outdated
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function tick() |
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.
Note, that tick()
has been removed from the interface (see #72).
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.
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.
Minor nitpicking, otherwise LGTM.
src/PeclEvLoop.php
Outdated
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function addReadStream($stream, callable $listener) |
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.
The docblocks containing just {@inheritdoc}
can be removed.
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.
@jsor, no problem, I can remove it, but {@inheritdoc}
makes inheritance explicit (link to PSR-5 inheritance section). Is it a reactphp
project convention?
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.
Since this method implements the interface, it's explicit that the docblock is inherited. We tend to avoid docblocks since they are often redundant and become easily out of date. With type hints and return types in PHP 7, they will become even more obsolete (at least 99.9% of the time) :)
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.
@jsor, ok, thank you for the explanation 😃 , I agree with your arguments (but I just looked through LibEvLoop
, StreamSelectLoop
and other loops sources and there are a lot of "only @inheritdoc
" PHPDocs).
I removed unnecessary @inheritdoc
blocks from PeclEvLoop
in 7128aaf.
Btw, I think that it'll be better to cleanup the history of this PR before merging it into master (cause of a lot of little fix commits). I will do it tomorrow morning (UTC).
tests/PeclEvLoopTest.php
Outdated
/** | ||
* @author Ivan Kalita kaduev13@gmail.com | ||
*/ | ||
|
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 usually don't add @author
doc blocks.
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.
ping @WyriHaximus and @clue |
ping @clue |
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.
Thanks @kaduev13! 👍
Functionally this looks good to me, but I'd like to address a few minor points before getting this:
- Name prefix Pecl/Ext/Lib is inconsistent
- 17 commits should probably be squashed to a reasonable number.
use SplObjectStorage; | ||
|
||
/** | ||
* @see https://bitbucket.org/osmanov/pecl-ev/overview |
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.
A short description would help?
* | ||
* @return \Closure | ||
*/ | ||
private function getStreamListenerClosure($stream, callable $listener) { |
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.
Minor nitpick: Line break before {
(PSR-2)
@clue Thank you for the corrections, I'll fix these issues on this weekend 😃 |
@kaduev13 any luck with those corrections? |
Superseded by #148 👍 |
Improved and (just a little bit) refactored #25.