@@ -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; |
@@ -55,9 +55,9 @@ |
||
55 | 55 | } else { |
56 | 56 | $this->message .= ' Did you mean one of these: "'; |
57 | 57 | } |
58 | - $this->message .= \implode('", "', $this->alternatives) . '"?'; |
|
58 | + $this->message .= \implode('", "', $this->alternatives).'"?'; |
|
59 | 59 | } elseif (null !== $this->nonNestedAlternative) { |
60 | - $this->message .= ' You cannot access nested array items, do you want to inject "' . $this->nonNestedAlternative . '" instead?'; |
|
60 | + $this->message .= ' You cannot access nested array items, do you want to inject "'.$this->nonNestedAlternative.'" instead?'; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | public function getKey() |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | public function get($name) |
62 | 62 | { |
63 | 63 | $name = $this->normalizeName($name); |
64 | - if (!\array_key_exists($name, $this->parameters)) { |
|
65 | - if (!$name) { |
|
64 | + if ( ! \array_key_exists($name, $this->parameters)) { |
|
65 | + if ( ! $name) { |
|
66 | 66 | throw new ParameterNotFoundException($name); |
67 | 67 | } |
68 | 68 | $alternatives = []; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | } |
75 | 75 | $nonNestedAlternative = null; |
76 | - if (!\count($alternatives) && \false !== \strpos($name, '.')) { |
|
76 | + if ( ! \count($alternatives) && \false !== \strpos($name, '.')) { |
|
77 | 77 | $namePartsLength = \array_map('strlen', \explode('.', $name)); |
78 | 78 | $key = \substr($name, 0, -1 * (1 + \array_pop($namePartsLength))); |
79 | 79 | while (\count($namePartsLength)) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | return $args; |
160 | 160 | } |
161 | - if (!\is_string($value) || 2 > \strlen($value)) { |
|
161 | + if ( ! \is_string($value) || 2 > \strlen($value)) { |
|
162 | 162 | return $value; |
163 | 163 | } |
164 | 164 | return $this->resolveString($value, $resolving); |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | $resolving[$lcKey] = \true; |
191 | 191 | return $this->resolved ? $this->get($key) : $this->resolveValue($this->get($key), $resolving); |
192 | 192 | } |
193 | - return \preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($resolving, $value) { |
|
193 | + return \preg_replace_callback('/%%|%([^%\\s]+)%/', function($match) use($resolving, $value) { |
|
194 | 194 | // skip %% |
195 | - if (!isset($match[1])) { |
|
195 | + if ( ! isset($match[1])) { |
|
196 | 196 | return '%%'; |
197 | 197 | } |
198 | 198 | $key = $match[1]; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | throw new ParameterCircularReferenceException(\array_keys($resolving)); |
203 | 203 | } |
204 | 204 | $resolved = $this->get($key); |
205 | - if (!\is_string($resolved) && !\is_numeric($resolved)) { |
|
205 | + if ( ! \is_string($resolved) && ! \is_numeric($resolved)) { |
|
206 | 206 | throw new RuntimeException(\sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type "%s" inside string value "%s".', $key, \gettype($resolved), $value)); |
207 | 207 | } |
208 | 208 | $resolved = (string) $resolved; |