Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions UPGRADE-8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,19 @@ Uid
Validator
---------

* Remove support for passing associative arrays to `GroupSequence`

*Before*

```php
$groupSequence = GroupSequence(['value' => ['group 1', 'group 2']]);
```

*After*

```php
$groupSequence = GroupSequence(['group 1', 'group 2']);
```
* Change the default value of the `$requireTld` option of the `Url` constraint to `true`
* Add method `getGroupProvider()` to `ClassMetadataInterface`
* Replace `__sleep/wakeup()` by `__(un)serialize()` on `GenericMetadata` implementations
Expand All @@ -539,7 +552,7 @@ Validator
* Remove support for evaluating options in the base `Constraint` class. Initialize properties in the constructor of the concrete constraint
class instead.

Before:
*Before*

```php
class CustomConstraint extends Constraint
Expand All @@ -554,7 +567,7 @@ Validator
}
```

After:
*After*

```php
class CustomConstraint extends Constraint
Expand All @@ -572,7 +585,7 @@ Validator

* Remove the `getRequiredOptions()` method from the base `Constraint` class. Use mandatory constructor arguments instead.

Before:
*Before*

```php
class CustomConstraint extends Constraint
Expand All @@ -592,7 +605,7 @@ Validator
}
```

After:
*After*

```php
class CustomConstraint extends Constraint
Expand All @@ -612,7 +625,7 @@ Validator
* Remove support for passing an array of options to the `Composite` constraint class. Initialize the properties referenced with `getNestedConstraints()`
in child classes before calling the constructor of `Composite`.

Before:
*Before*

```php
class CustomCompositeConstraint extends Composite
Expand All @@ -631,7 +644,7 @@ Validator
}
```

After:
*After*

```php
class CustomCompositeConstraint extends Composite
Expand Down
13 changes: 13 additions & 0 deletions src/Symfony/Component/Validator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ CHANGELOG
8.0
---

* Remove support for passing associative arrays to `GroupSequence`

Before:

```php
$groupSequence = GroupSequence(['value' => ['group 1', 'group 2']]);
```

After:

```php
$groupSequence = GroupSequence(['group 1', 'group 2']);
```
* Change the default value of the `$requireTld` option of the `Url` constraint to `true`
* Add method `getGroupProvider()` to `ClassMetadataInterface`
* Replace `__sleep/wakeup()` by `__(un)serialize()` on `GenericMetadata` implementations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ class GroupSequence
*/
public function __construct(array $groups)
{
if (!array_is_list($groups)) {
trigger_deprecation('symfony/validator', '7.4', 'Support for passing an array of options to "%s()" is deprecated.', __METHOD__);
}

$this->groups = $groups['value'] ?? $groups;
$this->groups = $groups;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Symfony\Component\Validator\Tests\Constraints;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\Constraints\GroupSequence;

Expand All @@ -27,15 +25,4 @@ public function testCreate()

$this->assertSame(['Group 1', 'Group 2'], $sequence->groups);
}

#[Group('legacy')]
#[IgnoreDeprecations]
public function testCreateDoctrineStyle()
{
$this->expectUserDeprecationMessage('Since symfony/validator 7.4: Support for passing an array of options to "Symfony\Component\Validator\Constraints\GroupSequence::__construct()" is deprecated.');

$sequence = new GroupSequence(['value' => ['Group 1', 'Group 2']]);

$this->assertSame(['Group 1', 'Group 2'], $sequence->groups);
}
}
Loading