Skip to content

Commit

Permalink
last improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
yceruto committed Oct 19, 2023
1 parent 4851495 commit 91da8a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,25 @@

namespace Symfony\Component\Validator\Constraints;

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Symfony\Component\Validator\Attribute\HasNamedArguments;

/**
* Attribute to define a group sequence provider.
*
* @Annotation
*
* @NamedArgumentConstructor
*
* @Target({"CLASS", "ANNOTATION"})
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
class GroupSequenceProvider
{
public ?string $provider = null;

public function __construct(array $options = [], string $provider = null)
#[HasNamedArguments]
public function __construct(public ?string $provider = null)
{
$this->provider = $options['provider'] ?? $provider;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@

class GroupSequenceProviderTest extends TestCase
{
public function testCreate()
{
$sequence = new GroupSequenceProvider(['provider' => DummyGroupProvider::class]);

$this->assertSame(DummyGroupProvider::class, $sequence->provider);
}

public function testCreateAttributeStyle()
{
$sequence = new GroupSequenceProvider(provider: DummyGroupProvider::class);
Expand Down

0 comments on commit 91da8a7

Please sign in to comment.