From 0e5db6a03334afeb3c5cc565a7f8c881ff9a9328 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Mon, 18 Nov 2019 09:28:33 +0100 Subject: [PATCH] [Routing] Fix ContainerLoader and ObjectLoaderTest --- src/Symfony/Component/Routing/Loader/ContainerLoader.php | 2 +- src/Symfony/Component/Routing/Loader/ObjectLoader.php | 2 +- .../Component/Routing/Tests/Loader/ObjectLoaderTest.php | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Routing/Loader/ContainerLoader.php b/src/Symfony/Component/Routing/Loader/ContainerLoader.php index 948da7b101c0a..92bf2a096bf48 100644 --- a/src/Symfony/Component/Routing/Loader/ContainerLoader.php +++ b/src/Symfony/Component/Routing/Loader/ContainerLoader.php @@ -30,7 +30,7 @@ public function __construct(ContainerInterface $container) /** * {@inheritdoc} */ - public function supports($resource, $type = null) + public function supports($resource, string $type = null) { return 'service' === $type; } diff --git a/src/Symfony/Component/Routing/Loader/ObjectLoader.php b/src/Symfony/Component/Routing/Loader/ObjectLoader.php index 2f450f29ed78b..aefb8295115ab 100644 --- a/src/Symfony/Component/Routing/Loader/ObjectLoader.php +++ b/src/Symfony/Component/Routing/Loader/ObjectLoader.php @@ -52,7 +52,7 @@ public function load($resource, string $type = null) $loaderObject = $this->getObject($parts[0]); if (!\is_object($loaderObject)) { - throw new \LogicException(sprintf('%s:getObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject))); + throw new \TypeError(sprintf('%s:getObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject))); } if (!\is_callable([$loaderObject, $method])) { diff --git a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php index f3ece536e915e..1dcdb7c7f9705 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php @@ -62,12 +62,9 @@ public function getBadResourceStrings() ]; } - /** - * @group legacy - */ public function testExceptionOnNoObjectReturned() { - $this->expectException('LogicException'); + $this->expectException(\TypeError::class); $loader = new TestObjectLoader(); $loader->loaderMap = ['my_service' => 'NOT_AN_OBJECT']; $loader->load('my_service::method'); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy