@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | if ('\\' !== \substr($namespace, -1)) { |
46 | 46 | throw new InvalidArgumentException(\sprintf('Namespace prefix must end with a "\\": "%s".', $namespace)); |
47 | 47 | } |
48 | - if (!\preg_match('/^(?:[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+\\\\)++$/', $namespace)) { |
|
48 | + if ( ! \preg_match('/^(?:[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+\\\\)++$/', $namespace)) { |
|
49 | 49 | throw new InvalidArgumentException(\sprintf('Namespace is not a valid PSR-4 prefix: "%s".', $namespace)); |
50 | 50 | } |
51 | 51 | $classes = $this->findClasses($namespace, $resource, $exclude); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | } |
70 | 70 | foreach ($interfaces as $interface) { |
71 | - if (!empty($singlyImplemented[$interface])) { |
|
71 | + if ( ! empty($singlyImplemented[$interface])) { |
|
72 | 72 | $this->container->setAlias($interface, $singlyImplemented[$interface])->setPublic(\false); |
73 | 73 | } |
74 | 74 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | $this->container->removeBindings($id); |
84 | 84 | if ($this->isLoadingInstanceof) { |
85 | - if (!$definition instanceof ChildDefinition) { |
|
85 | + if ( ! $definition instanceof ChildDefinition) { |
|
86 | 86 | throw new InvalidArgumentException(\sprintf('Invalid type definition "%s": ChildDefinition expected, "%s" given.', $id, \get_class($definition))); |
87 | 87 | } |
88 | 88 | $this->instanceof[$id] = $definition; |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | if (isset($excludePaths[\str_replace('\\', '/', $path)])) { |
120 | 120 | continue; |
121 | 121 | } |
122 | - if (!\preg_match($extRegexp, $path, $m) || !$info->isReadable()) { |
|
122 | + if ( ! \preg_match($extRegexp, $path, $m) || ! $info->isReadable()) { |
|
123 | 123 | continue; |
124 | 124 | } |
125 | - $class = $namespace . \ltrim(\str_replace('/', '\\', \substr($path, $prefixLen, -\strlen($m[0]))), '\\'); |
|
126 | - if (!\preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $class)) { |
|
125 | + $class = $namespace.\ltrim(\str_replace('/', '\\', \substr($path, $prefixLen, -\strlen($m[0]))), '\\'); |
|
126 | + if ( ! \preg_match('/^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $class)) { |
|
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | try { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | // check to make sure the expected class exists |
136 | - if (!$r) { |
|
136 | + if ( ! $r) { |
|
137 | 137 | throw new InvalidArgumentException(\sprintf('Expected to find class "%s" in file "%s" while importing services from resource "%s", but it was not found! Check the namespace prefix used with the resource.', $class, $path, $pattern)); |
138 | 138 | } |
139 | 139 | if ($r->isInstantiable() || $r->isInterface()) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function supports($resource, $type = null) |
62 | 62 | { |
63 | - if (!\is_string($resource)) { |
|
63 | + if ( ! \is_string($resource)) { |
|
64 | 64 | return \false; |
65 | 65 | } |
66 | 66 | if (null === $type && 'xml' === \pathinfo($resource, \PATHINFO_EXTENSION)) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if (null === ($defaultsNode = $xpath->query('//container:services/container:defaults')->item(0))) { |
140 | 140 | return []; |
141 | 141 | } |
142 | - $defaults = ['tags' => $this->getChildren($defaultsNode, 'tag'), 'bind' => \array_map(function ($v) { |
|
142 | + $defaults = ['tags' => $this->getChildren($defaultsNode, 'tag'), 'bind' => \array_map(function($v) { |
|
143 | 143 | return new BoundArgument($v); |
144 | 144 | }, $this->getArgumentsAsPhp($defaultsNode, 'bind', $file))]; |
145 | 145 | foreach ($defaults['tags'] as $tag) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if ($this->isLoadingInstanceof) { |
181 | 181 | $definition = new ChildDefinition(''); |
182 | 182 | } elseif ($parent = $service->getAttribute('parent')) { |
183 | - if (!empty($this->instanceof)) { |
|
183 | + if ( ! empty($this->instanceof)) { |
|
184 | 184 | throw new InvalidArgumentException(\sprintf('The service "%s" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.', $service->getAttribute('id'))); |
185 | 185 | } |
186 | 186 | foreach ($defaults as $k => $v) { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | continue; |
197 | 197 | } |
198 | - if (!$service->hasAttribute($k)) { |
|
198 | + if ( ! $service->hasAttribute($k)) { |
|
199 | 199 | throw new InvalidArgumentException(\sprintf('Attribute "%s" on service "%s" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.', $k, $service->getAttribute('id'))); |
200 | 200 | } |
201 | 201 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | foreach (['class', 'public', 'shared', 'synthetic', 'lazy', 'abstract'] as $key) { |
217 | 217 | if ($value = $service->getAttribute($key)) { |
218 | - $method = 'set' . $key; |
|
218 | + $method = 'set'.$key; |
|
219 | 219 | $definition->{$method}(XmlUtils::phpize($value)); |
220 | 220 | } |
221 | 221 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $definition->setAutowired(XmlUtils::phpize($value)); |
224 | 224 | } |
225 | 225 | if ($value = $service->getAttribute('autoconfigure')) { |
226 | - if (!$definition instanceof ChildDefinition) { |
|
226 | + if ( ! $definition instanceof ChildDefinition) { |
|
227 | 227 | $definition->setAutoconfigured(XmlUtils::phpize($value)); |
228 | 228 | } elseif ($value = XmlUtils::phpize($value)) { |
229 | 229 | throw new InvalidArgumentException(\sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try setting autoconfigure="false" for the service.', $service->getAttribute('id'))); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $definition->addMethodCall($call->getAttribute('method'), $this->getArgumentsAsPhp($call, 'argument', $file)); |
268 | 268 | } |
269 | 269 | $tags = $this->getChildren($service, 'tag'); |
270 | - if (!empty($defaults['tags'])) { |
|
270 | + if ( ! empty($defaults['tags'])) { |
|
271 | 271 | $tags = \array_merge($tags, $defaults['tags']); |
272 | 272 | } |
273 | 273 | foreach ($tags as $tag) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | if ('name' === $name) { |
277 | 277 | continue; |
278 | 278 | } |
279 | - if (\false !== \strpos($name, '-') && \false === \strpos($name, '_') && !\array_key_exists($normalizedName = \str_replace('-', '_', $name), $parameters)) { |
|
279 | + if (\false !== \strpos($name, '-') && \false === \strpos($name, '_') && ! \array_key_exists($normalizedName = \str_replace('-', '_', $name), $parameters)) { |
|
280 | 280 | $parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue); |
281 | 281 | } |
282 | 282 | // keep not normalized key |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | try { |
320 | 320 | $dom = XmlUtils::loadFile($file, [$this, 'validateSchema']); |
321 | 321 | } catch (\InvalidArgumentException $e) { |
322 | - throw new InvalidArgumentException(\sprintf('Unable to parse file "%s": ', $file) . $e->getMessage(), $e->getCode(), $e); |
|
322 | + throw new InvalidArgumentException(\sprintf('Unable to parse file "%s": ', $file).$e->getMessage(), $e->getCode(), $e); |
|
323 | 323 | } |
324 | 324 | $this->validateExtensions($dom, $file); |
325 | 325 | return $dom; |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | { |
335 | 335 | $definitions = []; |
336 | 336 | $count = 0; |
337 | - $suffix = '~' . ContainerBuilder::hash($file); |
|
337 | + $suffix = '~'.ContainerBuilder::hash($file); |
|
338 | 338 | $xpath = new \DOMXPath($xml); |
339 | 339 | $xpath->registerNamespace('container', self::NS); |
340 | 340 | // anonymous services as arguments/properties |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | foreach ($nodes as $node) { |
343 | 343 | if ($services = $this->getChildren($node, 'service')) { |
344 | 344 | // give it a unique name |
345 | - $id = \sprintf('%d_%s', ++$count, \preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')) . $suffix); |
|
345 | + $id = \sprintf('%d_%s', ++$count, \preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')).$suffix); |
|
346 | 346 | $node->setAttribute('id', $id); |
347 | 347 | $node->setAttribute('service', $id); |
348 | 348 | $definitions[$id] = [$services[0], $file, \false]; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | foreach ($nodes as $node) { |
359 | 359 | @\trigger_error(\sprintf('Top-level anonymous services are deprecated since Symfony 3.4, the "id" attribute will be required in version 4.0 in %s at line %d.', $file, $node->getLineNo()), \E_USER_DEPRECATED); |
360 | 360 | // give it a unique name |
361 | - $id = \sprintf('%d_%s', ++$count, \preg_replace('/^.*\\\\/', '', $node->getAttribute('class')) . $suffix); |
|
361 | + $id = \sprintf('%d_%s', ++$count, \preg_replace('/^.*\\\\/', '', $node->getAttribute('class')).$suffix); |
|
362 | 362 | $node->setAttribute('id', $id); |
363 | 363 | $definitions[$id] = [$node, $file, \true]; |
364 | 364 | } |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | // this is used by ChildDefinition to overwrite a specific |
395 | 395 | // argument of the parent definition |
396 | 396 | if ($arg->hasAttribute('index')) { |
397 | - $key = ($isChildDefinition ? 'index_' : '') . $arg->getAttribute('index'); |
|
398 | - } elseif (!$arg->hasAttribute('key')) { |
|
397 | + $key = ($isChildDefinition ? 'index_' : '').$arg->getAttribute('index'); |
|
398 | + } elseif ( ! $arg->hasAttribute('key')) { |
|
399 | 399 | // Append an empty argument, then fetch its key to overwrite it later |
400 | 400 | $arguments[] = null; |
401 | 401 | $keys = \array_keys($arguments); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior); |
424 | 424 | break; |
425 | 425 | case 'expression': |
426 | - if (!\class_exists(Expression::class)) { |
|
426 | + if ( ! \class_exists(Expression::class)) { |
|
427 | 427 | throw new \LogicException(\sprintf('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".')); |
428 | 428 | } |
429 | 429 | $arguments[$key] = new Expression($arg->nodeValue); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | } |
441 | 441 | break; |
442 | 442 | case 'tagged': |
443 | - if (!$arg->getAttribute('tag')) { |
|
443 | + if ( ! $arg->getAttribute('tag')) { |
|
444 | 444 | throw new InvalidArgumentException(\sprintf('Tag "<%s>" with type="tagged" has no or empty "tag" attribute in "%s".', $name, $file)); |
445 | 445 | } |
446 | 446 | $arguments[$key] = new TaggedIteratorArgument($arg->getAttribute('tag')); |
@@ -483,17 +483,17 @@ discard block |
||
483 | 483 | */ |
484 | 484 | public function validateSchema(\DOMDocument $dom) |
485 | 485 | { |
486 | - $schemaLocations = ['http://symfony.com/schema/dic/services' => \str_replace('\\', '/', __DIR__ . '/schema/dic/services/services-1.0.xsd')]; |
|
486 | + $schemaLocations = ['http://symfony.com/schema/dic/services' => \str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd')]; |
|
487 | 487 | if ($element = $dom->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')) { |
488 | 488 | $items = \preg_split('/\\s+/', $element); |
489 | 489 | for ($i = 0, $nb = \count($items); $i < $nb; $i += 2) { |
490 | - if (!$this->container->hasExtension($items[$i])) { |
|
490 | + if ( ! $this->container->hasExtension($items[$i])) { |
|
491 | 491 | continue; |
492 | 492 | } |
493 | 493 | if (($extension = $this->container->getExtension($items[$i])) && \false !== $extension->getXsdValidationBasePath()) { |
494 | 494 | $ns = $extension->getNamespace(); |
495 | - $path = \str_replace([$ns, \str_replace('http://', 'https://', $ns)], \str_replace('\\', '/', $extension->getXsdValidationBasePath()) . '/', $items[$i + 1]); |
|
496 | - if (!\is_file($path)) { |
|
495 | + $path = \str_replace([$ns, \str_replace('http://', 'https://', $ns)], \str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]); |
|
496 | + if ( ! \is_file($path)) { |
|
497 | 497 | throw new RuntimeException(\sprintf('Extension "%s" references a non-existent XSD file "%s".', \get_class($extension), $path)); |
498 | 498 | } |
499 | 499 | $schemaLocations[$items[$i]] = $path; |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | $locationstart = 'phar:///'; |
517 | 517 | } |
518 | 518 | } |
519 | - $drive = '\\' === \DIRECTORY_SEPARATOR ? \array_shift($parts) . '/' : ''; |
|
520 | - $location = $locationstart . $drive . \implode('/', \array_map('rawurlencode', $parts)); |
|
521 | - $imports .= \sprintf(' <xsd:import namespace="%s" schemaLocation="%s" />' . "\n", $namespace, $location); |
|
519 | + $drive = '\\' === \DIRECTORY_SEPARATOR ? \array_shift($parts).'/' : ''; |
|
520 | + $location = $locationstart.$drive.\implode('/', \array_map('rawurlencode', $parts)); |
|
521 | + $imports .= \sprintf(' <xsd:import namespace="%s" schemaLocation="%s" />'."\n", $namespace, $location); |
|
522 | 522 | } |
523 | 523 | $source = <<<EOF |
524 | 524 | <?xml version="1.0" encoding="utf-8" ?> |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | private function validateAlias(\DOMElement $alias, $file) |
552 | 552 | { |
553 | 553 | foreach ($alias->attributes as $name => $node) { |
554 | - if (!\in_array($name, ['alias', 'id', 'public'])) { |
|
554 | + if ( ! \in_array($name, ['alias', 'id', 'public'])) { |
|
555 | 555 | @\trigger_error(\sprintf('Using the attribute "%s" is deprecated for the service "%s" which is defined as an alias in "%s". Allowed attributes for service aliases are "alias", "id" and "public". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $name, $alias->getAttribute('id'), $file), \E_USER_DEPRECATED); |
556 | 556 | } |
557 | 557 | } |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | private function validateExtensions(\DOMDocument $dom, $file) |
572 | 572 | { |
573 | 573 | foreach ($dom->documentElement->childNodes as $node) { |
574 | - if (!$node instanceof \DOMElement || 'http://symfony.com/schema/dic/services' === $node->namespaceURI) { |
|
574 | + if ( ! $node instanceof \DOMElement || 'http://symfony.com/schema/dic/services' === $node->namespaceURI) { |
|
575 | 575 | continue; |
576 | 576 | } |
577 | 577 | // can it be handled by an extension? |
578 | - if (!$this->container->hasExtension($node->namespaceURI)) { |
|
579 | - $extensionNamespaces = \array_filter(\array_map(function ($ext) { |
|
578 | + if ( ! $this->container->hasExtension($node->namespaceURI)) { |
|
579 | + $extensionNamespaces = \array_filter(\array_map(function($ext) { |
|
580 | 580 | return $ext->getNamespace(); |
581 | 581 | }, $this->container->getExtensions())); |
582 | 582 | throw new InvalidArgumentException(\sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? \sprintf('"%s"', \implode('", "', $extensionNamespaces)) : 'none')); |
@@ -589,11 +589,11 @@ discard block |
||
589 | 589 | private function loadFromExtensions(\DOMDocument $xml) |
590 | 590 | { |
591 | 591 | foreach ($xml->documentElement->childNodes as $node) { |
592 | - if (!$node instanceof \DOMElement || self::NS === $node->namespaceURI) { |
|
592 | + if ( ! $node instanceof \DOMElement || self::NS === $node->namespaceURI) { |
|
593 | 593 | continue; |
594 | 594 | } |
595 | 595 | $values = static::convertDomElementToArray($node); |
596 | - if (!\is_array($values)) { |
|
596 | + if ( ! \is_array($values)) { |
|
597 | 597 | $values = []; |
598 | 598 | } |
599 | 599 | $this->container->loadFromExtension($node->namespaceURI, $values); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $this->container->fileExists($path, \false); |
28 | 28 | foreach (\scandir($path) as $dir) { |
29 | 29 | if ('.' !== $dir[0]) { |
30 | - if (\is_dir($path . '/' . $dir)) { |
|
30 | + if (\is_dir($path.'/'.$dir)) { |
|
31 | 31 | $dir .= '/'; |
32 | 32 | // append / to allow recursion |
33 | 33 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | public function setValues(array $values) |
41 | 41 | { |
42 | 42 | foreach ($values as $k => $v) { |
43 | - if (null !== $v && !$v instanceof Reference) { |
|
43 | + if (null !== $v && ! $v instanceof Reference) { |
|
44 | 44 | throw new InvalidArgumentException(\sprintf('An IteratorArgument must hold only Reference instances, "%s" given.', \is_object($v) ? \get_class($v) : \gettype($v))); |
45 | 45 | } |
46 | 46 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | */ |
37 | 37 | public function setValues(array $values) |
38 | 38 | { |
39 | - if ([0] !== \array_keys($values) || !($values[0] instanceof Reference || null === $values[0])) { |
|
39 | + if ([0] !== \array_keys($values) || ! ($values[0] instanceof Reference || null === $values[0])) { |
|
40 | 40 | throw new InvalidArgumentException('A ServiceClosureArgument must hold one and only one Reference.'); |
41 | 41 | } |
42 | 42 | $this->values = $values; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function getNamespace() |
38 | 38 | { |
39 | - return 'http://example.org/schema/dic/' . $this->getAlias(); |
|
39 | + return 'http://example.org/schema/dic/'.$this->getAlias(); |
|
40 | 40 | } |
41 | 41 | /** |
42 | 42 | * Returns the recommended alias to use in XML. |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $class = \substr_replace($class, '\\Configuration', \strrpos($class, '\\')); |
81 | 81 | $class = $container->getReflectionClass($class); |
82 | 82 | $constructor = $class ? $class->getConstructor() : null; |
83 | - return $class && (!$constructor || !$constructor->getNumberOfRequiredParameters()) ? $class->newInstance() : null; |
|
83 | + return $class && ( ! $constructor || ! $constructor->getNumberOfRequiredParameters()) ? $class->newInstance() : null; |
|
84 | 84 | } |
85 | 85 | /** |
86 | 86 | * @return array |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | protected function isConfigEnabled(ContainerBuilder $container, array $config) |
110 | 110 | { |
111 | - if (!\array_key_exists('enabled', $config)) { |
|
111 | + if ( ! \array_key_exists('enabled', $config)) { |
|
112 | 112 | throw new InvalidArgumentException("The config array has no 'enabled' key."); |
113 | 113 | } |
114 | 114 | return (bool) $container->getParameterBag()->resolveValue($config['enabled']); |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | { |
38 | 38 | $i = \strpos($name, ':'); |
39 | 39 | if ('file' === $prefix) { |
40 | - if (!\is_scalar($file = $getEnv($name))) { |
|
40 | + if ( ! \is_scalar($file = $getEnv($name))) { |
|
41 | 41 | throw new RuntimeException(\sprintf('Invalid file name: env var "%s" is non-scalar.', $name)); |
42 | 42 | } |
43 | - if (!\file_exists($file)) { |
|
43 | + if ( ! \file_exists($file)) { |
|
44 | 44 | throw new RuntimeException(\sprintf('Env "file:%s" not found: "%s" does not exist.', $name, $file)); |
45 | 45 | } |
46 | 46 | return \file_get_contents($file); |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | $env = $_SERVER[$name]; |
56 | 56 | } elseif (\false === ($env = \getenv($name)) || null === $env) { |
57 | 57 | // null is a possible value because of thread safety issues |
58 | - if (!$this->container->hasParameter("env({$name})")) { |
|
58 | + if ( ! $this->container->hasParameter("env({$name})")) { |
|
59 | 59 | throw new EnvNotFoundException($name); |
60 | 60 | } |
61 | 61 | if (null === ($env = $this->container->getParameter("env({$name})"))) { |
62 | 62 | return null; |
63 | 63 | } |
64 | 64 | } |
65 | - if (!\is_scalar($env)) { |
|
65 | + if ( ! \is_scalar($env)) { |
|
66 | 66 | throw new RuntimeException(\sprintf('Non-scalar env var "%s" cannot be cast to "%s".', $name, $prefix)); |
67 | 67 | } |
68 | 68 | if ('string' === $prefix) { |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | return (bool) self::phpize($env); |
73 | 73 | } |
74 | 74 | if ('int' === $prefix) { |
75 | - if (!\is_numeric($env = self::phpize($env))) { |
|
75 | + if ( ! \is_numeric($env = self::phpize($env))) { |
|
76 | 76 | throw new RuntimeException(\sprintf('Non-numeric env var "%s" cannot be cast to int.', $name)); |
77 | 77 | } |
78 | 78 | return (int) $env; |
79 | 79 | } |
80 | 80 | if ('float' === $prefix) { |
81 | - if (!\is_numeric($env = self::phpize($env))) { |
|
81 | + if ( ! \is_numeric($env = self::phpize($env))) { |
|
82 | 82 | throw new RuntimeException(\sprintf('Non-numeric env var "%s" cannot be cast to float.', $name)); |
83 | 83 | } |
84 | 84 | return (float) $env; |
85 | 85 | } |
86 | 86 | if ('const' === $prefix) { |
87 | - if (!\defined($env)) { |
|
87 | + if ( ! \defined($env)) { |
|
88 | 88 | throw new RuntimeException(\sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env)); |
89 | 89 | } |
90 | 90 | return \constant($env); |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | if ('json' === $prefix) { |
96 | 96 | $env = \json_decode($env, \true); |
97 | 97 | if (\JSON_ERROR_NONE !== \json_last_error()) { |
98 | - throw new RuntimeException(\sprintf('Invalid JSON in env var "%s": ', $name) . \json_last_error_msg()); |
|
98 | + throw new RuntimeException(\sprintf('Invalid JSON in env var "%s": ', $name).\json_last_error_msg()); |
|
99 | 99 | } |
100 | - if (!\is_array($env)) { |
|
100 | + if ( ! \is_array($env)) { |
|
101 | 101 | throw new RuntimeException(\sprintf('Invalid JSON env var "%s": array expected, "%s" given.', $name, \gettype($env))); |
102 | 102 | } |
103 | 103 | return $env; |
104 | 104 | } |
105 | 105 | if ('resolve' === $prefix) { |
106 | - return \preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($name) { |
|
107 | - if (!isset($match[1])) { |
|
106 | + return \preg_replace_callback('/%%|%([^%\\s]+)%/', function($match) use($name) { |
|
107 | + if ( ! isset($match[1])) { |
|
108 | 108 | return '%'; |
109 | 109 | } |
110 | 110 | $value = $this->container->getParameter($match[1]); |
111 | - if (!\is_scalar($value)) { |
|
111 | + if ( ! \is_scalar($value)) { |
|
112 | 112 | throw new RuntimeException(\sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, \gettype($value))); |
113 | 113 | } |
114 | 114 | return $value; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | private static function phpize($value) |
120 | 120 | { |
121 | - if (!\class_exists(XmlUtils::class)) { |
|
121 | + if ( ! \class_exists(XmlUtils::class)) { |
|
122 | 122 | throw new RuntimeException('The Symfony Config component is required to cast env vars to "bool", "int" or "float".'); |
123 | 123 | } |
124 | 124 | return XmlUtils::phpize($value); |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | if ('service_container' === $id) { |
161 | 161 | throw new InvalidArgumentException('You cannot set service "service_container".'); |
162 | 162 | } |
163 | - if (isset($this->privates[$id]) || !(isset($this->fileMap[$id]) || isset($this->methodMap[$id]))) { |
|
164 | - if (!isset($this->privates[$id]) && !isset($this->getRemovedIds()[$id])) { |
|
163 | + if (isset($this->privates[$id]) || ! (isset($this->fileMap[$id]) || isset($this->methodMap[$id]))) { |
|
164 | + if ( ! isset($this->privates[$id]) && ! isset($this->getRemovedIds()[$id])) { |
|
165 | 165 | // no-op |
166 | 166 | } elseif (null === $service) { |
167 | 167 | @\trigger_error(\sprintf('The "%s" service is private, unsetting it is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function has($id) |
196 | 196 | { |
197 | - for ($i = 2;;) { |
|
197 | + for ($i = 2; ;) { |
|
198 | 198 | if (isset($this->privates[$id])) { |
199 | 199 | @\trigger_error(\sprintf('The "%s" service is private, checking for its existence is deprecated since Symfony 3.2 and will fail in 4.0.', $id), \E_USER_DEPRECATED); |
200 | 200 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, |
218 | 218 | // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper) |
219 | - if (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class && \method_exists($this, 'get' . \strtr($id, $this->underscoreMap) . 'Service')) { |
|
219 | + if ( ! $this->methodMap && ! $this instanceof ContainerBuilder && __CLASS__ !== static::class && \method_exists($this, 'get'.\strtr($id, $this->underscoreMap).'Service')) { |
|
220 | 220 | @\trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', \E_USER_DEPRECATED); |
221 | 221 | return \true; |
222 | 222 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | // available services. Service IDs are case insensitive, however since |
247 | 247 | // this method can be called thousands of times during a request, avoid |
248 | 248 | // calling $this->normalizeId($id) unless necessary. |
249 | - for ($i = 2;;) { |
|
249 | + for ($i = 2; ;) { |
|
250 | 250 | if (isset($this->privates[$id])) { |
251 | 251 | @\trigger_error(\sprintf('The "%s" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead.', $id), \E_USER_DEPRECATED); |
252 | 252 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | unset($this->loading[$id]); |
274 | 274 | $id = $normalizedId; |
275 | 275 | continue; |
276 | - } elseif (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class && \method_exists($this, $method = 'get' . \strtr($id, $this->underscoreMap) . 'Service')) { |
|
276 | + } elseif ( ! $this->methodMap && ! $this instanceof ContainerBuilder && __CLASS__ !== static::class && \method_exists($this, $method = 'get'.\strtr($id, $this->underscoreMap).'Service')) { |
|
277 | 277 | // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, |
278 | 278 | // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper) |
279 | 279 | @\trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', \E_USER_DEPRECATED); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | } |
289 | 289 | } |
290 | 290 | if (1 === $invalidBehavior) { |
291 | - if (!$id) { |
|
291 | + if ( ! $id) { |
|
292 | 292 | throw new ServiceNotFoundException($id); |
293 | 293 | } |
294 | 294 | if (isset($this->syntheticIds[$id])) { |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | public function getServiceIds() |
344 | 344 | { |
345 | 345 | $ids = []; |
346 | - if (!$this->methodMap && !$this instanceof ContainerBuilder && __CLASS__ !== static::class) { |
|
346 | + if ( ! $this->methodMap && ! $this instanceof ContainerBuilder && __CLASS__ !== static::class) { |
|
347 | 347 | // We only check the convention-based factory in a compiled container (i.e. a child class other than a ContainerBuilder, |
348 | 348 | // and only when the dumper has not generated the method map (otherwise the method map is considered to be fully populated by the dumper) |
349 | 349 | @\trigger_error('Generating a dumped container without populating the method map is deprecated since Symfony 3.2 and will be unsupported in 4.0. Update your dumper to generate the method map.', \E_USER_DEPRECATED); |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | if (isset($this->envCache[$name]) || \array_key_exists($name, $this->envCache)) { |
412 | 412 | return $this->envCache[$name]; |
413 | 413 | } |
414 | - if (!$this->has($id = 'container.env_var_processors_locator')) { |
|
414 | + if ( ! $this->has($id = 'container.env_var_processors_locator')) { |
|
415 | 415 | $this->set($id, new ServiceLocator([])); |
416 | 416 | } |
417 | - if (!$this->getEnv) { |
|
417 | + if ( ! $this->getEnv) { |
|
418 | 418 | $this->getEnv = new \ReflectionMethod($this, __FUNCTION__); |
419 | 419 | $this->getEnv->setAccessible(\true); |
420 | 420 | $this->getEnv = $this->getEnv->getClosure($this); |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | */ |
447 | 447 | public function normalizeId($id) |
448 | 448 | { |
449 | - if (!\is_string($id)) { |
|
449 | + if ( ! \is_string($id)) { |
|
450 | 450 | $id = (string) $id; |
451 | 451 | } |
452 | 452 | if (isset($this->normalizedIds[$normalizedId = \strtolower($id)])) { |
@@ -36,7 +36,7 @@ |
||
36 | 36 | } else { |
37 | 37 | $msg .= ' Did you mean one of these: "'; |
38 | 38 | } |
39 | - $msg .= \implode('", "', $alternatives) . '"?'; |
|
39 | + $msg .= \implode('", "', $alternatives).'"?'; |
|
40 | 40 | } |
41 | 41 | parent::__construct($msg, 0, $previous); |
42 | 42 | $this->id = $id; |