wiki/content/20201117111757-required.md

28 lines
382 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-29 18:27:12 +00:00
date: 2020-11-17
2024-05-06 20:40:05 +00:00
id: f0c76a12-b940-461d-8888-fecdab2fa971
title: Required
---
# Description
Attribute replacement for [@required](20201117112017-required).
# Syntax
``` php
use Symfony\Contracts\Service\Attribute\Required;
class SomeService
{
#[Required]
public Bar $bar;
#[Required]
public function setFoo(Foo $foo): void
{
// ...
}
}
```