Skip to content

Commit 19f89d6

Browse files
committed
minor symfony#58810 [Validator] Improve type for the mode property of the Bic constraint (stof)
This PR was merged into the 7.2 branch. Discussion ---------- [Validator] Improve type for the `mode` property of the Bic constraint | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT - 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 This improves the new feature introduced in 7.2 (before the BC policy prevents us from fixing the nullability of the public property) Commits ------- aa86ec4 Improve type for the `mode` property of the Bic constraint
2 parents 63bb91f + aa86ec4 commit 19f89d6

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)