-
-
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
Added missing functions #6
Conversation
kyl0b1te
commented
Oct 6, 2017
- changed the way of yams parsing (added new dependency)
- added missing beanstalk functions
src/BeanstalkClient.php
Outdated
|
||
switch ($type) { | ||
case "PAUSED": | ||
return 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.
I guess it can just return null
if the return value doesn't have any other meaning, right?
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.
For me, true
here mean that operation was executed and finished successfully. Null is not really informative here, IMO
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.
true
isn't either, as the successful resolution of the promise already indicates success. It's just like a void
function in blocking 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.
Hmm... maybe you're right. But I'm still not sure :)
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.
Any opinion change?
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.
So you will not merge without this true
to null
conversion ?
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 can also change it afterwards. ;-) Could you provide a code sample that examines the return value and acts based on it?
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.
Any function call with remote communication that should change server state. Is not really helpful use extensions for such cases every time.
Image that:
function setServerAvailablity(int $code) { ... }
will return null. Is it informative ?
Compare it with true
src/BeanstalkClient.php
Outdated
foreach ($source as $stat) { | ||
if ($stat == '---' || empty($stat)) { | ||
continue; | ||
public function getTubesList(): Promise { |
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 could name it listTubes()
.
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'm not completely sure about it. For me, its more predictable to have a getTubesList()
and getWatchedTubesList()
methods. What do you think ?
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 think listWatchedTubes()
reads slightly better, but I don't have a strong preference for either.
@markkimsal Thoughts?
Could you please rebase your changes onto the current master instead of merging it? It might be easier to just create a new branch and cherry-pick the few commits. 👍 |
Is there any updates ? :) |
src/BeanstalkClient.php
Outdated
}); | ||
} | ||
|
||
public function getUsingTube(): Promise { |
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.
Could you rename that one to getUsedTube()
?
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.
Really? What name you want to see 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.
getUsedTube()
, as mentioned. 😄
Other than that it looks perfectly fine now. 👍
Seems like you rebased one commit too early (c952a54), do you want to fix that or should I just go ahead and merge it? |
@kelunik I think better you to do it |
I'll just create a merge commit, too lazy to fix it up now. The history isn't too unclean. Thanks for your contribution! |