8000 bug #34434 [Routing] Fix ContainerLoader and ObjectLoaderTest (fancyweb) · symfony/symfony@123c84a · GitHub
[go: up one dir, main page]

Skip to content

Commit 123c84a

Browse files
committed
bug #34434 [Routing] Fix ContainerLoader and ObjectLoaderTest (fancyweb)
This PR was merged into the 5.0 branch. Discussion ---------- [Routing] Fix ContainerLoader and ObjectLoaderTest | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 0e5db6a [Routing] Fix ContainerLoader and ObjectLoaderTest
2 parents 15f7ea1 + 0e5db6a commit 123c84a

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/Symfony/Component/Routing/Loader/ContainerLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(ContainerInterface $container)
3030
/**
3131
* {@inheritdoc}
3232
*/
33-
public function supports($resource, $type = null)
33+
public function supports($resource, string $type = null)
3434
{
3535
return 'service' === $type;
3636
}

src/Symfony/Component/Routing/Loader/ObjectLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function load($resource, string $type = null)
5252
$loaderObject = $this->getObject($parts[0]);
5353

5454
if (!\is_object($loaderObject)) {
55-
throw new \LogicException(sprintf('%s:getObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject)));
55+
throw new \TypeError(sprintf('%s:getObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject)));
5656
}
5757

5858
if (!\is_callable([$loaderObject, $method])) {

src/Symfony/Component/Routing/Tests/Loader/ObjectLoaderTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,9 @@ public function getBadResourceStrings()
6262
];
6363
}
6464

65-
/**
66-
* @group legacy
67-
*/
6865
public function testExceptionOnNoObjectReturned()
6966
{
70-
$this->expectException('LogicException');
67+
$this->expectException(\TypeError::class);
7168
$loader = new TestObjectLoader();
7269
$loader->loaderMap = ['my_service' => 'NOT_AN_OBJECT'];
7370
$loader->load('my_service::method');

0 commit comments

Comments
 (0)
0