Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b0d6f80

Browse filesBrowse files
committed
minor #17655 [DependencyInjection] 6.0 [injection_types] remove mention of @required in service_container (alexislefebvre)
This PR was merged into the 6.0 branch. Discussion ---------- [DependencyInjection] 6.0 [injection_types] remove mention of `@required` in service_container Same logic than in #17654: Symfony 6+ requires PHP 8, so `#[Required]` can be used in all cases, and mentioning ``@required`` doesn't add any value. Commits ------- 76c0424 remove mention to required in service_container
2 parents 154d86b + 76c0424 commit b0d6f80
Copy full SHA for b0d6f80

File tree

1 file changed

+5
-4
lines changed
Filter options

1 file changed

+5
-4
lines changed

‎service_container/injection_types.rst

Copy file name to clipboardExpand all lines: service_container/injection_types.rst
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,16 @@ by cloning the original service, this approach allows you to make a service immu
116116

117117
// ...
118118
use Symfony\Component\Mailer\MailerInterface;
119+
use Symfony\Contracts\Service\Attribute\Required;
119120

120121
class NewsletterManager
121122
{
122123
private $mailer;
123124

124125
/**
125-
* @required
126126
* @return static
127127
*/
128+
#[Required]
128129
public function withMailer(MailerInterface $mailer): self
129130
{
130131
$new = clone $this;
@@ -220,14 +221,14 @@ that accepts the dependency::
220221
// src/Mail/NewsletterManager.php
221222
namespace App\Mail;
222223

224+
use Symfony\Contracts\Service\Attribute\Required;
225+
223226
// ...
224227
class NewsletterManager
225228
{
226229
private $mailer;
227230

228-
/**
229-
* @required
230-
*/
231+
#[Required]
231232
public function setMailer(MailerInterface $mailer): void
232233
{
233234
$this->mailer = $mailer;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.