Add symfony/polyfill-80

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

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

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

Loading…
Cancel
Save