minor #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 #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
-------
03987f2ba5
Define null return type for Constraint::getDefaultOption()
This commit is contained in:
commit
d45ecefe0c
|
@ -232,12 +232,13 @@ abstract class Constraint
|
|||
*
|
||||
* Override this method to define a default option.
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*
|
||||
* @see __construct()
|
||||
*/
|
||||
public function getDefaultOption()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in New Issue