-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Added factory methods to DelayStamp for better DX #38141
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failing tests unrelated. |
nicolas-grekas
approved these changes
Sep 10, 2020
fabpot
approved these changes
Sep 10, 2020
stof
reviewed
Sep 10, 2020
|
||
public static function delayForHours(int $hours): self | ||
{ | ||
return self::delayForMinutes($hours * 60); |
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.
Why not converting hours to milliseconds directly rather than chaining 3 method calls ?
ba04c5a
to
fdc8da0
Compare
Thank you @Toflar. |
1 similar comment
Thank you @Toflar. |
fabpot
added a commit
that referenced
this pull request
Oct 8, 2020
…:delayUntil() (Nyholm) This PR was squashed before being merged into the 5.x branch. Discussion ---------- [Messenger] Add DelayStamp::delayFor() and DelayStamp::delayUntil() | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #38141 | License | MIT | Doc PR | This PR will revert the work by @Toflar in #38141. He added some helper methods and I want to add a generic factory method that adds a DateInterval. This PR will also close #38480 and fix #38459. It is also related to a comment in #36512 (comment) that was liked by a few people. Maybe adding both `DelayStamp::delayFor(\DateInterval)` and `DelayStamp::delayUntil(\DateTimeInterface)` is overkill. But this covers all the bases and I hope that it will be the last change to this small class. Commits ------- c5de1eb [Messenger] Add DelayStamp::delayFor() and DelayStamp::delayUntil()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I often find myself delaying messages for a few minutes or so and I always have to remember the
DelayStamp
uses milliseconds. I guess these simple factories could improve DX quite a bit :)