[SF8] Use named arguments for Validator constraint constructor

This commit is contained in:
TheMilek 2026-02-18 13:22:56 +01:00 committed by Grzegorz Sadowski
parent 55fef698fb
commit bff3428026
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
3 changed files with 34 additions and 39 deletions

View file

@ -103,5 +103,9 @@ jobs:
- name: Install dependencies
run: composer update --no-interaction --no-scripts --prefer-dist
- name: Create test database schema
if: matrix.package == 'Bundle/ApiBundle'
run: tests/Application/bin/console doctrine:schema:update --force
- name: Run tests
run: vendor/bin/phpunit --colors=always

View file

@ -2,10 +2,6 @@
"minimal": {
"static-checks": {
"include": [
{
"php": "8.3",
"symfony": "~6.4.0"
},
{
"php": "8.4",
"symfony": "~7.4.0"
@ -18,13 +14,6 @@
},
"e2e-mariadb": {
"include": [
{
"php": "8.4",
"symfony": "~6.4.0",
"mariadb": "10.11.13",
"doctrine_bundle": "^2.0",
"state_machine_adapter": "winzou_state_machine"
},
{
"php": "8.5",
"symfony": "~7.4.0",
@ -36,13 +25,6 @@
},
"e2e-mysql": {
"include": [
{
"php": "8.4",
"symfony": "~6.4.0",
"mysql": "8.0",
"twig": "^3.3",
"doctrine_bundle": "^2.0"
},
{
"php": "8.5",
"symfony": "~7.4.0",
@ -102,12 +84,6 @@
},
"e2e-pgsql": {
"include": [
{
"php": "8.4",
"symfony": "~6.4.0",
"postgres": "15.13",
"doctrine_bundle": "^2.0"
},
{
"php": "8.5",
"symfony": "~7.4.0",
@ -123,10 +99,6 @@
},
"packages": {
"include": [
{
"php": "8.4",
"symfony": "~6.4.0"
},
{
"php": "8.5",
"symfony": "~7.4.0"
@ -142,7 +114,6 @@
"8.5"
],
"symfony": [
"~6.4.0",
"~7.4.0"
]
},
@ -153,7 +124,6 @@
"8.5"
],
"symfony": [
"~6.4.0",
"~7.4.0"
],
"mariadb": [
@ -182,7 +152,6 @@
"8.4"
],
"symfony": [
"~6.4.0",
"~7.4.0"
],
"mysql": [
@ -260,7 +229,6 @@
"8.5"
],
"symfony": [
"~6.4.0",
"~7.4.0"
],
"postgres": [
@ -269,12 +237,6 @@
"17.5"
],
"include": [
{
"php": "8.4",
"symfony": "~6.4.0",
"postgres": "15.13",
"doctrine_bundle": "^2.0"
},
{
"php": "8.5",
"symfony": "~7.4.0",
@ -296,7 +258,6 @@
"8.5"
],
"symfony": [
"~6.4.0",
"~7.4.0"
]
}

View file

@ -61,6 +61,36 @@ final class ChannelCodeCollection extends Constraint
parent::__construct(groups: $groups, payload: $payload);
}
/**
* @param array<string, mixed>|null $options
* @param array<Constraint>|null $constraints
* @param array<string>|null $groups
*/
public function __construct(
?array $options = null,
?array $constraints = null,
?bool $allowExtraFields = null,
?bool $allowMissingFields = null,
?string $channelAwarePropertyPath = null,
?string $extraFieldsMessage = null,
?string $missingFieldsMessage = null,
?string $invalidChannelMessage = null,
?bool $validateAgainstAllChannels = null,
?array $groups = null,
mixed $payload = null,
) {
parent::__construct($options, $groups, $payload);
$this->constraints = $constraints ?? $this->constraints;
$this->allowExtraFields = $allowExtraFields ?? $this->allowExtraFields;
$this->allowMissingFields = $allowMissingFields ?? $this->allowMissingFields;
$this->channelAwarePropertyPath = $channelAwarePropertyPath ?? $this->channelAwarePropertyPath;
$this->extraFieldsMessage = $extraFieldsMessage ?? $this->extraFieldsMessage;
$this->missingFieldsMessage = $missingFieldsMessage ?? $this->missingFieldsMessage;
$this->invalidChannelMessage = $invalidChannelMessage ?? $this->invalidChannelMessage;
$this->validateAgainstAllChannels = $validateAgainstAllChannels ?? $this->validateAgainstAllChannels;
}
public function validatedBy(): string
{
return 'sylius_channel_code_collection';