Skip to content

Commit d45ecef

Browse files
committed
minor symfony#30869 [Validator] Define null return type for Constraint::getDefaultOption() (jaikdean)
This PR was submitted for the 4.2 branch but it was merged into the 3.4 branch instead (closes symfony#30869). Discussion ---------- [Validator] Define null return type for Constraint::getDefaultOption() | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The `Constraint::getDefaultOption()` method is documented with a return type of `string`, but has no `return` statement. This behaviour is expected, as the return value is compared against `null` elsewhere in the code, but the docblock causes problems with static analysis when extending this class. This PR corrects the documented return type to `string|null` and adds an explicit `return null`. Commits ------- 03987f2 Define null return type for Constraint::getDefaultOption()
2 parents 69058e3 + 03987f2 commit d45ecef

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/Validator/Constraint.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,13 @@ public function addImplicitGroupName($group)
232232
*
233233
* Override this method to define a default option.
234234
*
235-
* @return string
235+
* @return string|null
236236
*
237237
* @see __construct()
238238
*/
239239
public function getDefaultOption()
240240
{
241+
return null;
241242
}
242243

243244
/**

0 commit comments

Comments
 (0)