8000 Add more scalar typehints/return types on final classes · symfony/symfony@4fe13fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 4fe13fd

Browse files
committed
Add more scalar typehints/return types on final classes
1 parent 115928f commit 4fe13fd

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

src/Symfony/Component/Console/Event/ConsoleErrorEvent.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,8 @@ public function getError()
4848
*
4949
* @param \Throwable $error
5050
*/
51-
public function setError($error)
51+
public function setError(\Throwable $error)
5252
{
53-
if (!$error instanceof \Throwable && !$error instanceof \Exception) {
54-
throw new InvalidArgumentException(sprintf('The error passed to ConsoleErrorEvent must be an instance of \Throwable or \Exception, "%s" was passed instead.', is_object($error) ? get_class($error) : gettype($error)));
55-
}
56-
5753
$this->error = $error;
5854
}
5955

src/Symfony/Component/Validator/Validation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class Validation
2828
*
2929
* @return ValidatorInterface The new validator
3030
*/
31-
public static function createValidator()
31+
public static function createValidator(): ValidatorInterface
3232
{
3333
return self::createValidatorBuilder()->getValidator();
3434
}
@@ -38,7 +38,7 @@ public static function createValidator()
3838
*
3939
* @return ValidatorBuilderInterface The new builder
4040
*/
41-
public static function createValidatorBuilder()
41+
public static function createValidatorBuilder(): ValidatorBuilder
4242
{
4343
return new ValidatorBuilder();
4444
}

src/Symfony/Component/WebLink/HttpHeaderSerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class HttpHeaderSerializer
2929
*
3030
* @return string|null
3131
*/
32-
public function serialize($links)
32+
public function serialize(iterable $links)
3333
{
3434
$elements = array();
3535
foreach ($links as $link) {

src/Symfony/Component/Yaml/Tag/TaggedValue.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@ final class TaggedValue
2424
* @param string $tag
2525
* @param mixed $value
2626
*/
27-
public function __construct($tag, $value)
27+
public function __construct(string $tag, $value)
2828
{
2929
$this->tag = $tag;
3030
$this->value = $value;
3131
}
3232

33-
/**
34-
* @return string
35-
*/
36-
public function getTag()
33+
public function getTag(): string
3734
{
3835
return $this->tag;
3936
}

0 commit comments

Comments
 (0)
0