@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $rootNode = $node = $configuration->getConfigTreeBuilder()->buildTree(); |
35 | 35 | foreach (\explode('.', $path) as $step) { |
36 | - if (!$node instanceof ArrayNode) { |
|
36 | + if ( ! $node instanceof ArrayNode) { |
|
37 | 37 | throw new \UnexpectedValueException(\sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path)); |
38 | 38 | } |
39 | 39 | /** @var NodeInterface[] $children */ |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | if ($node instanceof PrototypedArrayNode) { |
74 | 74 | $children = $this->getPrototypeChildren($node); |
75 | 75 | } |
76 | - if (!$children) { |
|
76 | + if ( ! $children) { |
|
77 | 77 | if ($node->hasDefaultValue() && \count($defaultArray = $node->getDefaultValue())) { |
78 | 78 | $default = ''; |
79 | - } elseif (!\is_array($example)) { |
|
79 | + } elseif ( ! \is_array($example)) { |
|
80 | 80 | $default = '[]'; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | } elseif ($node instanceof EnumNode) { |
84 | - $comments[] = 'One of ' . \implode('; ', \array_map('json_encode', $node->getValues())); |
|
84 | + $comments[] = 'One of '.\implode('; ', \array_map('json_encode', $node->getValues())); |
|
85 | 85 | $default = $node->hasDefaultValue() ? Inline::dump($node->getDefaultValue()) : '~'; |
86 | 86 | } else { |
87 | 87 | $default = '~'; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if (\is_array($default)) { |
91 | 91 | if (\count($defaultArray = $node->getDefaultValue())) { |
92 | 92 | $default = ''; |
93 | - } elseif (!\is_array($example)) { |
|
93 | + } elseif ( ! \is_array($example)) { |
|
94 | 94 | $default = '[]'; |
95 | 95 | } |
96 | 96 | } else { |
@@ -107,36 +107,36 @@ discard block |
||
107 | 107 | $comments[] = \sprintf('Deprecated (%s)', $node->getDeprecationMessage($node->getName(), $parentNode ? $parentNode->getPath() : $node->getPath())); |
108 | 108 | } |
109 | 109 | // example |
110 | - if ($example && !\is_array($example)) { |
|
111 | - $comments[] = 'Example: ' . $example; |
|
110 | + if ($example && ! \is_array($example)) { |
|
111 | + $comments[] = 'Example: '.$example; |
|
112 | 112 | } |
113 | - $default = '' != (string) $default ? ' ' . $default : ''; |
|
114 | - $comments = \count($comments) ? '# ' . \implode(', ', $comments) : ''; |
|
115 | - $key = $prototypedArray ? '-' : $node->getName() . ':'; |
|
113 | + $default = '' != (string) $default ? ' '.$default : ''; |
|
114 | + $comments = \count($comments) ? '# '.\implode(', ', $comments) : ''; |
|
115 | + $key = $prototypedArray ? '-' : $node->getName().':'; |
|
116 | 116 | $text = \rtrim(\sprintf('%-21s%s %s', $key, $default, $comments), ' '); |
117 | 117 | if ($info = $node->getInfo()) { |
118 | 118 | $this->writeLine(''); |
119 | 119 | // indenting multi-line info |
120 | - $info = \str_replace("\n", \sprintf("\n%" . $depth * 4 . 's# ', ' '), $info); |
|
121 | - $this->writeLine('# ' . $info, $depth * 4); |
|
120 | + $info = \str_replace("\n", \sprintf("\n%".$depth * 4.'s# ', ' '), $info); |
|
121 | + $this->writeLine('# '.$info, $depth * 4); |
|
122 | 122 | } |
123 | 123 | $this->writeLine($text, $depth * 4); |
124 | 124 | // output defaults |
125 | 125 | if ($defaultArray) { |
126 | 126 | $this->writeLine(''); |
127 | 127 | $message = \count($defaultArray) > 1 ? 'Defaults' : 'Default'; |
128 | - $this->writeLine('# ' . $message . ':', $depth * 4 + 4); |
|
128 | + $this->writeLine('# '.$message.':', $depth * 4 + 4); |
|
129 | 129 | $this->writeArray($defaultArray, $depth + 1); |
130 | 130 | } |
131 | 131 | if (\is_array($example)) { |
132 | 132 | $this->writeLine(''); |
133 | 133 | $message = \count($example) > 1 ? 'Examples' : 'Example'; |
134 | - $this->writeLine('# ' . $message . ':', $depth * 4 + 4); |
|
134 | + $this->writeLine('# '.$message.':', $depth * 4 + 4); |
|
135 | 135 | $this->writeArray($example, $depth + 1); |
136 | 136 | } |
137 | 137 | if ($children) { |
138 | 138 | foreach ($children as $childNode) { |
139 | - $this->writeNode($childNode, $node, $depth + 1, $node instanceof PrototypedArrayNode && !$node->getKeyAttribute()); |
|
139 | + $this->writeNode($childNode, $node, $depth + 1, $node instanceof PrototypedArrayNode && ! $node->getKeyAttribute()); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | private function writeLine($text, $indent = 0) |
150 | 150 | { |
151 | 151 | $indent = \strlen($text) + $indent; |
152 | - $format = '%' . $indent . 's'; |
|
153 | - $this->reference .= \sprintf($format, $text) . "\n"; |
|
152 | + $format = '%'.$indent.'s'; |
|
153 | + $this->reference .= \sprintf($format, $text)."\n"; |
|
154 | 154 | } |
155 | 155 | private function writeArray(array $array, $depth) |
156 | 156 | { |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | $val = $value; |
163 | 163 | } |
164 | 164 | if ($isIndexed) { |
165 | - $this->writeLine('- ' . $val, $depth * 4); |
|
165 | + $this->writeLine('- '.$val, $depth * 4); |
|
166 | 166 | } else { |
167 | - $this->writeLine(\sprintf('%-20s %s', $key . ':', $val), $depth * 4); |
|
167 | + $this->writeLine(\sprintf('%-20s %s', $key.':', $val), $depth * 4); |
|
168 | 168 | } |
169 | 169 | if (\is_array($value)) { |
170 | 170 | $this->writeArray($value, $depth + 1); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $prototype = $node->getPrototype(); |
180 | 180 | $key = $node->getKeyAttribute(); |
181 | 181 | // Do not expand prototype if it isn't an array node nor uses attribute as key |
182 | - if (!$key && !$prototype instanceof ArrayNode) { |
|
182 | + if ( ! $key && ! $prototype instanceof ArrayNode) { |
|
183 | 183 | return $node->getChildren(); |
184 | 184 | } |
185 | 185 | if ($prototype instanceof ArrayNode) { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | $info = 'Prototype'; |
199 | 199 | if (null !== $prototype->getInfo()) { |
200 | - $info .= ': ' . $prototype->getInfo(); |
|
200 | + $info .= ': '.$prototype->getInfo(); |
|
201 | 201 | } |
202 | 202 | $keyNode->setInfo($info); |
203 | 203 | return [$key => $keyNode]; |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | private function writeNode(NodeInterface $node, $depth = 0, $root = \false, $namespace = null) |
44 | 44 | { |
45 | 45 | $rootName = $root ? 'config' : $node->getName(); |
46 | - $rootNamespace = $namespace ?: ($root ? 'http://example.org/schema/dic/' . $node->getName() : null); |
|
46 | + $rootNamespace = $namespace ?: ($root ? 'http://example.org/schema/dic/'.$node->getName() : null); |
|
47 | 47 | // xml remapping |
48 | 48 | if ($node->getParent()) { |
49 | - $remapping = \array_filter($node->getParent()->getXmlRemappings(), function ($mapping) use($rootName) { |
|
49 | + $remapping = \array_filter($node->getParent()->getXmlRemappings(), function($mapping) use($rootName) { |
|
50 | 50 | return $rootName === $mapping[1]; |
51 | 51 | }); |
52 | 52 | if (\count($remapping)) { |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | $rootComments[] = $rootInfo; |
67 | 67 | } |
68 | 68 | if ($rootNamespace) { |
69 | - $rootComments[] = 'Namespace: ' . $rootNamespace; |
|
69 | + $rootComments[] = 'Namespace: '.$rootNamespace; |
|
70 | 70 | } |
71 | 71 | // render prototyped nodes |
72 | 72 | if ($node instanceof PrototypedArrayNode) { |
73 | 73 | $prototype = $node->getPrototype(); |
74 | 74 | $info = 'prototype'; |
75 | 75 | if (null !== $prototype->getInfo()) { |
76 | - $info .= ': ' . $prototype->getInfo(); |
|
76 | + $info .= ': '.$prototype->getInfo(); |
|
77 | 77 | } |
78 | 78 | \array_unshift($rootComments, $info); |
79 | 79 | if ($key = $node->getKeyAttribute()) { |
80 | - $rootAttributes[$key] = \str_replace('-', ' ', $rootName) . ' ' . $key; |
|
80 | + $rootAttributes[$key] = \str_replace('-', ' ', $rootName).' '.$key; |
|
81 | 81 | } |
82 | 82 | if ($prototype instanceof PrototypedArrayNode) { |
83 | 83 | $prototype->setName($key); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | // get attributes and elements |
112 | 112 | foreach ($children as $child) { |
113 | - if (!$child instanceof ArrayNode) { |
|
113 | + if ( ! $child instanceof ArrayNode) { |
|
114 | 114 | // get attributes |
115 | 115 | // metadata |
116 | 116 | $name = \str_replace('_', '-', $child->getName()); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $comments[] = $info; |
123 | 123 | } |
124 | 124 | if ($example = $child->getExample()) { |
125 | - $comments[] = 'Example: ' . $example; |
|
125 | + $comments[] = 'Example: '.$example; |
|
126 | 126 | } |
127 | 127 | if ($child->isRequired()) { |
128 | 128 | $comments[] = 'Required'; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $comments[] = \sprintf('Deprecated (%s)', $child->getDeprecationMessage($child->getName(), $node->getPath())); |
132 | 132 | } |
133 | 133 | if ($child instanceof EnumNode) { |
134 | - $comments[] = 'One of ' . \implode('; ', \array_map('json_encode', $child->getValues())); |
|
134 | + $comments[] = 'One of '.\implode('; ', \array_map('json_encode', $child->getValues())); |
|
135 | 135 | } |
136 | 136 | if (\count($comments)) { |
137 | 137 | $rootAttributeComments[$name] = \implode(";\n", $comments); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // root node comment |
153 | 153 | if (\count($rootComments)) { |
154 | 154 | foreach ($rootComments as $comment) { |
155 | - $this->writeLine('<!-- ' . $comment . ' -->', $depth); |
|
155 | + $this->writeLine('<!-- '.$comment.' -->', $depth); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | // attribute comments |
@@ -161,27 +161,27 @@ discard block |
||
161 | 161 | $commentDepth = $depth + 4 + \strlen($attrName) + 2; |
162 | 162 | $commentLines = \explode("\n", $comment); |
163 | 163 | $multiline = \count($commentLines) > 1; |
164 | - $comment = \implode(\PHP_EOL . \str_repeat(' ', $commentDepth), $commentLines); |
|
164 | + $comment = \implode(\PHP_EOL.\str_repeat(' ', $commentDepth), $commentLines); |
|
165 | 165 | if ($multiline) { |
166 | 166 | $this->writeLine('<!--', $depth); |
167 | - $this->writeLine($attrName . ': ' . $comment, $depth + 4); |
|
167 | + $this->writeLine($attrName.': '.$comment, $depth + 4); |
|
168 | 168 | $this->writeLine('-->', $depth); |
169 | 169 | } else { |
170 | - $this->writeLine('<!-- ' . $attrName . ': ' . $comment . ' -->', $depth); |
|
170 | + $this->writeLine('<!-- '.$attrName.': '.$comment.' -->', $depth); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
174 | 174 | // render start tag + attributes |
175 | 175 | $rootIsVariablePrototype = isset($prototypeValue); |
176 | - $rootIsEmptyTag = 0 === \count($rootChildren) && !$rootIsVariablePrototype; |
|
177 | - $rootOpenTag = '<' . $rootName; |
|
176 | + $rootIsEmptyTag = 0 === \count($rootChildren) && ! $rootIsVariablePrototype; |
|
177 | + $rootOpenTag = '<'.$rootName; |
|
178 | 178 | if (1 >= ($attributesCount = \count($rootAttributes))) { |
179 | 179 | if (1 === $attributesCount) { |
180 | 180 | $rootOpenTag .= \sprintf(' %s="%s"', \current(\array_keys($rootAttributes)), $this->writeValue(\current($rootAttributes))); |
181 | 181 | } |
182 | 182 | $rootOpenTag .= $rootIsEmptyTag ? ' />' : '>'; |
183 | 183 | if ($rootIsVariablePrototype) { |
184 | - $rootOpenTag .= $prototypeValue . '</' . $rootName . '>'; |
|
184 | + $rootOpenTag .= $prototypeValue.'</'.$rootName.'>'; |
|
185 | 185 | } |
186 | 186 | $this->writeLine($rootOpenTag, $depth); |
187 | 187 | } else { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if ($attributesCount === $i++) { |
194 | 194 | $this->writeLine($rootIsEmptyTag ? '/>' : '>', $depth); |
195 | 195 | if ($rootIsVariablePrototype) { |
196 | - $rootOpenTag .= $prototypeValue . '</' . $rootName . '>'; |
|
196 | + $rootOpenTag .= $prototypeValue.'</'.$rootName.'>'; |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | } |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | $this->writeNode($child, $depth + 4); |
205 | 205 | } |
206 | 206 | // render end tag |
207 | - if (!$rootIsEmptyTag && !$rootIsVariablePrototype) { |
|
207 | + if ( ! $rootIsEmptyTag && ! $rootIsVariablePrototype) { |
|
208 | 208 | $this->writeLine(''); |
209 | - $rootEndTag = '</' . $rootName . '>'; |
|
209 | + $rootEndTag = '</'.$rootName.'>'; |
|
210 | 210 | $this->writeLine($rootEndTag, $depth); |
211 | 211 | } |
212 | 212 | } |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | private function writeLine($text, $indent = 0) |
220 | 220 | { |
221 | 221 | $indent = \strlen($text) + $indent; |
222 | - $format = '%' . $indent . 's'; |
|
223 | - $this->reference .= \sprintf($format, $text) . \PHP_EOL; |
|
222 | + $format = '%'.$indent.'s'; |
|
223 | + $this->reference .= \sprintf($format, $text).\PHP_EOL; |
|
224 | 224 | } |
225 | 225 | /** |
226 | 226 | * Renders the string conversion of the value. |
@@ -58,18 +58,18 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function isFresh() |
60 | 60 | { |
61 | - if (!\is_file($this->file)) { |
|
61 | + if ( ! \is_file($this->file)) { |
|
62 | 62 | return \false; |
63 | 63 | } |
64 | - if ($this->resourceCheckers instanceof \Traversable && !$this->resourceCheckers instanceof \Countable) { |
|
64 | + if ($this->resourceCheckers instanceof \Traversable && ! $this->resourceCheckers instanceof \Countable) { |
|
65 | 65 | $this->resourceCheckers = \iterator_to_array($this->resourceCheckers); |
66 | 66 | } |
67 | - if (!\count($this->resourceCheckers)) { |
|
67 | + if ( ! \count($this->resourceCheckers)) { |
|
68 | 68 | return \true; |
69 | 69 | // shortcut - if we don't have any checkers we don't need to bother with the meta file at all |
70 | 70 | } |
71 | 71 | $metadata = $this->getMetaFile(); |
72 | - if (!\is_file($metadata)) { |
|
72 | + if ( ! \is_file($metadata)) { |
|
73 | 73 | return \false; |
74 | 74 | } |
75 | 75 | $meta = $this->safelyUnserialize($metadata); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | foreach ($meta as $resource) { |
81 | 81 | /* @var ResourceInterface $resource */ |
82 | 82 | foreach ($this->resourceCheckers as $checker) { |
83 | - if (!$checker->supports($resource)) { |
|
83 | + if ( ! $checker->supports($resource)) { |
|
84 | 84 | continue; |
85 | 85 | // next checker |
86 | 86 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | private function getMetaFile() |
135 | 135 | { |
136 | - return $this->file . '.meta'; |
|
136 | + return $this->file.'.meta'; |
|
137 | 137 | } |
138 | 138 | private function safelyUnserialize($file) |
139 | 139 | { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $content = \file_get_contents($file); |
143 | 143 | $signalingException = new \UnexpectedValueException(); |
144 | 144 | $prevUnserializeHandler = \ini_set('unserialize_callback_func', ''); |
145 | - $prevErrorHandler = \set_error_handler(function ($type, $msg, $file, $line, $context = []) use(&$prevErrorHandler, $signalingException) { |
|
145 | + $prevErrorHandler = \set_error_handler(function($type, $msg, $file, $line, $context = []) use(&$prevErrorHandler, $signalingException) { |
|
146 | 146 | if (__FILE__ === $file) { |
147 | 147 | throw $signalingException; |
148 | 148 | } |
@@ -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); |
@@ -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() |
@@ -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; |
@@ -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)])) { |
@@ -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()) { |
@@ -44,7 +44,7 @@ |
||
44 | 44 | */ |
45 | 45 | public function supports($resource, $type = null) |
46 | 46 | { |
47 | - if (!\is_string($resource)) { |
|
47 | + if ( ! \is_string($resource)) { |
|
48 | 48 | return \false; |
49 | 49 | } |
50 | 50 | if (null === $type && 'ini' === \pathinfo($resource, \PATHINFO_EXTENSION)) { |