File tree 2 files changed +7
-11
lines changed
src/Symfony/Component/Validator 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \Validator \Constraints ;
13
13
14
+ use Doctrine \Common \Annotations \Annotation \NamedArgumentConstructor ;
15
+ use Symfony \Component \Validator \Attribute \HasNamedArguments ;
16
+
14
17
/**
15
18
* Attribute to define a group sequence provider.
16
19
*
17
20
* @Annotation
18
21
*
22
+ * @NamedArgumentConstructor
23
+ *
19
24
* @Target({"CLASS", "ANNOTATION"})
20
25
*
21
26
* @author Bernhard Schussek <bschussek@gmail.com>
22
27
*/
23
28
#[\Attribute(\Attribute::TARGET_CLASS )]
24
29
class GroupSequenceProvider
25
30
{
26
- public ?string $ provider = null ;
27
-
28
- public function __construct (array $ options = [], string $ provider = null )
31
+ #[HasNamedArguments]
32
+ public function __construct (public ?string $ provider = null )
29
33
{
30
- $ this ->provider = $ options ['provider ' ] ?? $ provider ;
31
34
}
32
35
}
Original file line number Diff line number Diff line change 17
17
18
18
class GroupSequenceProviderTest extends TestCase
19
19
{
20
- public function testCreate ()
21
- {
22
- $ sequence = new GroupSequenceProvider (['provider ' => DummyGroupProvider::class]);
23
-
24
- $ this ->assertSame (DummyGroupProvider::class, $ sequence ->provider );
25
- }
26
-
27
20
public function testCreateAttributeStyle ()
28
21
{
29
22
$ sequence = new GroupSequenceProvider (provider: DummyGroupProvider::class);
You can’t perform that action at this time.
0 commit comments