8000 minor #60184 [Validator] fix php doc (94noni) · sfmok/symfony@89a9e9e · GitHub
[go: up one dir, main page]

Skip to content

Commit 89a9e9e

Browse files
minor symfony#60184 [Validator] fix php doc (94noni)
This PR was merged into the 7.2 branch. Discussion ---------- [Validator] fix php doc | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | License | MIT From actual 7.2 doc of https://symfony.com/doc/current/reference/constraints/Type.html#basic-usage ```php $metadata->addPropertyConstraint('accessCode', new Assert\Type([ 'type' => ['alpha', 'digit'], ])); ``` We can add an array of `type` to validates against But the array shape is not recognized as "valid" regarding the actual php doc I am quite new on phpstan, perhaps it's on their side with the `mixed` usage? nonetheless, with this PR [it seems to "work"](https://phpstan.org/r/615100b1-300f-45c5-8ac0-557a8b764739) ## before ```php new Type(['type' => 'float']), // static analysis OK ``` ## after without this PR ```php new Type(['type' => ['float', 'int',]]), // static analysis KO ``` ## after with this PR ```php new Type(['type' => ['float', 'int',]]), // static analysis OK ``` Commits ------- b3c5fb8 [Validator] fix php doc
2 parents c08305b + b3c5fb8 commit 89a9e9e

File tree

1 file changed

+3
-3
lines changed
  • src/Symfony/Component/Validator/Constraints

1 file changed

+3
-3
lines changed

src/Symfony/Component/Validator/Constraints/Type.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class Type extends Constraint
3131
public string|array|null $type = null;
3232

3333
/**
34-
* @param string|string[]|array<string,mixed>|null $type The type(s) to enforce on the value
35-
* @param string[]|null $groups
36-
* @param array<string,mixed> $options
34+
* @param string|list<string>|array<string,mixed>|null $type The type(s) to enforce on the value
35+
* @param string[]|null $groups
36+
* @param array<string,mixed> $options
3737
*/
3838
public function __construct(string|array|null $type, ?string $message = null, ?array $groups = null, mixed $payload = null, array $options = [])
3939
{

0 commit comments

Comments
 (0)
0