Skip to content

Commit 1113c4b

Browse files
Merge branch '5.4' into 6.0
* 5.4: [Mailer] Include all transports' debug messages in RoundRobin transport exception [FrameworkBundle] fix: fix help message Use relative timestamps [Cache] Fix dealing with ext-redis' multi/exec returning a bool [Messenger][Amqp] Added missing rpc_timeout option [Serializer] Prevent GetSetMethodNormalizer from creating invalid magic method call [HttpFoundation] Fix dumping array cookies [WebProfilerBundle] Fix dump header not being displayed TraceableHttpClient: increase decorator's priority Use static methods inside data providers [FrameworkBundle] Allow configuring `framework.exceptions` with a config builder bug #48313 [Mime] Fix MessagePart serialization [ErrorHandler][DebugClassLoader] Fix some new return types support Fix getting the name of closures on PHP 8.1.11+ [Translator] Fix typo "internal" / "interval" fix dumping top-level tagged values
2 parents f000c16 + b900446 commit 1113c4b

File tree

5 files changed

+48
-1
lines changed

5 files changed

+48
-1
lines changed

DebugClassLoader.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class DebugClassLoader
5656
'null' => 'null',
5757
'resource' => 'resource',
5858
'boolean' => 'bool',
59-
'true' => 'bool',
59+
'true' => 'true',
6060
'false' => 'false',
6161
'integer' => 'int',
6262
'array' => 'array',
@@ -74,6 +74,7 @@ class DebugClassLoader
7474
'$this' => 'static',
7575
'list' => 'array',
7676
'class-string' => 'string',
77+
'never' => 'never',
7778
];
7879

7980
private const BUILTIN_RETURN_TYPES = [
@@ -91,6 +92,9 @@ class DebugClassLoader
9192
'parent' => true,
9293
'mixed' => true,
9394
'static' => true,
95+
'null' => true,
96+
'true' => true,
97+
'never' => true,
9498
];
9599

96100
private const MAGIC_METHODS = [
@@ -765,6 +769,12 @@ private function setReturnType(string $types, string $class, string $method, str
765769
return;
766770
}
767771

772+
if ('null' === $types) {
773+
self::$returnTypes[$class][$method] = ['null', 'null', $class, $filename];
774+
775+
return;
776+
}
777+
768778
if ($nullable = 0 === strpos($types, 'null|')) {
769779
$types = substr($types, 5);
770780
} elseif ($nullable = '|null' === substr($types, -5)) {

Internal/TentativeTypes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ class TentativeTypes
753753
'isVariadic' => 'bool',
754754
'isStatic' => 'bool',
755755
'getClosureThis' => '?object',
756+
'getClosureCalledClass' => '?ReflectionClass',
756757
'getClosureScopeClass' => '?ReflectionClass',
757758
'getDocComment' => 'string|false',
758759
'getEndLine' => 'int|false',

Tests/DebugClassLoaderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ class_exists('Test\\'.ReturnType::class, true);
398398
'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::mixed()" might add "mixed" as a native return type declaration in the future. Do the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" now to avoid errors or add an explicit @return annotation to suppress this message.',
399399
'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::nullableMixed()" might add "mixed" as a native return type declaration in the future. Do the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" now to avoid errors or add an explicit @return annotation to suppress this message.',
400400
'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::static()" might add "static" as a native return type declaration in the future. Do the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" now to avoid errors or add an explicit @return annotation to suppress this message.',
401+
'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::false()" might add "false" as a native return type declaration in the future. Do the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" now to avoid errors or add an explicit @return annotation to suppress this message.',
402+
'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::true()" might add "true" as a native return type declaration in the future. Do the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" now to avoid errors or add an explicit @return annotation to suppress this message.',
403+
'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::never()" might add "never" as a native return type declaration in the future. Do the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" now to avoid errors or add an explicit @return annotation to suppress this message.',
404+
'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::null()" might add "null" as a native return type declaration in the future. Do the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" now to avoid errors or add an explicit @return annotation to suppress this message.',
401405
], $deprecations);
402406
}
403407
}

Tests/Fixtures/ReturnType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,9 @@ public function this() { }
4646
public function mixed() { }
4747
public function nullableMixed() { }
4848
public function static() { }
49+
public function false() { }
50+
public function true() { }
51+
public function never() { }
52+
public function null() { }
4953
public function outsideMethod() { }
5054
}

Tests/Fixtures/ReturnTypeParent.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,34 @@ public function static()
220220
{
221221
}
222222

223+
/**
224+
* @return false
225+
*/
226+
public function false()
227+
{
228+
}
229+
230+
/**
231+
* @return true
232+
*/
233+
public function true()
234+
{
235+
}
236+
237+
/**
238+
* @return never
239+
*/
240+
public function never()
241+
{
242+
}
243+
244+
/**
245+
* @return null
246+
*/
247+
public function null()
248+
{
249+
}
250+
223251
/**
224252
* @return int
225253
*/

0 commit comments

Comments
 (0)