mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
migration symfony 5 4 (#300)
* symfony 5.4 (diff dev) * symfony 5.4 (working) * symfony 5.4 (update autoload) * symfony 5.4 (remove swiftmailer mailer implementation) * symfony 5.4 (php doc and split Global accessor class) ### Impacted packages: composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
@@ -26,8 +26,12 @@ class ResolveHotPathPass extends AbstractRecursivePass
|
||||
private $tagName;
|
||||
private $resolvedIds = [];
|
||||
|
||||
public function __construct($tagName = 'container.hot_path')
|
||||
public function __construct(string $tagName = 'container.hot_path')
|
||||
{
|
||||
if (0 < \func_num_args()) {
|
||||
trigger_deprecation('symfony/dependency-injection', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
|
||||
}
|
||||
|
||||
$this->tagName = $tagName;
|
||||
}
|
||||
|
||||
@@ -47,19 +51,34 @@ class ResolveHotPathPass extends AbstractRecursivePass
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function processValue($value, $isRoot = false)
|
||||
protected function processValue($value, bool $isRoot = false)
|
||||
{
|
||||
if ($value instanceof ArgumentInterface) {
|
||||
return $value;
|
||||
}
|
||||
if ($value instanceof Definition && $isRoot && (isset($this->resolvedIds[$this->currentId]) || !$value->hasTag($this->tagName) || $value->isDeprecated())) {
|
||||
return $value->isDeprecated() ? $value->clearTag($this->tagName) : $value;
|
||||
|
||||
if ($value instanceof Definition && $isRoot) {
|
||||
if ($value->isDeprecated()) {
|
||||
return $value->clearTag($this->tagName);
|
||||
}
|
||||
|
||||
$this->resolvedIds[$this->currentId] = true;
|
||||
|
||||
if (!$value->hasTag($this->tagName)) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
if ($value instanceof Reference && ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE !== $value->getInvalidBehavior() && $this->container->has($id = $this->container->normalizeId($value))) {
|
||||
$definition = $this->container->findDefinition($id);
|
||||
if (!$definition->hasTag($this->tagName) && !$definition->isDeprecated()) {
|
||||
$this->resolvedIds[$id] = true;
|
||||
$definition->addTag($this->tagName);
|
||||
|
||||
if ($value instanceof Reference && ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE !== $value->getInvalidBehavior() && $this->container->hasDefinition($id = (string) $value)) {
|
||||
$definition = $this->container->getDefinition($id);
|
||||
|
||||
if ($definition->isDeprecated() || $definition->hasTag($this->tagName)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$definition->addTag($this->tagName);
|
||||
|
||||
if (isset($this->resolvedIds[$id])) {
|
||||
parent::processValue($definition, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user