Skip to content

Commit 116d144

Browse files
Leverage PHP8's get_debug_type()
1 parent edb2547 commit 116d144

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Loader/ObjectLoader.php

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

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

5858
if (!\is_callable([$loaderObject, $method])) {
59-
throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s".', $method, \get_class($loaderObject), $resource));
59+
throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s".', $method, get_debug_type($loaderObject), $resource));
6060
}
6161

6262
$routeCollection = $loaderObject->$method($this);
6363

6464
if (!$routeCollection instanceof RouteCollection) {
65-
$type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection);
65+
$type = get_debug_type($routeCollection);
6666

67-
throw new \LogicException(sprintf('The "%s::%s()" method must return a RouteCollection: "%s" returned.', \get_class($loaderObject), $method, $type));
67+
throw new \LogicException(sprintf('The "%s::%s()" method must return a RouteCollection: "%s" returned.', get_debug_type($loaderObject), $method, $type));
6868
}
6969

7070
// make the object file tracked so that if it changes, the cache rebuilds

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
],
1818
"require": {
1919
"php": "^7.2.5",
20-
"symfony/deprecation-contracts": "^2.1"
20+
"symfony/deprecation-contracts": "^2.1",
21+
"symfony/polyfill-php80": "^1.15"
2122
},
2223
"require-dev": {
2324
"symfony/config": "^5.0",

0 commit comments

Comments
 (0)