Skip to content

Commit e64bf4e

Browse files
minor symfony#57571 Add return type to __toString() methods (seriquynh)
This PR was merged into the 7.2 branch. Discussion ---------- Add return type to `__toString()` methods | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | N/A | License | MIT CompletionInput::__toString() method should have string as the return type, synchronized with it's parent class. Commits ------- 3934380 Add return type to __toString() methods
2 parents ad842aa + 3934380 commit e64bf4e

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/Symfony/Component/Console/Completion/CompletionInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private function isCursorFree(): bool
226226
return $this->currentIndex >= $nrOfTokens;
227227
}
228228

229-
public function __toString()
229+
public function __toString(): string
230230
{
231231
$str = '';
232232
foreach ($this->tokens as $i => $token) {

src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ public function loadEnvVars(): array
871871
'FOO_ENV_LOADER' => '123',
872872
'BAZ_ENV_LOADER' => '',
873873
'LAZY_ENV_LOADER' => new class() {
874-
public function __toString()
874+
public function __toString(): string
875875
{
876876
return '';
877877
}
@@ -888,7 +888,7 @@ public function loadEnvVars(): array
888888
'BAR_ENV_LOADER' => '456',
889889
'BAZ_ENV_LOADER' => '567',
890890
'LAZY_ENV_LOADER' => new class() {
891-
public function __toString()
891+
public function __toString(): string
892892
{
893893
return '678';
894894
}

src/Symfony/Component/HttpClient/Tests/MockHttpClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ public function testStringableBodyParam()
519519
$client = new MockHttpClient();
520520

521521
$param = new class() {
522-
public function __toString()
522+
public function __toString(): string
523523
{
524524
return 'bar';
525525
}

src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ protected function getRoutes($name, Route $route)
10761076

10771077
class StringableObject
10781078
{
1079-
public function __toString()
1079+
public function __toString(): string
10801080
{
10811081
return 'bar';
10821082
}
@@ -1086,7 +1086,7 @@ class StringableObjectWithPublicProperty
10861086
{
10871087
public $foo = 'property';
10881088

1089-
public function __toString()
1089+
public function __toString(): string
10901090
{
10911091
return 'bar';
10921092
}

src/Symfony/Component/Security/Http/Tests/Authenticator/FormLoginAuthenticatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function testHandleNonStringPasswordWithArray(bool $postOnly)
176176
public function testHandleNonStringPasswordWithToString(bool $postOnly)
177177
{
178178
$passwordObject = new class() {
179-
public function __toString()
179+
public function __toString(): string
180180
{
181181
return 's$cr$t';
182182
}

0 commit comments

Comments
 (0)