mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 05: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:
@@ -19,21 +19,23 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||
use Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\TypedReference;
|
||||
use Symfony\Component\VarExporter\ProxyHelper;
|
||||
|
||||
/**
|
||||
* @author Guilhem Niot <guilhem.niot@gmail.com>
|
||||
*/
|
||||
class ResolveBindingsPass extends AbstractRecursivePass
|
||||
{
|
||||
private $usedBindings = [];
|
||||
private $unusedBindings = [];
|
||||
private $errorMessages = [];
|
||||
protected bool $skipScalars = true;
|
||||
|
||||
private array $usedBindings = [];
|
||||
private array $unusedBindings = [];
|
||||
private array $errorMessages = [];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
@@ -90,10 +92,7 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function processValue($value, bool $isRoot = false)
|
||||
protected function processValue(mixed $value, bool $isRoot = false): mixed
|
||||
{
|
||||
if ($value instanceof TypedReference && $value->getType() === (string) $value) {
|
||||
// Already checked
|
||||
@@ -177,15 +176,23 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
||||
}
|
||||
}
|
||||
|
||||
$names = [];
|
||||
|
||||
foreach ($reflectionMethod->getParameters() as $key => $parameter) {
|
||||
$names[$key] = $parameter->name;
|
||||
|
||||
if (\array_key_exists($key, $arguments) && '' !== $arguments[$key]) {
|
||||
continue;
|
||||
}
|
||||
if (\array_key_exists($parameter->name, $arguments) && '' !== $arguments[$parameter->name]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$typeHint = ltrim(ProxyHelper::exportType($parameter) ?? '', '?');
|
||||
|
||||
$typeHint = ProxyHelper::getTypeHint($reflectionMethod, $parameter);
|
||||
$name = Target::parseName($parameter);
|
||||
|
||||
if ($typeHint && \array_key_exists($k = ltrim($typeHint, '\\').' $'.$name, $bindings)) {
|
||||
if ($typeHint && \array_key_exists($k = preg_replace('/(^|[(|&])\\\\/', '\1', $typeHint).' $'.$name, $bindings)) {
|
||||
$arguments[$key] = $this->getBindingValue($bindings[$k]);
|
||||
|
||||
continue;
|
||||
@@ -210,8 +217,15 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($names as $key => $name) {
|
||||
if (\array_key_exists($name, $arguments) && (0 === $key || \array_key_exists($key - 1, $arguments))) {
|
||||
$arguments[$key] = $arguments[$name];
|
||||
unset($arguments[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($arguments !== $call[1]) {
|
||||
ksort($arguments);
|
||||
ksort($arguments, \SORT_NATURAL);
|
||||
$calls[$i][1] = $arguments;
|
||||
}
|
||||
}
|
||||
@@ -231,10 +245,7 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
||||
return parent::processValue($value, $isRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
private function getBindingValue(BoundArgument $binding)
|
||||
private function getBindingValue(BoundArgument $binding): mixed
|
||||
{
|
||||
[$bindingValue, $bindingId] = $binding->getValues();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user