Skip to content

[Notifier] Remove superfluous parameters in *Message::fromNotification() #35167

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
merged 1 commit into from
Feb 4, 2020

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Jan 2, 2020

Q A
Branch? 5.0
Bug fix? no
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

Those classes are final so I think we don't need those extra arguments.

@fancyweb fancyweb force-pushed the notifier-message-from-notification branch from 10b01dd to 24a8f38 Compare January 2, 2020 10:07
@@ -35,7 +35,7 @@ public function __construct(RawMessage $message, Envelope $envelope = null)
$this->envelope = $envelope;
}

public static function fromNotification(Notification $notification, Recipient $recipient, string $transport = null): self
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternative: for the $transport, we could set the transport directly from this method then? But the current code uses the setter everytime.

@@ -32,7 +31,7 @@ public function __construct(string $subject, MessageOptionsInterface $options =
$this->options = $options;
}

public static function fromNotification(Notification $notification, Recipient $recipient, string $transport = null): self
public static function fromNotification(Notification $notification): self
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we need $recipient here in the future? But being forced to pass an useless argument is worse in practice for me.

@nicolas-grekas nicolas-grekas added this to the 5.0 milestone Jan 4, 2020
@nicolas-grekas nicolas-grekas requested a review from fabpot January 4, 2020 11:29
@nicolas-grekas
Copy link
Member

There is a failure on deps=low

@fancyweb fancyweb force-pushed the notifier-message-from-notification branch from 24a8f38 to 98d24d9 Compare January 4, 2020 13:28
@nicolas-grekas nicolas-grekas modified the milestones: 5.0, next Jan 4, 2020
@fancyweb fancyweb force-pushed the notifier-message-from-notification branch from 98d24d9 to e4dec22 Compare January 6, 2020 10:19
@fancyweb fancyweb changed the base branch from 5.0 to master January 6, 2020 10:19
@fancyweb fancyweb force-pushed the notifier-message-from-notification branch from e4dec22 to d0dacf5 Compare January 6, 2020 10:21
Copy link
Member

@fabpot fabpot left a comment

Choose a reason for hiding this comment

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

I did that on purpose. I'm 👎 for this change.

@fancyweb
Copy link
Contributor Author

fancyweb commented Jan 8, 2020

@fabpot In this case, shouldn't the methods at least set the passed $transport? I don't understand how keeping any unused argument can be better for usability. Especially the mandatory $recipient on ChatMessage. Could you explain your intention please? Thank you :)

@fabpot
Copy link
Member

fabpot commented Feb 4, 2020

Thank you @fancyweb.

fabpot added a commit that referenced this pull request Feb 4, 2020
…fromNotification() (fancyweb)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Remove superfluous parameters in *Message::fromNotification()

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Those classes are final so I think we don't need those extra arguments.

Commits
-------

d0dacf5 [Notifier] Remove superfluous parameters in *Message::fromNotification()
@fabpot fabpot merged commit d0dacf5 into symfony:master Feb 4, 2020
@fancyweb fancyweb deleted the notifier-message-from-notification branch February 4, 2020 14:14
@nicolas-grekas nicolas-grekas removed this from the next milestone May 4, 2020
@nicolas-grekas nicolas-grekas added this to the 5.1 milestone May 4, 2020
@fabpot fabpot mentioned this pull request May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants