@@ -69,12 +69,12 @@ |
||
69 | 69 | } |
70 | 70 | $priority = 0; |
71 | 71 | } |
72 | - $property = $type . 'Passes'; |
|
73 | - if (!isset($this->{$property})) { |
|
72 | + $property = $type.'Passes'; |
|
73 | + if ( ! isset($this->{$property})) { |
|
74 | 74 | throw new InvalidArgumentException(\sprintf('Invalid type "%s".', $type)); |
75 | 75 | } |
76 | - $passes =& $this->{$property}; |
|
77 | - if (!isset($passes[$priority])) { |
|
76 | + $passes = & $this->{$property}; |
|
77 | + if ( ! isset($passes[$priority])) { |
|
78 | 78 | $passes[$priority] = []; |
79 | 79 | } |
80 | 80 | $passes[$priority][] = $pass; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | protected function processValue($value, $isRoot = \false) |
28 | 28 | { |
29 | - if (!$value instanceof Definition) { |
|
29 | + if ( ! $value instanceof Definition) { |
|
30 | 30 | return parent::processValue($value, $isRoot); |
31 | 31 | } |
32 | 32 | $calls = $value->getMethodCalls(); |
@@ -48,25 +48,25 @@ discard block |
||
48 | 48 | } |
49 | 49 | if (isset($key[0]) && '$' === $key[0]) { |
50 | 50 | foreach ($parameters as $j => $p) { |
51 | - if ($key === '$' . $p->name) { |
|
51 | + if ($key === '$'.$p->name) { |
|
52 | 52 | $resolvedArguments[$j] = $argument; |
53 | 53 | continue 2; |
54 | 54 | } |
55 | 55 | } |
56 | - throw new InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument named "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method, $key)); |
|
56 | + throw new InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument named "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key)); |
|
57 | 57 | } |
58 | - if (null !== $argument && !$argument instanceof Reference && !$argument instanceof Definition) { |
|
59 | - throw new InvalidArgumentException(\sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class . '::' . $method : $method, Reference::class, Definition::class, \gettype($argument))); |
|
58 | + if (null !== $argument && ! $argument instanceof Reference && ! $argument instanceof Definition) { |
|
59 | + throw new InvalidArgumentException(\sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, \gettype($argument))); |
|
60 | 60 | } |
61 | 61 | $typeFound = \false; |
62 | 62 | foreach ($parameters as $j => $p) { |
63 | - if (!\array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, \true) === $key) { |
|
63 | + if ( ! \array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, \true) === $key) { |
|
64 | 64 | $resolvedArguments[$j] = $argument; |
65 | 65 | $typeFound = \true; |
66 | 66 | } |
67 | 67 | } |
68 | - if (!$typeFound) { |
|
69 | - throw new InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method, $key)); |
|
68 | + if ( ! $typeFound) { |
|
69 | + throw new InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key)); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | if ($resolvedArguments !== $call[1]) { |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | { |
48 | 48 | $instanceofConditionals = $definition->getInstanceofConditionals(); |
49 | 49 | $autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : []; |
50 | - if (!$instanceofConditionals && !$autoconfiguredInstanceof) { |
|
50 | + if ( ! $instanceofConditionals && ! $autoconfiguredInstanceof) { |
|
51 | 51 | return $definition; |
52 | 52 | } |
53 | - if (!($class = $container->getParameterBag()->resolveValue($definition->getClass()))) { |
|
53 | + if ( ! ($class = $container->getParameterBag()->resolveValue($definition->getClass()))) { |
|
54 | 54 | return $definition; |
55 | 55 | } |
56 | 56 | $conditionals = $this->mergeConditionals($autoconfiguredInstanceof, $instanceofConditionals, $container); |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | $instanceofTags = []; |
60 | 60 | $reflectionClass = null; |
61 | 61 | foreach ($conditionals as $interface => $instanceofDefs) { |
62 | - if ($interface !== $class && !(null === $reflectionClass ? $reflectionClass = $container->getReflectionClass($class, \false) ?: \false : $reflectionClass)) { |
|
62 | + if ($interface !== $class && ! (null === $reflectionClass ? $reflectionClass = $container->getReflectionClass($class, \false) ?: \false : $reflectionClass)) { |
|
63 | 63 | continue; |
64 | 64 | } |
65 | - if ($interface !== $class && !\is_subclass_of($class, $interface)) { |
|
65 | + if ($interface !== $class && ! \is_subclass_of($class, $interface)) { |
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 | foreach ($instanceofDefs as $key => $instanceofDef) { |
69 | 69 | /** @var ChildDefinition $instanceofDef */ |
70 | 70 | $instanceofDef = clone $instanceofDef; |
71 | - $instanceofDef->setAbstract(\true)->setParent($parent ?: 'abstract.instanceof.' . $id); |
|
72 | - $parent = 'instanceof.' . $interface . '.' . $key . '.' . $id; |
|
71 | + $instanceofDef->setAbstract(\true)->setParent($parent ?: 'abstract.instanceof.'.$id); |
|
72 | + $parent = 'instanceof.'.$interface.'.'.$key.'.'.$id; |
|
73 | 73 | $container->setDefinition($parent, $instanceofDef); |
74 | 74 | $instanceofTags[] = $instanceofDef->getTags(); |
75 | 75 | $instanceofDef->setTags([]); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | if ($parent) { |
82 | 82 | $bindings = $definition->getBindings(); |
83 | - $abstract = $container->setDefinition('abstract.instanceof.' . $id, $definition); |
|
83 | + $abstract = $container->setDefinition('abstract.instanceof.'.$id, $definition); |
|
84 | 84 | // cast Definition to ChildDefinition |
85 | 85 | $definition->setBindings([]); |
86 | 86 | $definition = \serialize($definition); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $definition = \substr_replace($definition, 'Child', 44, 0); |
89 | 89 | $definition = \unserialize($definition); |
90 | 90 | $definition->setParent($parent); |
91 | - if (null !== $shared && !isset($definition->getChanges()['shared'])) { |
|
91 | + if (null !== $shared && ! isset($definition->getChanges()['shared'])) { |
|
92 | 92 | $definition->setShared($shared); |
93 | 93 | } |
94 | 94 | $i = \count($instanceofTags); |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | private function mergeConditionals(array $autoconfiguredInstanceof, array $instanceofConditionals, ContainerBuilder $container) |
112 | 112 | { |
113 | 113 | // make each value an array of ChildDefinition |
114 | - $conditionals = \array_map(function ($childDef) { |
|
114 | + $conditionals = \array_map(function($childDef) { |
|
115 | 115 | return [$childDef]; |
116 | 116 | }, $autoconfiguredInstanceof); |
117 | 117 | foreach ($instanceofConditionals as $interface => $instanceofDef) { |
118 | 118 | // make sure the interface/class exists (but don't validate automaticInstanceofConditionals) |
119 | - if (!$container->getReflectionClass($interface)) { |
|
119 | + if ( ! $container->getReflectionClass($interface)) { |
|
120 | 120 | throw new RuntimeException(\sprintf('"%s" is set as an "instanceof" conditional, but it does not exist.', $interface)); |
121 | 121 | } |
122 | - if (!isset($autoconfiguredInstanceof[$interface])) { |
|
122 | + if ( ! isset($autoconfiguredInstanceof[$interface])) { |
|
123 | 123 | $conditionals[$interface] = []; |
124 | 124 | } |
125 | 125 | $conditionals[$interface][] = $instanceofDef; |
@@ -31,7 +31,7 @@ |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | $value = parent::processValue($value, $isRoot); |
34 | - if ($value && \is_array($value) && !$isRoot) { |
|
34 | + if ($value && \is_array($value) && ! $isRoot) { |
|
35 | 35 | $value = \array_combine($this->container->resolveEnvPlaceholders(\array_keys($value), \true), $value); |
36 | 36 | } |
37 | 37 | return $value; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $this->graph->connect($this->currentId, $this->currentDefinition, $targetId, $targetDefinition, $value, $this->lazy || $this->hasProxyDumper && $targetDefinition && $targetDefinition->isLazy(), ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(), $this->byConstructor); |
87 | 87 | return $value; |
88 | 88 | } |
89 | - if (!$value instanceof Definition) { |
|
89 | + if ( ! $value instanceof Definition) { |
|
90 | 90 | return parent::processValue($value, $isRoot); |
91 | 91 | } |
92 | 92 | if ($isRoot) { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $this->processValue($value->getFactory()); |
104 | 104 | $this->processValue($value->getArguments()); |
105 | 105 | $this->byConstructor = $byConstructor; |
106 | - if (!$this->onlyConstructorArguments) { |
|
106 | + if ( ! $this->onlyConstructorArguments) { |
|
107 | 107 | $this->processValue($value->getProperties()); |
108 | 108 | $this->processValue($value->getMethodCalls()); |
109 | 109 | $this->processValue($value->getConfigurator()); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | while ($this->container->hasAlias($id)) { |
128 | 128 | $id = (string) $this->container->getAlias($id); |
129 | 129 | } |
130 | - if (!$this->container->hasDefinition($id)) { |
|
130 | + if ( ! $this->container->hasDefinition($id)) { |
|
131 | 131 | return null; |
132 | 132 | } |
133 | 133 | return $this->container->normalizeId($id); |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | private function getExpressionLanguage() |
136 | 136 | { |
137 | 137 | if (null === $this->expressionLanguage) { |
138 | - if (!\class_exists(ExpressionLanguage::class)) { |
|
138 | + if ( ! \class_exists(ExpressionLanguage::class)) { |
|
139 | 139 | throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); |
140 | 140 | } |
141 | 141 | $providers = $this->container->getExpressionLanguageProviders(); |
142 | - $this->expressionLanguage = new ExpressionLanguage(null, $providers, function ($arg) { |
|
142 | + $this->expressionLanguage = new ExpressionLanguage(null, $providers, function($arg) { |
|
143 | 143 | if ('""' === \substr_replace($arg, '', 1, -1)) { |
144 | 144 | $id = \stripcslashes(\substr($arg, 1, -1)); |
145 | 145 | $id = $this->getDefinitionId($id); |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | { |
26 | 26 | protected function processValue($value, $isRoot = \false) |
27 | 27 | { |
28 | - if (!$value instanceof Definition || $value->isAbstract() || $value->isSynthetic() || !$value->hasTag('container.service_subscriber')) { |
|
28 | + if ( ! $value instanceof Definition || $value->isAbstract() || $value->isSynthetic() || ! $value->hasTag('container.service_subscriber')) { |
|
29 | 29 | return parent::processValue($value, $isRoot); |
30 | 30 | } |
31 | 31 | $serviceMap = []; |
32 | 32 | $autowire = $value->isAutowired(); |
33 | 33 | foreach ($value->getTag('container.service_subscriber') as $attributes) { |
34 | - if (!$attributes) { |
|
34 | + if ( ! $attributes) { |
|
35 | 35 | $autowire = \true; |
36 | 36 | continue; |
37 | 37 | } |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | if ([] !== \array_diff(\array_keys($attributes), ['id', 'key'])) { |
40 | 40 | throw new InvalidArgumentException(\sprintf('The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "%s" given for service "%s".', \implode('", "', \array_keys($attributes)), $this->currentId)); |
41 | 41 | } |
42 | - if (!\array_key_exists('id', $attributes)) { |
|
42 | + if ( ! \array_key_exists('id', $attributes)) { |
|
43 | 43 | throw new InvalidArgumentException(\sprintf('Missing "id" attribute on "container.service_subscriber" tag with key="%s" for service "%s".', $attributes['key'], $this->currentId)); |
44 | 44 | } |
45 | - if (!\array_key_exists('key', $attributes)) { |
|
45 | + if ( ! \array_key_exists('key', $attributes)) { |
|
46 | 46 | $attributes['key'] = $attributes['id']; |
47 | 47 | } |
48 | 48 | if (isset($serviceMap[$attributes['key']])) { |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | $serviceMap[$attributes['key']] = new Reference($attributes['id']); |
52 | 52 | } |
53 | 53 | $class = $value->getClass(); |
54 | - if (!($r = $this->container->getReflectionClass($class))) { |
|
54 | + if ( ! ($r = $this->container->getReflectionClass($class))) { |
|
55 | 55 | throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $this->currentId)); |
56 | 56 | } |
57 | - if (!$r->isSubclassOf(ServiceSubscriberInterface::class)) { |
|
57 | + if ( ! $r->isSubclassOf(ServiceSubscriberInterface::class)) { |
|
58 | 58 | throw new InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $this->currentId, ServiceSubscriberInterface::class)); |
59 | 59 | } |
60 | 60 | $class = $r->name; |
61 | 61 | $subscriberMap = []; |
62 | 62 | $declaringClass = (new \ReflectionMethod($class, 'getSubscribedServices'))->class; |
63 | 63 | foreach ($class::getSubscribedServices() as $key => $type) { |
64 | - if (!\is_string($type) || !\preg_match('/^\\??[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $type)) { |
|
64 | + if ( ! \is_string($type) || ! \preg_match('/^\\??[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $type)) { |
|
65 | 65 | throw new InvalidArgumentException(\sprintf('"%s::getSubscribedServices()" must return valid PHP types for service "%s" key "%s", "%s" returned.', $class, $this->currentId, $key, \is_string($type) ? $type : \gettype($type))); |
66 | 66 | } |
67 | 67 | if ($optionalBehavior = '?' === $type[0]) { |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | if (\is_int($key)) { |
72 | 72 | $key = $type; |
73 | 73 | } |
74 | - if (!isset($serviceMap[$key])) { |
|
75 | - if (!$autowire) { |
|
74 | + if ( ! isset($serviceMap[$key])) { |
|
75 | + if ( ! $autowire) { |
|
76 | 76 | throw new InvalidArgumentException(\sprintf('Service "%s" misses a "container.service_subscriber" tag with "key"/"id" attributes corresponding to entry "%s" as returned by "%s::getSubscribedServices()".', $this->currentId, $key, $class)); |
77 | 77 | } |
78 | 78 | $serviceMap[$key] = new Reference($type); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | protected function processValue($value, $isRoot = \false) |
26 | 26 | { |
27 | - if (!$value instanceof TaggedIteratorArgument) { |
|
27 | + if ( ! $value instanceof TaggedIteratorArgument) { |
|
28 | 28 | return parent::processValue($value, $isRoot); |
29 | 29 | } |
30 | 30 | $value->setValues($this->findAndSortTaggedServices($value->getTag(), $this->container)); |
@@ -100,9 +100,9 @@ |
||
100 | 100 | public function log(CompilerPassInterface $pass, $message) |
101 | 101 | { |
102 | 102 | if (\false !== \strpos($message, "\n")) { |
103 | - $message = \str_replace("\n", "\n" . \get_class($pass) . ': ', \trim($message)); |
|
103 | + $message = \str_replace("\n", "\n".\get_class($pass).': ', \trim($message)); |
|
104 | 104 | } |
105 | - $this->log[] = \get_class($pass) . ': ' . $message; |
|
105 | + $this->log[] = \get_class($pass).': '.$message; |
|
106 | 106 | } |
107 | 107 | /** |
108 | 108 | * Returns the log. |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | foreach ($container->getExtensions() as $name => $extension) { |
44 | - if (!($config = $container->getExtensionConfig($name))) { |
|
44 | + if ( ! ($config = $container->getExtensionConfig($name))) { |
|
45 | 45 | // this extension was not called |
46 | 46 | continue; |
47 | 47 | } |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | } |
93 | 93 | public function freezeAfterProcessing(Extension $extension, ContainerBuilder $container) |
94 | 94 | { |
95 | - if (!($config = $extension->getProcessedConfigs())) { |
|
95 | + if ( ! ($config = $extension->getProcessedConfigs())) { |
|
96 | 96 | // Extension::processConfiguration() wasn't called, we cannot know how configs were merged |
97 | 97 | return; |
98 | 98 | } |
99 | 99 | $this->processedEnvPlaceholders = []; |
100 | 100 | // serialize config and container to catch env vars nested in object graphs |
101 | - $config = \serialize($config) . \serialize($container->getDefinitions()) . \serialize($container->getAliases()) . \serialize($container->getParameterBag()->all()); |
|
101 | + $config = \serialize($config).\serialize($container->getDefinitions()).\serialize($container->getAliases()).\serialize($container->getParameterBag()->all()); |
|
102 | 102 | foreach (parent::getEnvPlaceholders() as $env => $placeholders) { |
103 | 103 | foreach ($placeholders as $placeholder) { |
104 | 104 | if (\false !== \stripos($config, $placeholder)) { |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs = null) |
157 | 157 | { |
158 | - if (\true !== $format || !\is_string($value)) { |
|
158 | + if (\true !== $format || ! \is_string($value)) { |
|
159 | 159 | return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); |
160 | 160 | } |
161 | 161 | $bag = $this->getParameterBag(); |
162 | 162 | $value = $bag->resolveValue($value); |
163 | - if (!$bag instanceof EnvPlaceholderParameterBag) { |
|
163 | + if ( ! $bag instanceof EnvPlaceholderParameterBag) { |
|
164 | 164 | return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); |
165 | 165 | } |
166 | 166 | foreach ($bag->getEnvPlaceholders() as $env => $placeholders) { |