diff --git a/composer.json b/composer.json index 9d8f6e8..9384c12 100644 --- a/composer.json +++ b/composer.json @@ -24,8 +24,7 @@ ], "require": { "php": "^7.4|^8.0|^8.1|^8.2|^8.3", - "ext-json": "*", - "symfony/polyfill-php80": "^1.29" + "ext-json": "*" }, "autoload": { "files": [ diff --git a/flight/core/Dispatcher.php b/flight/core/Dispatcher.php index 5604d69..fd3eac7 100644 --- a/flight/core/Dispatcher.php +++ b/flight/core/Dispatcher.php @@ -277,8 +277,8 @@ class Dispatcher public function execute($callback, array &$params = []) { if ( - is_string($callback) - && (str_contains($callback, '->') || str_contains($callback, '::')) + is_string($callback) === true + && (strpos($callback, '->') !== false || strpos($callback, '::') !== false) ) { $callback = $this->parseStringClassAndMethod($callback); } @@ -347,7 +347,7 @@ class Dispatcher public function invokeCallable($func, array &$params = []) { // If this is a directly callable function, call it - if (!is_array($func)) { + if (is_array($func) === false) { $this->verifyValidFunction($func); return call_user_func_array($func, $params); @@ -355,12 +355,12 @@ class Dispatcher [$class, $method] = $func; - $mustUseTheContainer = $this->containerHandler && ( - (is_object($class) && !str_starts_with(get_class($class), 'flight\\')) + $mustUseTheContainer = $this->containerHandler !== null && ( + (is_object($class) === true && strpos(get_class($class), 'flight\\') === false) || is_string($class) ); - if ($mustUseTheContainer) { + if ($mustUseTheContainer === true) { $resolvedClass = $this->resolveContainerClass($class, $params); if ($resolvedClass) { @@ -408,20 +408,20 @@ class Dispatcher $exception = null; // Final check to make sure it's actually a class and a method, or throw an error - if (!is_object($class) && !class_exists($class)) { + if (is_object($class) === false && class_exists($class) === false) { $exception = new Exception("Class '$class' not found. Is it being correctly autoloaded with Flight::path()?"); // If this tried to resolve a class in a container and failed somehow, throw the exception - } elseif (!$resolvedClass && $this->containerException) { + } elseif (!$resolvedClass && $this->containerException !== null) { $exception = $this->containerException; // Class is there, but no method - } elseif (is_object($class) && !method_exists($class, $method)) { + } elseif (is_object($class) === true && method_exists($class, $method) === false) { $classNamespace = get_class($class); $exception = new Exception("Class found, but method '$classNamespace::$method' not found."); } - if ($exception) { + if ($exception !== null) { $this->fixOutputBuffering(); throw $exception;