8000 Improve type for the `mode` property of the Bic constraint · symfony/symfony@aa86ec4 · GitHub
[go: up one dir, main page]

Skip to content

Commit aa86ec4

Browse files
committed
Improve type for the mode property of the Bic constraint
- the property should not be nullable as the constructor prevents assigning null and the validator does not expect it either - phpdoc types are added to let static analysis tool know about the valid modes thanks to the available class constants
1 parent 72e038e commit aa86ec4

File tree

1 file changed

+9
-6
lines changed
  • src/Symfony/Component/Validator/Constraints

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ class Bic extends Constraint
5858
public string $ibanMessage = 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.';
5959
public ?string $iban = null;
6060
public ?string $ibanPropertyPath = null;
61-
public ?string $mode = self::VALIDATION_MODE_STRICT;
61+
/**
62+
* @var self::VALIDATION_MODE_*
63+
*/
64+
public string $mode = self::VALIDATION_MODE_STRICT;
6265

6366
/**
64-
* @param array<string,mixed>|null $options
65-
* @param string|null $iban An IBAN value to validate that its country code is the same as the BIC's one
66-
* @param string|null $ibanPropertyPath Property path to the IBAN value when validating objects
67-
* @param string[]|null $groups
68-
* @param string|null $mode The mode used to validate the BIC; pass null to use the default mode (strict)
67+
* @param array<string,mixed>|null $options
68+
* @param string|null $iban An IBAN value to validate that its country code is the same as the BIC's one
69+
* @param string|null $ibanPropertyPath Property path to the IBAN value when validating objects
70+
* @param string[]|null $groups
71+
* @param self::VALIDATION_MODE_*|null $mode The mode used to validate the BIC; pass null to use the default mode (strict)
6972
*/
7073
public function __construct(
7174
?array $options = null,

0 commit comments

Comments
 (0)
0