Skip to content

Commit 33aadbe

Browse files
Add return types to internal & magic methods when possible
1 parent 59e15a8 commit 33aadbe

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

Authentication/Token/AbstractToken.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,9 @@ public function __serialize(): array
163163
}
164164

165165
/**
166-
* {@inheritdoc}
166+
* @return string
167167
*
168168
* @final since Symfony 4.3, use __serialize() instead
169-
*
170169
* @internal since Symfony 4.3, use __serialize() instead
171170
*/
172171
public function serialize()

Exception/AuthenticationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function unserialize($serialized)
113113
/**
114114
* @internal
115115
*/
116-
public function __sleep()
116+
public function __sleep(): array
117117
{
118118
if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'serialize'))->getDeclaringClass()->name) {
119119
@trigger_error(sprintf('Implementing the "%s::serialize()" method is deprecated since Symfony 4.3, implement the __serialize() and __unserialize() methods instead.', $c), E_USER_DEPRECATED);

Tests/Authentication/AuthenticationTrustResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function __serialize(): array
152152
{
153153
}
154154

155-
public function serialize()
155+
public function serialize(): string
156156
{
157157
}
158158

Tests/Authentication/Token/AbstractTokenTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function __construct($name)
259259
$this->name = $name;
260260
}
261261

262-
public function __toString()
262+
public function __toString(): string
263263
{
264264
return $this->name;
265265
}

Tests/SecurityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private function createContainer($serviceId, $serviceObject)
122122

123123
class StringishUser
124124
{
125-
public function __toString()
125+
public function __toString(): string
126126
{
127127
return 'stringish_user';
128128
}

User/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(?string $username, ?string $password, array $roles =
4545
$this->extraFields = $extraFields;
4646
}
4747

48-
public function __toString()
48+
public function __toString(): string
4949
{
5050
return $this->getUsername();
5151
}

0 commit comments

Comments
 (0)