@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | protected function processValue($value, $isRoot = \false) |
26 | 26 | { |
27 | - if (!$value instanceof Definition || empty($value->getErrors())) { |
|
27 | + if ( ! $value instanceof Definition || empty($value->getErrors())) { |
|
28 | 28 | return parent::processValue($value, $isRoot); |
29 | 29 | } |
30 | 30 | // only show the first error so the user can focus on it |
@@ -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) { |
@@ -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; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $message .= \sprintf("\nCould be related to%s:", 1 < \count($this->errorMessages) ? ' one of' : ''); |
41 | 41 | } |
42 | 42 | foreach ($this->errorMessages as $m) { |
43 | - $message .= "\n - " . $m; |
|
43 | + $message .= "\n - ".$m; |
|
44 | 44 | } |
45 | 45 | throw new InvalidArgumentException($message); |
46 | 46 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | return parent::processValue($value, $isRoot); |
65 | 65 | } |
66 | - if (!$value instanceof Definition || !($bindings = $value->getBindings())) { |
|
66 | + if ( ! $value instanceof Definition || ! ($bindings = $value->getBindings())) { |
|
67 | 67 | return parent::processValue($value, $isRoot); |
68 | 68 | } |
69 | 69 | foreach ($bindings as $key => $binding) { |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | if ($used) { |
72 | 72 | $this->usedBindings[$bindingId] = \true; |
73 | 73 | unset($this->unusedBindings[$bindingId]); |
74 | - } elseif (!isset($this->usedBindings[$bindingId])) { |
|
74 | + } elseif ( ! isset($this->usedBindings[$bindingId])) { |
|
75 | 75 | $this->unusedBindings[$bindingId] = [$key, $this->currentId]; |
76 | 76 | } |
77 | 77 | if (isset($key[0]) && '$' === $key[0]) { |
78 | 78 | continue; |
79 | 79 | } |
80 | - if (null !== $bindingValue && !$bindingValue instanceof Reference && !$bindingValue instanceof Definition) { |
|
80 | + if (null !== $bindingValue && ! $bindingValue instanceof Reference && ! $bindingValue instanceof Definition) { |
|
81 | 81 | throw new InvalidArgumentException(\sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of "%s" or an instance of "%s", "%s" given.', $key, $this->currentId, Reference::class, Definition::class, \gettype($bindingValue))); |
82 | 82 | } |
83 | 83 | } |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | if (\array_key_exists($key, $arguments) && '' !== $arguments[$key]) { |
113 | 113 | continue; |
114 | 114 | } |
115 | - if (\array_key_exists('$' . $parameter->name, $bindings)) { |
|
116 | - $arguments[$key] = $this->getBindingValue($bindings['$' . $parameter->name]); |
|
115 | + if (\array_key_exists('$'.$parameter->name, $bindings)) { |
|
116 | + $arguments[$key] = $this->getBindingValue($bindings['$'.$parameter->name]); |
|
117 | 117 | continue; |
118 | 118 | } |
119 | 119 | $typeHint = ProxyHelper::getTypeHint($reflectionMethod, $parameter, \true); |
120 | - if (!isset($bindings[$typeHint])) { |
|
120 | + if ( ! isset($bindings[$typeHint])) { |
|
121 | 121 | continue; |
122 | 122 | } |
123 | 123 | $arguments[$key] = $this->getBindingValue($bindings[$typeHint]); |
@@ -57,7 +57,7 @@ |
||
57 | 57 | continue; |
58 | 58 | } |
59 | 59 | // Remove private definition and schedule for replacement |
60 | - $definition->setPublic(!$target->isPrivate()); |
|
60 | + $definition->setPublic( ! $target->isPrivate()); |
|
61 | 61 | $definition->setPrivate($target->isPrivate()); |
62 | 62 | $container->setDefinition($definitionId, $definition); |
63 | 63 | $container->removeDefinition($targetId); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | public function getNode($id) |
51 | 51 | { |
52 | - if (!isset($this->nodes[$id])) { |
|
52 | + if ( ! isset($this->nodes[$id])) { |
|
53 | 53 | throw new InvalidArgumentException(\sprintf('There is no node with id "%s".', $id)); |
54 | 54 | } |
55 | 55 | return $this->nodes[$id]; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | namespace Wordlift\Modules\Common\Symfony\Component\DependencyInjection\Compiler; |
12 | 12 | |
13 | -@\trigger_error('The ' . __NAMESPACE__ . '\\ResolveDefinitionTemplatesPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the ResolveChildDefinitionsPass class instead.', \E_USER_DEPRECATED); |
|
13 | +@\trigger_error('The '.__NAMESPACE__.'\\ResolveDefinitionTemplatesPass class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the ResolveChildDefinitionsPass class instead.', \E_USER_DEPRECATED); |
|
14 | 14 | \class_exists(ResolveChildDefinitionsPass::class); |
15 | 15 | if (\false) { |
16 | 16 | /** |
@@ -25,7 +25,7 @@ |
||
25 | 25 | public function process(ContainerBuilder $container) |
26 | 26 | { |
27 | 27 | foreach ($container->getExtensions() as $extension) { |
28 | - if (!$extension instanceof CompilerPassInterface) { |
|
28 | + if ( ! $extension instanceof CompilerPassInterface) { |
|
29 | 29 | continue; |
30 | 30 | } |
31 | 31 | $extension->process($container); |
@@ -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) { |