mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 14:38:47 +02:00
⬆️ N°4770 Update to latest Symfony 3.4
This commit is contained in:
@@ -213,7 +213,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
return $this->extensionsByNs[$name];
|
||||
}
|
||||
|
||||
throw new LogicException(sprintf('Container extension "%s" is not registered', $name));
|
||||
throw new LogicException(sprintf('Container extension "%s" is not registered.', $name));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,7 +334,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
*/
|
||||
public function addClassResource(\ReflectionClass $class)
|
||||
{
|
||||
@trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the addObjectResource() or the getReflectionClass() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the addObjectResource() or the getReflectionClass() method instead.', \E_USER_DEPRECATED);
|
||||
|
||||
return $this->addObjectResource($class->name);
|
||||
}
|
||||
@@ -474,10 +474,10 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
if (\func_num_args() >= 3) {
|
||||
$priority = func_get_arg(2);
|
||||
} else {
|
||||
if (__CLASS__ !== \get_class($this)) {
|
||||
if (__CLASS__ !== static::class) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
|
||||
@trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), \E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
|
||||
{
|
||||
if ($this->isCompiled() && isset($this->removedIds[$id = $this->normalizeId($id)])) {
|
||||
@trigger_error(sprintf('Fetching the "%s" private service or alias is deprecated since Symfony 3.4 and will fail in 4.0. Make it public instead.', $id), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Fetching the "%s" private service or alias is deprecated since Symfony 3.4 and will fail in 4.0. Make it public instead.', $id), \E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
return $this->doGet($id, $invalidBehavior);
|
||||
@@ -768,7 +768,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
if (__CLASS__ !== static::class) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
if (__CLASS__ !== $r->getDeclaringClass()->getName() && (1 > $r->getNumberOfParameters() || 'resolveEnvPlaceholders' !== $r->getParameters()[0]->name)) {
|
||||
@trigger_error(sprintf('The %s::compile() method expects a first "$resolveEnvPlaceholders" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The %s::compile() method expects a first "$resolveEnvPlaceholders" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), \E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
$resolveEnvPlaceholders = false;
|
||||
@@ -866,7 +866,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
$alias = $this->normalizeId($alias);
|
||||
|
||||
if ('' === $alias || '\\' === substr($alias, -1) || \strlen($alias) !== strcspn($alias, "\0\r\n'")) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s"', $alias));
|
||||
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s".', $alias));
|
||||
}
|
||||
|
||||
if (\is_string($id)) {
|
||||
@@ -1017,13 +1017,13 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
public function setDefinition($id, Definition $definition)
|
||||
{
|
||||
if ($this->isCompiled()) {
|
||||
throw new BadMethodCallException('Adding definition to a compiled container is not allowed');
|
||||
throw new BadMethodCallException('Adding definition to a compiled container is not allowed.');
|
||||
}
|
||||
|
||||
$id = $this->normalizeId($id);
|
||||
|
||||
if ('' === $id || '\\' === substr($id, -1) || \strlen($id) !== strcspn($id, "\0\r\n'")) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid service id: "%s"', $id));
|
||||
throw new InvalidArgumentException(sprintf('Invalid service id: "%s".', $id));
|
||||
}
|
||||
|
||||
unset($this->aliasDefinitions[$id], $this->removedIds[$id]);
|
||||
@@ -1124,7 +1124,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
}
|
||||
|
||||
if ($definition->isDeprecated()) {
|
||||
@trigger_error($definition->getDeprecationMessage($id), E_USER_DEPRECATED);
|
||||
@trigger_error($definition->getDeprecationMessage($id), \E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
if ($tryProxy && $definition->isLazy() && !$tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator) {
|
||||
@@ -1152,7 +1152,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
if (\is_array($factory)) {
|
||||
$factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]];
|
||||
} elseif (!\is_string($factory)) {
|
||||
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id));
|
||||
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory.', $id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1167,19 +1167,19 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
$r = new \ReflectionClass($factory[0]);
|
||||
|
||||
if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) {
|
||||
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name), \E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$r = new \ReflectionClass($class = $parameterBag->resolveValue($definition->getClass()));
|
||||
|
||||
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments);
|
||||
$service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs(array_values($arguments));
|
||||
// don't trigger deprecations for internal uses
|
||||
// @deprecated since version 3.3, to be removed in 4.0 along with the deprecated class
|
||||
$deprecationWhitelist = ['event_dispatcher' => ContainerAwareEventDispatcher::class];
|
||||
$deprecationAllowlist = ['event_dispatcher' => ContainerAwareEventDispatcher::class];
|
||||
|
||||
if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ") && (!isset($deprecationWhitelist[$id]) || $deprecationWhitelist[$id] !== $class)) {
|
||||
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), E_USER_DEPRECATED);
|
||||
if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ") && (!isset($deprecationAllowlist[$id]) || $deprecationAllowlist[$id] !== $class)) {
|
||||
@trigger_error(sprintf('The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name), \E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1439,7 +1439,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
$completed = true;
|
||||
} else {
|
||||
if (!\is_string($resolved) && !is_numeric($resolved)) {
|
||||
throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type %s inside string value "%s".', $env, \gettype($resolved), $this->resolveEnvPlaceholders($value)));
|
||||
throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, \gettype($resolved), $this->resolveEnvPlaceholders($value)));
|
||||
}
|
||||
$value = str_ireplace($placeholder, $resolved, $value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user