Skip to content

Commit 4ad439e

Browse files
committed
Fix 8.1 compat, avoid class_exists(null)
1 parent df4ca79 commit 4ad439e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Vectorface/SnappyRouter/SnappyRouter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function handleCliRoute($pathComponents)
127127
*
128128
* @param bool $isCli True for CLI handlers, false otherwise.
129129
* @param array $handlerParams An array parameters required by the handler.
130-
* @return AbstractHandler Returns the handler to be used for the route.
130+
* @return string Returns the result of the route.
131131
*/
132132
private function invokeHandler($isCli, $handlerParams)
133133
{
@@ -232,7 +232,7 @@ private function parseConfig()
232232
{
233233
// setup the DI layer
234234
$diClass = $this->config->get(Config::KEY_DI);
235-
if (class_exists($diClass)) {
235+
if ($diClass && class_exists($diClass)) {
236236
$di = new $diClass();
237237
if ($di instanceof DiInterface) {
238238
Di::setDefault($di);
@@ -263,9 +263,9 @@ private function setupHandlers($handlers)
263263
$handlerClass = $handlerDetails[Config::KEY_CLASS];
264264
}
265265

266-
if (!class_exists($handlerClass)) {
266+
if ($handlerClass && !class_exists($handlerClass)) {
267267
throw new Exception(
268-
'Cannot instantiate instance of '.$handlerClass
268+
"Cannot instantiate instance of $handlerClass"
269269
);
270270
}
271271
$this->handlers[] = new $handlerClass($options);

0 commit comments

Comments
 (0)