@@ -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; |
@@ -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; |
@@ -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; |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $value[$k] = $processedValue; |
70 | 70 | } |
71 | 71 | } catch (RuntimeException $e) { |
72 | - if ($rootLevel < $level || $rootLevel && !$level) { |
|
72 | + if ($rootLevel < $level || $rootLevel && ! $level) { |
|
73 | 73 | unset($value[$k]); |
74 | 74 | } elseif ($rootLevel) { |
75 | 75 | throw $e; |
@@ -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 | } |
@@ -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]) { |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | */ |
31 | 31 | protected function processValue($value, $isRoot = \false) |
32 | 32 | { |
33 | - if (!$value instanceof Definition) { |
|
33 | + if ( ! $value instanceof Definition) { |
|
34 | 34 | return parent::processValue($value, $isRoot); |
35 | 35 | } |
36 | 36 | $i = 0; |
37 | 37 | foreach ($value->getArguments() as $k => $v) { |
38 | 38 | if ($k !== $i++) { |
39 | - if (!\is_int($k)) { |
|
39 | + if ( ! \is_int($k)) { |
|
40 | 40 | $msg = \sprintf('Invalid constructor argument for service "%s": integer expected but found string "%s". Check your service definition.', $this->currentId, $k); |
41 | 41 | $value->addError($msg); |
42 | 42 | if ($this->throwExceptions) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $i = 0; |
56 | 56 | foreach ($methodCall[1] as $k => $v) { |
57 | 57 | if ($k !== $i++) { |
58 | - if (!\is_int($k)) { |
|
58 | + if ( ! \is_int($k)) { |
|
59 | 59 | $msg = \sprintf('Invalid argument for method call "%s" of service "%s": integer expected but found string "%s". Check your service definition.', $methodCall[0], $this->currentId, $k); |
60 | 60 | $value->addError($msg); |
61 | 61 | if ($this->throwExceptions) { |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public static function createResourceForClass(\ReflectionClass $reflectionClass) |
79 | 79 | { |
80 | - @\trigger_error('The ' . __METHOD__ . '() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', \E_USER_DEPRECATED); |
|
80 | + @\trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', \E_USER_DEPRECATED); |
|
81 | 81 | $metadata = []; |
82 | 82 | foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { |
83 | - if (!$reflectionMethod->isStatic()) { |
|
83 | + if ( ! $reflectionMethod->isStatic()) { |
|
84 | 84 | $metadata[$reflectionMethod->name] = self::getResourceMetadataForMethod($reflectionMethod); |
85 | 85 | } |
86 | 86 | } |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | $this->container->log($this, $this->createTypeNotFoundMessage($value, 'it')); |
112 | 112 | } |
113 | 113 | $value = parent::processValue($value, $isRoot); |
114 | - if (!$value instanceof Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) { |
|
114 | + if ( ! $value instanceof Definition || ! $value->isAutowired() || $value->isAbstract() || ! $value->getClass()) { |
|
115 | 115 | return $value; |
116 | 116 | } |
117 | - if (!($reflectionClass = $this->container->getReflectionClass($value->getClass(), \false))) { |
|
117 | + if ( ! ($reflectionClass = $this->container->getReflectionClass($value->getClass(), \false))) { |
|
118 | 118 | $this->container->log($this, \sprintf('Skipping service "%s": Class or interface "%s" cannot be loaded.', $this->currentId, $value->getClass())); |
119 | 119 | return $value; |
120 | 120 | } |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | continue; |
187 | 187 | } |
188 | 188 | $type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, \true); |
189 | - if (!$type) { |
|
189 | + if ( ! $type) { |
|
190 | 190 | if (isset($arguments[$index])) { |
191 | 191 | continue; |
192 | 192 | } |
193 | 193 | // no default value? Then fail |
194 | - if (!$parameter->isDefaultValueAvailable()) { |
|
194 | + if ( ! $parameter->isDefaultValueAvailable()) { |
|
195 | 195 | // For core classes, isDefaultValueAvailable() can |
196 | 196 | // be false when isOptional() returns true. If the |
197 | 197 | // argument *is* optional, allow it to be missing |
@@ -200,27 +200,27 @@ discard block |
||
200 | 200 | } |
201 | 201 | $type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, \false); |
202 | 202 | $type = $type ? \sprintf('is type-hinted "%s"', $type) : 'has no type-hint'; |
203 | - throw new AutowiringFailedException($this->currentId, \sprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.', $this->currentId, $parameter->name, $class !== $this->currentId ? $class . '::' . $method : $method, $type)); |
|
203 | + throw new AutowiringFailedException($this->currentId, \sprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.', $this->currentId, $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method, $type)); |
|
204 | 204 | } |
205 | 205 | // specifically pass the default value |
206 | 206 | $arguments[$index] = $parameter->getDefaultValue(); |
207 | 207 | continue; |
208 | 208 | } |
209 | - if (!($value = $this->getAutowiredReference($ref = new TypedReference($type, $type, !$parameter->isOptional() ? $class : ''), 'for ' . \sprintf('argument "$%s" of method "%s()"', $parameter->name, $class . '::' . $method)))) { |
|
210 | - $failureMessage = $this->createTypeNotFoundMessage($ref, \sprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class . '::' . $method : $method)); |
|
209 | + if ( ! ($value = $this->getAutowiredReference($ref = new TypedReference($type, $type, ! $parameter->isOptional() ? $class : ''), 'for '.\sprintf('argument "$%s" of method "%s()"', $parameter->name, $class.'::'.$method)))) { |
|
210 | + $failureMessage = $this->createTypeNotFoundMessage($ref, \sprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method)); |
|
211 | 211 | if ($parameter->isDefaultValueAvailable()) { |
212 | 212 | $value = $parameter->getDefaultValue(); |
213 | - } elseif (!$parameter->allowsNull()) { |
|
213 | + } elseif ( ! $parameter->allowsNull()) { |
|
214 | 214 | throw new AutowiringFailedException($this->currentId, $failureMessage); |
215 | 215 | } |
216 | 216 | $this->container->log($this, $failureMessage); |
217 | 217 | } |
218 | 218 | $arguments[$index] = $value; |
219 | 219 | } |
220 | - if ($parameters && !isset($arguments[++$index])) { |
|
220 | + if ($parameters && ! isset($arguments[++$index])) { |
|
221 | 221 | while (0 <= --$index) { |
222 | 222 | $parameter = $parameters[$index]; |
223 | - if (!$parameter->isDefaultValueAvailable() || $parameter->getDefaultValue() !== $arguments[$index]) { |
|
223 | + if ( ! $parameter->isDefaultValueAvailable() || $parameter->getDefaultValue() !== $arguments[$index]) { |
|
224 | 224 | break; |
225 | 225 | } |
226 | 226 | unset($arguments[$index]); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | { |
239 | 239 | $this->lastFailure = null; |
240 | 240 | $type = $reference->getType(); |
241 | - if ($type !== $this->container->normalizeId($reference) || $this->container->has($type) && !$this->container->findDefinition($type)->isAbstract()) { |
|
241 | + if ($type !== $this->container->normalizeId($reference) || $this->container->has($type) && ! $this->container->findDefinition($type)->isAbstract()) { |
|
242 | 242 | return $reference; |
243 | 243 | } |
244 | 244 | if (null === $this->types) { |
@@ -247,23 +247,23 @@ discard block |
||
247 | 247 | if (isset($this->definedTypes[$type])) { |
248 | 248 | return new TypedReference($this->types[$type], $type); |
249 | 249 | } |
250 | - if (!$this->strictMode && isset($this->types[$type])) { |
|
250 | + if ( ! $this->strictMode && isset($this->types[$type])) { |
|
251 | 251 | $message = 'Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won\'t be supported in version 4.0.'; |
252 | 252 | if ($aliasSuggestion = $this->getAliasesSuggestionForType($type = $reference->getType(), $deprecationMessage)) { |
253 | - $message .= ' ' . $aliasSuggestion; |
|
253 | + $message .= ' '.$aliasSuggestion; |
|
254 | 254 | } else { |
255 | 255 | $message .= \sprintf(' You should %s the "%s" service to "%s" instead.', isset($this->types[$this->types[$type]]) ? 'alias' : 'rename (or alias)', $this->types[$type], $type); |
256 | 256 | } |
257 | 257 | @\trigger_error($message, \E_USER_DEPRECATED); |
258 | 258 | return new TypedReference($this->types[$type], $type); |
259 | 259 | } |
260 | - if (!$reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) { |
|
260 | + if ( ! $reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) { |
|
261 | 261 | return null; |
262 | 262 | } |
263 | 263 | if (isset($this->autowired[$type])) { |
264 | 264 | return $this->autowired[$type] ? new TypedReference($this->autowired[$type], $type) : null; |
265 | 265 | } |
266 | - if (!$this->strictMode) { |
|
266 | + if ( ! $this->strictMode) { |
|
267 | 267 | return $this->createAutowiredDefinition($type); |
268 | 268 | } |
269 | 269 | return null; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | private function populateAvailableTypes($onlyAutowiringTypes = \false) |
275 | 275 | { |
276 | 276 | $this->types = []; |
277 | - if (!$onlyAutowiringTypes) { |
|
277 | + if ( ! $onlyAutowiringTypes) { |
|
278 | 278 | $this->ambiguousServiceTypes = []; |
279 | 279 | } |
280 | 280 | foreach ($this->container->getDefinitions() as $id => $definition) { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | if ($onlyAutowiringTypes) { |
301 | 301 | return; |
302 | 302 | } |
303 | - if (\preg_match('/^\\d+_[^~]++~[._a-zA-Z\\d]{7}$/', $id) || $definition->isDeprecated() || !($reflectionClass = $this->container->getReflectionClass($definition->getClass(), \false))) { |
|
303 | + if (\preg_match('/^\\d+_[^~]++~[._a-zA-Z\\d]{7}$/', $id) || $definition->isDeprecated() || ! ($reflectionClass = $this->container->getReflectionClass($definition->getClass(), \false))) { |
|
304 | 304 | return; |
305 | 305 | } |
306 | 306 | foreach ($reflectionClass->getInterfaces() as $reflectionInterface) { |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | return; |
328 | 328 | } |
329 | 329 | // check to make sure the type doesn't match multiple services |
330 | - if (!isset($this->types[$type]) || $this->types[$type] === $id) { |
|
330 | + if ( ! isset($this->types[$type]) || $this->types[$type] === $id) { |
|
331 | 331 | $this->types[$type] = $id; |
332 | 332 | return; |
333 | 333 | } |
334 | 334 | // keep an array of all services matching this type |
335 | - if (!isset($this->ambiguousServiceTypes[$type])) { |
|
335 | + if ( ! isset($this->ambiguousServiceTypes[$type])) { |
|
336 | 336 | $this->ambiguousServiceTypes[$type] = [$this->types[$type]]; |
337 | 337 | unset($this->types[$type]); |
338 | 338 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | */ |
348 | 348 | private function createAutowiredDefinition($type) |
349 | 349 | { |
350 | - if (!($typeHint = $this->container->getReflectionClass($type, \false)) || !$typeHint->isInstantiable()) { |
|
350 | + if ( ! ($typeHint = $this->container->getReflectionClass($type, \false)) || ! $typeHint->isInstantiable()) { |
|
351 | 351 | return null; |
352 | 352 | } |
353 | 353 | $currentId = $this->currentId; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } finally { |
386 | 386 | $this->container->setResourceTracking($trackResources); |
387 | 387 | } |
388 | - if (!$r) { |
|
388 | + if ( ! $r) { |
|
389 | 389 | // either $type does not exist or a parent class does not exist |
390 | 390 | try { |
391 | 391 | $resource = new ClassExistenceResource($type, \false); |
@@ -399,13 +399,13 @@ discard block |
||
399 | 399 | } else { |
400 | 400 | $message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists'; |
401 | 401 | $message = \sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives); |
402 | - if ($r->isInterface() && !$alternatives) { |
|
402 | + if ($r->isInterface() && ! $alternatives) { |
|
403 | 403 | $message .= ' Did you create a class that implements this interface?'; |
404 | 404 | } |
405 | 405 | } |
406 | 406 | $message = \sprintf('Cannot autowire service "%s": %s %s', $this->currentId, $label, $message); |
407 | 407 | if (null !== $this->lastFailure) { |
408 | - $message = $this->lastFailure . "\n" . $message; |
|
408 | + $message = $this->lastFailure."\n".$message; |
|
409 | 409 | $this->lastFailure = null; |
410 | 410 | } |
411 | 411 | return $message; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | { |
415 | 415 | // try suggesting available aliases first |
416 | 416 | if ($message = $this->getAliasesSuggestionForType($type = $reference->getType())) { |
417 | - return ' ' . $message; |
|
417 | + return ' '.$message; |
|
418 | 418 | } |
419 | 419 | if (null === $this->ambiguousServiceTypes) { |
420 | 420 | $this->populateAvailableTypes(); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $message = \sprintf('one of these existing services: "%s"', \implode('", "', $this->ambiguousServiceTypes[$type])); |
424 | 424 | } elseif (isset($this->types[$type])) { |
425 | 425 | $message = \sprintf('the existing "%s" service', $this->types[$type]); |
426 | - } elseif ($reference->getRequiringClass() && !$reference->canBeAutoregistered() && !$this->strictMode) { |
|
426 | + } elseif ($reference->getRequiringClass() && ! $reference->canBeAutoregistered() && ! $this->strictMode) { |
|
427 | 427 | return ' It cannot be auto-registered because it is from a different root namespace.'; |
428 | 428 | } else { |
429 | 429 | return ''; |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | try { |
441 | 441 | if (\method_exists($parameter, 'getType')) { |
442 | 442 | $type = $parameter->getType(); |
443 | - if ($type && !$type->isBuiltin()) { |
|
443 | + if ($type && ! $type->isBuiltin()) { |
|
444 | 444 | $class = new \ReflectionClass($type instanceof \ReflectionNamedType ? $type->getName() : (string) $type); |
445 | 445 | } else { |
446 | 446 | $class = null; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $class = \false; |
454 | 454 | } |
455 | 455 | $isVariadic = \method_exists($parameter, 'isVariadic') && $parameter->isVariadic(); |
456 | - $methodArgumentsMetadata[] = ['class' => $class, 'isOptional' => $parameter->isOptional(), 'defaultValue' => $parameter->isOptional() && !$isVariadic ? $parameter->getDefaultValue() : null]; |
|
456 | + $methodArgumentsMetadata[] = ['class' => $class, 'isOptional' => $parameter->isOptional(), 'defaultValue' => $parameter->isOptional() && ! $isVariadic ? $parameter->getDefaultValue() : null]; |
|
457 | 457 | } |
458 | 458 | return $methodArgumentsMetadata; |
459 | 459 | } |
@@ -461,11 +461,11 @@ discard block |
||
461 | 461 | { |
462 | 462 | $aliases = []; |
463 | 463 | foreach (\class_parents($type) + \class_implements($type) as $parent) { |
464 | - if ($this->container->has($parent) && !$this->container->findDefinition($parent)->isAbstract()) { |
|
464 | + if ($this->container->has($parent) && ! $this->container->findDefinition($parent)->isAbstract()) { |
|
465 | 465 | $aliases[] = $parent; |
466 | 466 | } |
467 | 467 | } |
468 | - $extraContext = $extraContext ? ' ' . $extraContext : ''; |
|
468 | + $extraContext = $extraContext ? ' '.$extraContext : ''; |
|
469 | 469 | if (1 < ($len = \count($aliases))) { |
470 | 470 | $message = \sprintf('Try changing the type-hint%s to one of its parents: ', $extraContext); |
471 | 471 | for ($i = 0, --$len; $i < $len; ++$i) { |
@@ -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) { |