mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-04 07:58:46 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -24,7 +24,7 @@ class ClassStub extends ConstStub
|
||||
* @param string $identifier A PHP identifier, e.g. a class, method, interface, etc. name
|
||||
* @param callable $callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier
|
||||
*/
|
||||
public function __construct(string $identifier, $callable = null)
|
||||
public function __construct(string $identifier, callable|array|string $callable = null)
|
||||
{
|
||||
$this->value = $identifier;
|
||||
|
||||
@@ -50,15 +50,13 @@ class ClassStub extends ConstStub
|
||||
if (\is_array($r)) {
|
||||
try {
|
||||
$r = new \ReflectionMethod($r[0], $r[1]);
|
||||
} catch (\ReflectionException $e) {
|
||||
} catch (\ReflectionException) {
|
||||
$r = new \ReflectionClass($r[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (str_contains($identifier, "@anonymous\0")) {
|
||||
$this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
|
||||
return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
|
||||
}, $identifier);
|
||||
$this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $identifier);
|
||||
}
|
||||
|
||||
if (null !== $callable && $r instanceof \ReflectionFunctionAbstract) {
|
||||
@@ -71,7 +69,7 @@ class ClassStub extends ConstStub
|
||||
$this->value .= $s;
|
||||
}
|
||||
}
|
||||
} catch (\ReflectionException $e) {
|
||||
} catch (\ReflectionException) {
|
||||
return;
|
||||
} finally {
|
||||
if (0 < $i = strrpos($this->value, '\\')) {
|
||||
@@ -87,7 +85,10 @@ class ClassStub extends ConstStub
|
||||
}
|
||||
}
|
||||
|
||||
public static function wrapCallable($callable)
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public static function wrapCallable(mixed $callable)
|
||||
{
|
||||
if (\is_object($callable) || !\is_callable($callable)) {
|
||||
return $callable;
|
||||
|
||||
Reference in New Issue
Block a user