Skip to content

Commit

Permalink
minor #54574 [Validator] Document Compound::getConstraints options …
Browse files Browse the repository at this point in the history
…(VincentLanglet)

This PR was squashed before being merged into the 7.1 branch.

Discussion
----------

[Validator] Document `Compound::getConstraints` options

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #...
| License       | MIT

The array options is not documented in `Compoung::getConstraints`.

Looking at the usage
```
$this->getConstraints($this->normalizeOptions($options));
```
I think it should be `array<string, mixed>`.

Commits
-------

d4a99ee [Validator] Document `Compound::getConstraints` options
  • Loading branch information
fabpot committed Apr 13, 2024
2 parents c29b7a9 + d4a99ee commit 0a9cba3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Symfony/Component/Validator/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ public function __construct(mixed $options = null, ?array $groups = null, mixed
}
}

/**
* @return array<string, mixed>
*/
protected function normalizeOptions(mixed $options): array
{
$normalizedOptions = [];
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Validator/Constraints/Compound.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ final public function validatedBy(): string
}

/**
* @param array<string, mixed> $options
*
* @return Constraint[]
*/
abstract protected function getConstraints(array $options): array;
Expand Down

0 comments on commit 0a9cba3

Please sign in to comment.