Add symfony/polyfill-80

pull/567/head
fadrian06 10 months ago
parent 62f15baf55
commit e322135d9c

@ -25,6 +25,8 @@
"require": {
"php": "^7.4|^8.0|^8.1|^8.2|^8.3",
"ext-json": "*"
"ext-json": "*",
"symfony/polyfill-php80": "^1.29"
},
"autoload": {
"files": [

@ -251,7 +251,10 @@ class Dispatcher
*/
public function execute($callback, array &$params = [])
{
if (is_string($callback) === true && (strpos($callback, '->') !== false || strpos($callback, '::') !== false)) {
if (
is_string($callback)
&& (str_contains($callback, '->') || str_contains($callback, '::'))
) {
$callback = $this->parseStringClassAndMethod($callback);
}
@ -327,27 +330,21 @@ class Dispatcher
}
[$class, $method] = $func;
$resolvedClass = null;
// Only execute the container handler if it's not a Flight class
if (
$this->containerHandler !== null &&
(
(
is_object($class) === true &&
strpos(get_class($class), 'flight\\') === false
) ||
is_string($class) === true
)
) {
$containerHandler = $this->containerHandler;
$resolvedClass = $this->resolveContainerClass($containerHandler, $class, $params);
if ($resolvedClass !== null) {
$mustUseTheContainer = $this->containerHandler && (
(is_object($class) && !str_starts_with(get_class($class), 'flight\\'))
|| is_string($class)
);
if ($mustUseTheContainer) {
$resolvedClass = $this->resolveContainerClass($class, $params);
if ($resolvedClass) {
$class = $resolvedClass;
}
}
$this->verifyValidClassCallable($class, $method, $resolvedClass);
$this->verifyValidClassCallable($class, $method, $resolvedClass ?? null);
// Class is a string, and method exists, create the object by hand and inject only the Engine
if (is_string($class) === true) {

Loading…
Cancel
Save