Skip to content

Commit

Permalink
[Routing] Fix ContainerLoader and ObjectLoaderTest
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyweb committed Nov 18, 2019
1 parent 15f7ea1 commit 0e5db6a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/Loader/ContainerLoader.php
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/Loader/ObjectLoader.php
Expand Up @@ -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])) {
Expand Down
Expand Up @@ -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');
Expand Down

0 comments on commit 0e5db6a

Please sign in to comment.