diff --git a/ControllerMetadata/ArgumentMetadataFactory.php b/ControllerMetadata/ArgumentMetadataFactory.php index 9370174c25..05a68229a3 100644 --- a/ControllerMetadata/ArgumentMetadataFactory.php +++ b/ControllerMetadata/ArgumentMetadataFactory.php @@ -48,7 +48,7 @@ private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbs if (!$type = $parameter->getType()) { return null; } - $name = $type->getName(); + $name = $type instanceof \ReflectionNamedType ? $type->getName() : (string) $type; if ($function instanceof \ReflectionMethod) { $lcName = strtolower($name); diff --git a/DependencyInjection/AddAnnotatedClassesToCachePass.php b/DependencyInjection/AddAnnotatedClassesToCachePass.php index 70a987ebf4..5eb833b51d 100644 --- a/DependencyInjection/AddAnnotatedClassesToCachePass.php +++ b/DependencyInjection/AddAnnotatedClassesToCachePass.php @@ -127,10 +127,10 @@ private function patternsToRegexps(array $patterns): array private function matchAnyRegexps(string $class, array $regexps): bool { - $blacklisted = false !== strpos($class, 'Test'); + $isTest = false !== strpos($class, 'Test'); foreach ($regexps as $regex) { - if ($blacklisted && false === strpos($regex, 'Test')) { + if ($isTest && false === strpos($regex, 'Test')) { continue; } diff --git a/EventListener/ErrorListener.php b/EventListener/ErrorListener.php index 6192a452e3..f5cac76bd8 100644 --- a/EventListener/ErrorListener.php +++ b/EventListener/ErrorListener.php @@ -102,7 +102,7 @@ public function onControllerArguments(ControllerArgumentsEvent $event) $r = new \ReflectionFunction(\Closure::fromCallable($event->getController())); $r = $r->getParameters()[$k] ?? null; - if ($r && (!$r->hasType() || \in_array($r->getType()->getName(), [FlattenException::class, LegacyFlattenException::class], true))) { + if ($r && (!($r = $r->getType()) instanceof \ReflectionNamedType || \in_array($r->getName(), [FlattenException::class, LegacyFlattenException::class], true))) { $arguments = $event->getArguments(); $arguments[$k] = FlattenException::createFromThrowable($e); $event->setArguments($arguments); diff --git a/Kernel.php b/Kernel.php index 178585762d..a906fdb82e 100644 --- a/Kernel.php +++ b/Kernel.php @@ -73,11 +73,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '5.1.2'; - const VERSION_ID = 50102; + const VERSION = '5.1.3'; + const VERSION_ID = 50103; const MAJOR_VERSION = 5; const MINOR_VERSION = 1; - const RELEASE_VERSION = 2; + const RELEASE_VERSION = 3; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2021'; diff --git a/Tests/Profiler/FileProfilerStorageTest.php b/Tests/Profiler/FileProfilerStorageTest.php index 2bd2a2705b..335797baff 100644 --- a/Tests/Profiler/FileProfilerStorageTest.php +++ b/Tests/Profiler/FileProfilerStorageTest.php @@ -228,9 +228,9 @@ public function testStoreTime() $records = $this->storage->find('', '', 3, 'GET', $start, time() + 3 * 60); $this->assertCount(3, $records, '->find() returns all previously added records'); - $this->assertEquals($records[0]['token'], 'time_2', '->find() returns records ordered by time in descendant order'); - $this->assertEquals($records[1]['token'], 'time_1', '->find() returns records ordered by time in descendant order'); - $this->assertEquals($records[2]['token'], 'time_0', '->find() returns records ordered by time in descendant order'); + $this->assertEquals('time_2', $records[0]['token'], '->find() returns records ordered by time in descendant order'); + $this->assertEquals('time_1', $records[1]['token'], '->find() returns records ordered by time in descendant order'); + $this->assertEquals('time_0', $records[2]['token'], '->find() returns records ordered by time in descendant order'); $records = $this->storage->find('', '', 3, 'GET', $start, time() + 2 * 60); $this->assertCount(2, $records, '->find() should return only first two of the previously added records');