Skip to content

Commit 1567c22

Browse files
Add return types to internal|final|private methods
1 parent ded6e42 commit 1567c22

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

Constraint.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,9 @@ public function getTargets()
286286
/**
287287
* Optimizes the serialized value to minimize storage space.
288288
*
289-
* @return array The properties to serialize
290-
*
291289
* @internal
292290
*/
293-
public function __sleep()
291+
public function __sleep(): array
294292
{
295293
// Initialize "groups" option if it is not set
296294
$this->groups;

Constraints/DateValidator.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,9 @@ class DateValidator extends ConstraintValidator
2626
/**
2727
* Checks whether a date is valid.
2828
*
29-
* @param int $year The year
30-
* @param int $month The month
31-
* @param int $day The day
32-
*
33-
* @return bool Whether the date is valid
34-
*
3529
* @internal
3630
*/
37-
public static function checkDate($year, $month, $day)
31+
public static function checkDate(int $year, int $month, int $day): bool
3832
{
3933
return checkdate($month, $day, $year);
4034
}

Constraints/TimeValidator.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,9 @@ class TimeValidator extends ConstraintValidator
2626
/**
2727
* Checks whether a time is valid.
2828
*
29-
* @param int $hour The hour
30-
* @param int $minute The minute
31-
* @param int $second The second
32-
*
33-
* @return bool Whether the time is valid
34-
*
3529
* @internal
3630
*/
37-
public static function checkTime($hour, $minute, $second)
31+
public static function checkTime(int $hour, int $minute, float $second): bool
3832
{
3933
return $hour >= 0 && $hour < 24 && $minute >= 0 && $minute < 60 && $second >= 0 && $second < 60;
4034
}

Tests/Constraints/RegexValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function getValidValues()
7272
['090909'],
7373
[90909],
7474
[new class() {
75-
public function __toString()
75+
public function __toString(): string
7676
{
7777
return '090909';
7878
}
@@ -116,7 +116,7 @@ public function getInvalidValues()
116116
['abcd'],
117117
['090foo'],
118118
[new class() {
119-
public function __toString()
119+
public function __toString(): string
120120
{
121121
return 'abcd';
122122
}

0 commit comments

Comments
 (0)