@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | foreach ($container->getDefinitions() as $id => $definition) { |
| 38 | 38 | // synthetic service is public |
| 39 | - if ($definition->isSynthetic() && !($definition->isPublic() || $definition->isPrivate())) { |
|
| 39 | + if ($definition->isSynthetic() && ! ($definition->isPublic() || $definition->isPrivate())) { |
|
| 40 | 40 | throw new RuntimeException(\sprintf('A synthetic service ("%s") must be public.', $id)); |
| 41 | 41 | } |
| 42 | 42 | // non-synthetic, non-abstract service has class |
| 43 | - if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass()) { |
|
| 43 | + if ( ! $definition->isAbstract() && ! $definition->isSynthetic() && ! $definition->getClass()) { |
|
| 44 | 44 | if ($definition->getFactory()) { |
| 45 | 45 | throw new RuntimeException(\sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); |
| 46 | 46 | } |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | foreach ($definition->getTags() as $name => $tags) { |
| 57 | 57 | foreach ($tags as $attributes) { |
| 58 | 58 | foreach ($attributes as $attribute => $value) { |
| 59 | - if (!\is_scalar($value) && null !== $value) { |
|
| 59 | + if ( ! \is_scalar($value) && null !== $value) { |
|
| 60 | 60 | throw new RuntimeException(\sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $id, $name, $attribute)); |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | - if ($definition->isPublic() && !$definition->isPrivate()) { |
|
| 65 | + if ($definition->isPublic() && ! $definition->isPrivate()) { |
|
| 66 | 66 | $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); |
| 67 | 67 | if (null !== $usedEnvs) { |
| 68 | 68 | throw new EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.'); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | foreach ($container->getAliases() as $id => $alias) { |
| 73 | - if ($alias->isPublic() && !$alias->isPrivate()) { |
|
| 73 | + if ($alias->isPublic() && ! $alias->isPrivate()) { |
|
| 74 | 74 | $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); |
| 75 | 75 | if (null !== $usedEnvs) { |
| 76 | 76 | throw new EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.'); |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | protected function processValue($value, $isRoot = \false) |
| 28 | 28 | { |
| 29 | - if (!$value instanceof Definition || !$value->hasTag('container.service_locator')) { |
|
| 29 | + if ( ! $value instanceof Definition || ! $value->hasTag('container.service_locator')) { |
|
| 30 | 30 | return parent::processValue($value, $isRoot); |
| 31 | 31 | } |
| 32 | - if (!$value->getClass()) { |
|
| 32 | + if ( ! $value->getClass()) { |
|
| 33 | 33 | $value->setClass(ServiceLocator::class); |
| 34 | 34 | } |
| 35 | 35 | $arguments = $value->getArguments(); |
| 36 | - if (!isset($arguments[0]) || !\is_array($arguments[0])) { |
|
| 36 | + if ( ! isset($arguments[0]) || ! \is_array($arguments[0])) { |
|
| 37 | 37 | throw new InvalidArgumentException(\sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set.', $this->currentId)); |
| 38 | 38 | } |
| 39 | 39 | $i = 0; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | if ($v instanceof ServiceClosureArgument) { |
| 42 | 42 | continue; |
| 43 | 43 | } |
| 44 | - if (!$v instanceof Reference) { |
|
| 44 | + if ( ! $v instanceof Reference) { |
|
| 45 | 45 | throw new InvalidArgumentException(\sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set, "%s" found for key "%s".', $this->currentId, \is_object($v) ? \get_class($v) : \gettype($v), $k)); |
| 46 | 46 | } |
| 47 | 47 | if ($i === $k) { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | \ksort($arguments[0]); |
| 57 | 57 | $value->setArguments($arguments); |
| 58 | - $id = 'service_locator.' . ContainerBuilder::hash($value); |
|
| 58 | + $id = 'service_locator.'.ContainerBuilder::hash($value); |
|
| 59 | 59 | if ($isRoot) { |
| 60 | 60 | if ($id !== $this->currentId) { |
| 61 | 61 | $this->container->setAlias($id, new Alias($this->currentId, \false)); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | public static function register(ContainerBuilder $container, array $refMap, $callerId = null) |
| 75 | 75 | { |
| 76 | 76 | foreach ($refMap as $id => $ref) { |
| 77 | - if (!$ref instanceof Reference) { |
|
| 77 | + if ( ! $ref instanceof Reference) { |
|
| 78 | 78 | throw new InvalidArgumentException(\sprintf('Invalid service locator definition: only services can be referenced, "%s" found for key "%s". Inject parameter values using constructors instead.', \is_object($ref) ? \get_class($ref) : \gettype($ref), $id)); |
| 79 | 79 | } |
| 80 | 80 | $refMap[$id] = new ServiceClosureArgument($ref); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | if (null !== $callerId && $container->hasDefinition($callerId)) { |
| 85 | 85 | $locator->setBindings($container->getDefinition($callerId)->getBindings()); |
| 86 | 86 | } |
| 87 | - if (!$container->hasDefinition($id = 'service_locator.' . ContainerBuilder::hash($locator))) { |
|
| 87 | + if ( ! $container->hasDefinition($id = 'service_locator.'.ContainerBuilder::hash($locator))) { |
|
| 88 | 88 | $container->setDefinition($id, $locator); |
| 89 | 89 | } |
| 90 | 90 | if (null !== $callerId) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | // Locators are shared when they hold the exact same list of factories; |
| 93 | 93 | // to have them specialized per consumer service, we use a cloning factory |
| 94 | 94 | // to derivate customized instances from the prototype one. |
| 95 | - $container->register($id .= '.' . $callerId, ServiceLocator::class)->setPublic(\false)->setFactory([new Reference($locatorId), 'withContext'])->addArgument($callerId)->addArgument(new Reference('service_container')); |
|
| 95 | + $container->register($id .= '.'.$callerId, ServiceLocator::class)->setPublic(\false)->setFactory([new Reference($locatorId), 'withContext'])->addArgument($callerId)->addArgument(new Reference('service_container')); |
|
| 96 | 96 | } |
| 97 | 97 | return new Reference($id); |
| 98 | 98 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | foreach ($container->findTaggedServiceIds('auto_alias') as $serviceId => $tags) { |
| 27 | 27 | foreach ($tags as $tag) { |
| 28 | - if (!isset($tag['format'])) { |
|
| 28 | + if ( ! isset($tag['format'])) { |
|
| 29 | 29 | throw new InvalidArgumentException(\sprintf('Missing tag information "format" on auto_alias service "%s".', $serviceId)); |
| 30 | 30 | } |
| 31 | 31 | $aliasId = $container->getParameterBag()->resolveValue($tag['format']); |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | namespace Wordlift\Modules\Common\Symfony\Component\DependencyInjection\Compiler; |
| 12 | 12 | |
| 13 | -@\trigger_error('The ' . __NAMESPACE__ . '\\LoggingFormatter class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', \E_USER_DEPRECATED); |
|
| 13 | +@\trigger_error('The '.__NAMESPACE__.'\\LoggingFormatter class is deprecated since Symfony 3.3 and will be removed in 4.0. Use the ContainerBuilder::log() method instead.', \E_USER_DEPRECATED); |
|
| 14 | 14 | /** |
| 15 | 15 | * Used to format logging messages during the compilation. |
| 16 | 16 | * |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | } |
| 59 | 59 | if (1 === \count($referencingAliases) && \false === $isReferenced) { |
| 60 | 60 | $container->setDefinition((string) \reset($referencingAliases), $definition); |
| 61 | - $definition->setPublic(!$definition->isPrivate()); |
|
| 61 | + $definition->setPublic( ! $definition->isPrivate()); |
|
| 62 | 62 | $definition->setPrivate(\reset($referencingAliases)->isPrivate()); |
| 63 | 63 | $container->removeDefinition($id); |
| 64 | 64 | $container->log($this, \sprintf('Removed service "%s"; reason: replaces alias %s.', $id, \reset($referencingAliases))); |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $id = $node->getId(); |
| 53 | 53 | if (empty($this->checkedNodes[$id])) { |
| 54 | 54 | // Don't check circular references for lazy edges |
| 55 | - if (!$node->getValue() || !$edge->isLazy() && !$edge->isWeak()) { |
|
| 55 | + if ( ! $node->getValue() || ! $edge->isLazy() && ! $edge->isWeak()) { |
|
| 56 | 56 | $searchKey = \array_search($id, $this->currentPath); |
| 57 | 57 | $this->currentPath[] = $id; |
| 58 | 58 | if (\false !== $searchKey) { |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | namespace Wordlift\Modules\Common\Symfony\Component\DependencyInjection\Compiler; |
| 12 | 12 | |
| 13 | -@\trigger_error('The ' . __NAMESPACE__ . '\\AutowireExceptionPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the DefinitionErrorExceptionPass class instead.', \E_USER_DEPRECATED); |
|
| 13 | +@\trigger_error('The '.__NAMESPACE__.'\\AutowireExceptionPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the DefinitionErrorExceptionPass class instead.', \E_USER_DEPRECATED); |
|
| 14 | 14 | use Wordlift\Modules\Common\Symfony\Component\DependencyInjection\ContainerBuilder; |
| 15 | 15 | /** |
| 16 | 16 | * Throws autowire exceptions from AutowirePass for definitions that still exist. |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | { |
| 23 | 23 | protected function processValue($value, $isRoot = \false) |
| 24 | 24 | { |
| 25 | - if (!$value instanceof Reference) { |
|
| 25 | + if ( ! $value instanceof Reference) { |
|
| 26 | 26 | return parent::processValue($value, $isRoot); |
| 27 | 27 | } |
| 28 | - if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior() && !$this->container->has($id = (string) $value)) { |
|
| 28 | + if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior() && ! $this->container->has($id = (string) $value)) { |
|
| 29 | 29 | throw new ServiceNotFoundException($id, $this->currentId); |
| 30 | 30 | } |
| 31 | 31 | return $value; |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | $types = []; |
| 33 | 33 | $processors = []; |
| 34 | 34 | foreach ($container->findTaggedServiceIds('container.env_var_processor') as $id => $tags) { |
| 35 | - if (!($r = $container->getReflectionClass($class = $container->getDefinition($id)->getClass()))) { |
|
| 35 | + if ( ! ($r = $container->getReflectionClass($class = $container->getDefinition($id)->getClass()))) { |
|
| 36 | 36 | throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); |
| 37 | - } elseif (!$r->isSubclassOf(EnvVarProcessorInterface::class)) { |
|
| 37 | + } elseif ( ! $r->isSubclassOf(EnvVarProcessorInterface::class)) { |
|
| 38 | 38 | throw new InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $id, EnvVarProcessorInterface::class)); |
| 39 | 39 | } |
| 40 | 40 | foreach ($class::getProvidedTypes() as $prefix => $type) { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | if ($bag instanceof EnvPlaceholderParameterBag) { |
| 46 | 46 | foreach (EnvVarProcessor::getProvidedTypes() as $prefix => $type) { |
| 47 | - if (!isset($types[$prefix])) { |
|
| 47 | + if ( ! isset($types[$prefix])) { |
|
| 48 | 48 | $types[$prefix] = self::validateProvidedTypes($type, EnvVarProcessor::class); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $types = \explode('|', $types); |
| 60 | 60 | foreach ($types as $type) { |
| 61 | - if (!\in_array($type, self::$allowedTypes)) { |
|
| 61 | + if ( ! \in_array($type, self::$allowedTypes)) { |
|
| 62 | 62 | throw new InvalidArgumentException(\sprintf('Invalid type "%s" returned by "%s::getProvidedTypes()", expected one of "%s".', $type, $class, \implode('", "', self::$allowedTypes))); |
| 63 | 63 | } |
| 64 | 64 | } |