Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79165a4

Browse files
committed
minor #57642 [Routing] Remove dead is_object() check (derrabus)
This PR was merged into the 7.2 branch. Discussion ---------- [Routing] Remove dead `is_object()` check | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | N/A | License | MIT Right after we call `ObjectLoader::getObject()`, we check if the returned value is actually an object. Since 6.0 (#42509), that method has a native return type of `object`, so we can be pretty sure that we won't ever not hold an object in our hands here. Commits ------- f734932 [Router] Remove dead is_object() check
2 parents 68a5704 + f734932 commit 79165a4

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ public function load(mixed $resource, ?string $type = null): RouteCollection
4444

4545
$loaderObject = $this->getObject($parts[0]);
4646

47-
if (!\is_object($loaderObject)) {
48-
throw new \TypeError(\sprintf('"%s:getObject()" must return an object: "%s" returned.', static::class, get_debug_type($loaderObject)));
49-
}
50-
5147
if (!\is_callable([$loaderObject, $method])) {
5248
throw new \BadMethodCallException(\sprintf('Method "%s" not found on "%s" when importing routing resource "%s".', $method, get_debug_type($loaderObject), $resource));
5349
}

0 commit comments

Comments
 (0)