@@ -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; |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | // return first result |
33 | 33 | } |
34 | 34 | } |
35 | - if (!\preg_match('/^(?:\\w++:)*+\\w++$/', $env)) { |
|
35 | + if ( ! \preg_match('/^(?:\\w++:)*+\\w++$/', $env)) { |
|
36 | 36 | throw new InvalidArgumentException(\sprintf('Invalid "%s" name: only "word" characters are allowed.', $name)); |
37 | 37 | } |
38 | 38 | if ($this->has($name)) { |
39 | 39 | $defaultValue = parent::get($name); |
40 | - if (null !== $defaultValue && !\is_scalar($defaultValue)) { |
|
40 | + if (null !== $defaultValue && ! \is_scalar($defaultValue)) { |
|
41 | 41 | throw new RuntimeException(\sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', \gettype($defaultValue), $name)); |
42 | 42 | } |
43 | 43 | } |
44 | - $uniqueName = \md5($name . \uniqid(\mt_rand(), \true)); |
|
44 | + $uniqueName = \md5($name.\uniqid(\mt_rand(), \true)); |
|
45 | 45 | $placeholder = \sprintf('env_%s_%s', \str_replace(':', '_', $env), $uniqueName); |
46 | 46 | $this->envPlaceholders[$env][$placeholder] = $placeholder; |
47 | 47 | return $placeholder; |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | } |
96 | 96 | parent::resolve(); |
97 | 97 | foreach ($this->envPlaceholders as $env => $placeholders) { |
98 | - if (!$this->has($name = "env({$env})")) { |
|
98 | + if ( ! $this->has($name = "env({$env})")) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | if (\is_numeric($default = $this->parameters[$name])) { |
102 | 102 | $this->parameters[$name] = (string) $default; |
103 | - } elseif (null !== $default && !\is_scalar($default)) { |
|
103 | + } elseif (null !== $default && ! \is_scalar($default)) { |
|
104 | 104 | throw new RuntimeException(\sprintf('The default value of env parameter "%s" must be scalar or null, "%s" given.', $env, \gettype($default))); |
105 | 105 | } |
106 | 106 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | $v = null; |
64 | 64 | $this->container->getDefinition($this->currentId)->addError($e->getMessage()); |
65 | 65 | } |
66 | - return $this->resolveArrays || !$v || !\is_array($v) ? $v : $value; |
|
66 | + return $this->resolveArrays || ! $v || ! \is_array($v) ? $v : $value; |
|
67 | 67 | } |
68 | 68 | if ($value instanceof Definition) { |
69 | 69 | $value->setBindings($this->processValue($value->getBindings())); |
@@ -100,9 +100,9 @@ |
||
100 | 100 | public function log(CompilerPassInterface $pass, $message) |
101 | 101 | { |
102 | 102 | if (\false !== \strpos($message, "\n")) { |
103 | - $message = \str_replace("\n", "\n" . \get_class($pass) . ': ', \trim($message)); |
|
103 | + $message = \str_replace("\n", "\n".\get_class($pass).': ', \trim($message)); |
|
104 | 104 | } |
105 | - $this->log[] = \get_class($pass) . ': ' . $message; |
|
105 | + $this->log[] = \get_class($pass).': '.$message; |
|
106 | 106 | } |
107 | 107 | /** |
108 | 108 | * Returns the log. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function __construct(ResolveClassPass $resolveClassPass = null) |
25 | 25 | { |
26 | 26 | if (null === $resolveClassPass) { |
27 | - @\trigger_error('The ' . __CLASS__ . ' class is deprecated since Symfony 3.3 and will be removed in 4.0.', \E_USER_DEPRECATED); |
|
27 | + @\trigger_error('The '.__CLASS__.' class is deprecated since Symfony 3.3 and will be removed in 4.0.', \E_USER_DEPRECATED); |
|
28 | 28 | } |
29 | 29 | $this->resolveClassPass = $resolveClassPass; |
30 | 30 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function process(ContainerBuilder $container) |
35 | 35 | { |
36 | 36 | // works only since php 7.0 and hhvm 3.11 |
37 | - if (!\method_exists(\ReflectionMethod::class, 'getReturnType')) { |
|
37 | + if ( ! \method_exists(\ReflectionMethod::class, 'getReturnType')) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | $resolveClassPassChanges = null !== $this->resolveClassPass ? $this->resolveClassPass->getChanges() : []; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return; |
50 | 50 | } |
51 | 51 | $factory = $definition->getFactory(); |
52 | - if (null === $factory || !isset($resolveClassPassChanges[$id]) && null !== $definition->getClass()) { |
|
52 | + if (null === $factory || ! isset($resolveClassPassChanges[$id]) && null !== $definition->getClass()) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | $class = null; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | } else { |
73 | 73 | $class = $factory[0]; |
74 | 74 | } |
75 | - if (!($m = $container->getReflectionClass($class, \false))) { |
|
75 | + if ( ! ($m = $container->getReflectionClass($class, \false))) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | try { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | } |
84 | 84 | $returnType = $m->getReturnType(); |
85 | - if (null !== $returnType && !$returnType->isBuiltin()) { |
|
85 | + if (null !== $returnType && ! $returnType->isBuiltin()) { |
|
86 | 86 | $returnType = $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType; |
87 | 87 | if (null !== $class) { |
88 | 88 | $declaringClass = $m->getDeclaringClass()->getName(); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $returnType = \get_parent_class($declaringClass) ?: null; |
93 | 93 | } |
94 | 94 | } |
95 | - if (null !== $returnType && (!isset($resolveClassPassChanges[$id]) || $returnType !== $resolveClassPassChanges[$id])) { |
|
95 | + if (null !== $returnType && ( ! isset($resolveClassPassChanges[$id]) || $returnType !== $resolveClassPassChanges[$id])) { |
|
96 | 96 | @\trigger_error(\sprintf('Relying on its factory\'s return-type to define the class of service "%s" is deprecated since Symfony 3.3 and won\'t work in 4.0. Set the "class" attribute to "%s" on the service definition instead.', $id, $returnType), \E_USER_DEPRECATED); |
97 | 97 | } |
98 | 98 | $definition->setClass($returnType); |
@@ -58,7 +58,7 @@ |
||
58 | 58 | } |
59 | 59 | if (1 === \count($referencingAliases) && \false === $isReferenced) { |
60 | 60 | $container->setDefinition((string) \reset($referencingAliases), $definition); |
61 | - $definition->setPublic(!$definition->isPrivate()); |
|
61 | + $definition->setPublic( ! $definition->isPrivate()); |
|
62 | 62 | $definition->setPrivate(\reset($referencingAliases)->isPrivate()); |
63 | 63 | $container->removeDefinition($id); |
64 | 64 | $container->log($this, \sprintf('Removed service "%s"; reason: replaces alias %s.', $id, \reset($referencingAliases))); |
@@ -22,10 +22,10 @@ |
||
22 | 22 | { |
23 | 23 | protected function processValue($value, $isRoot = \false) |
24 | 24 | { |
25 | - if (!$value instanceof Reference) { |
|
25 | + if ( ! $value instanceof Reference) { |
|
26 | 26 | return parent::processValue($value, $isRoot); |
27 | 27 | } |
28 | - if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior() && !$this->container->has($id = (string) $value)) { |
|
28 | + if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior() && ! $this->container->has($id = (string) $value)) { |
|
29 | 29 | throw new ServiceNotFoundException($id, $this->currentId); |
30 | 30 | } |
31 | 31 | return $value; |
@@ -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]; |