@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->parseImports($content, $path); |
| 58 | 58 | // parameters |
| 59 | 59 | if (isset($content['parameters'])) { |
| 60 | - if (!\is_array($content['parameters'])) { |
|
| 60 | + if ( ! \is_array($content['parameters'])) { |
|
| 61 | 61 | throw new InvalidArgumentException(\sprintf('The "parameters" key should contain an array in "%s". Check your YAML syntax.', $path)); |
| 62 | 62 | } |
| 63 | 63 | foreach ($content['parameters'] as $key => $value) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $this->loadFromExtensions($content); |
| 69 | 69 | // services |
| 70 | 70 | $this->anonymousServicesCount = 0; |
| 71 | - $this->anonymousServicesSuffix = '~' . ContainerBuilder::hash($path); |
|
| 71 | + $this->anonymousServicesSuffix = '~'.ContainerBuilder::hash($path); |
|
| 72 | 72 | $this->setCurrentDir(\dirname($path)); |
| 73 | 73 | try { |
| 74 | 74 | $this->parseDefinitions($content, $path); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function supports($resource, $type = null) |
| 83 | 83 | { |
| 84 | - if (!\is_string($resource)) { |
|
| 84 | + if ( ! \is_string($resource)) { |
|
| 85 | 85 | return \false; |
| 86 | 86 | } |
| 87 | 87 | if (null === $type && \in_array(\pathinfo($resource, \PATHINFO_EXTENSION), ['yaml', 'yml'], \true)) { |
@@ -96,18 +96,18 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | private function parseImports(array $content, $file) |
| 98 | 98 | { |
| 99 | - if (!isset($content['imports'])) { |
|
| 99 | + if ( ! isset($content['imports'])) { |
|
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | - if (!\is_array($content['imports'])) { |
|
| 102 | + if ( ! \is_array($content['imports'])) { |
|
| 103 | 103 | throw new InvalidArgumentException(\sprintf('The "imports" key should contain an array in "%s". Check your YAML syntax.', $file)); |
| 104 | 104 | } |
| 105 | 105 | $defaultDirectory = \dirname($file); |
| 106 | 106 | foreach ($content['imports'] as $import) { |
| 107 | - if (!\is_array($import)) { |
|
| 107 | + if ( ! \is_array($import)) { |
|
| 108 | 108 | $import = ['resource' => $import]; |
| 109 | 109 | } |
| 110 | - if (!isset($import['resource'])) { |
|
| 110 | + if ( ! isset($import['resource'])) { |
|
| 111 | 111 | throw new InvalidArgumentException(\sprintf('An import should provide a resource in "%s". Check your YAML syntax.', $file)); |
| 112 | 112 | } |
| 113 | 113 | $this->setCurrentDir($defaultDirectory); |
@@ -121,22 +121,22 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | private function parseDefinitions(array $content, $file) |
| 123 | 123 | { |
| 124 | - if (!isset($content['services'])) { |
|
| 124 | + if ( ! isset($content['services'])) { |
|
| 125 | 125 | return; |
| 126 | 126 | } |
| 127 | - if (!\is_array($content['services'])) { |
|
| 127 | + if ( ! \is_array($content['services'])) { |
|
| 128 | 128 | throw new InvalidArgumentException(\sprintf('The "services" key should contain an array in "%s". Check your YAML syntax.', $file)); |
| 129 | 129 | } |
| 130 | 130 | if (\array_key_exists('_instanceof', $content['services'])) { |
| 131 | 131 | $instanceof = $content['services']['_instanceof']; |
| 132 | 132 | unset($content['services']['_instanceof']); |
| 133 | - if (!\is_array($instanceof)) { |
|
| 133 | + if ( ! \is_array($instanceof)) { |
|
| 134 | 134 | throw new InvalidArgumentException(\sprintf('Service "_instanceof" key must be an array, "%s" given in "%s".', \gettype($instanceof), $file)); |
| 135 | 135 | } |
| 136 | 136 | $this->instanceof = []; |
| 137 | 137 | $this->isLoadingInstanceof = \true; |
| 138 | 138 | foreach ($instanceof as $id => $service) { |
| 139 | - if (!$service || !\is_array($service)) { |
|
| 139 | + if ( ! $service || ! \is_array($service)) { |
|
| 140 | 140 | throw new InvalidArgumentException(\sprintf('Type definition "%s" must be a non-empty array within "_instanceof" in "%s". Check your YAML syntax.', $id, $file)); |
| 141 | 141 | } |
| 142 | 142 | if (\is_string($service) && 0 === \strpos($service, '@')) { |
@@ -160,47 +160,47 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | private function parseDefaults(array &$content, $file) |
| 162 | 162 | { |
| 163 | - if (!\array_key_exists('_defaults', $content['services'])) { |
|
| 163 | + if ( ! \array_key_exists('_defaults', $content['services'])) { |
|
| 164 | 164 | return []; |
| 165 | 165 | } |
| 166 | 166 | $defaults = $content['services']['_defaults']; |
| 167 | 167 | unset($content['services']['_defaults']); |
| 168 | - if (!\is_array($defaults)) { |
|
| 168 | + if ( ! \is_array($defaults)) { |
|
| 169 | 169 | throw new InvalidArgumentException(\sprintf('Service "_defaults" key must be an array, "%s" given in "%s".', \gettype($defaults), $file)); |
| 170 | 170 | } |
| 171 | 171 | foreach ($defaults as $key => $default) { |
| 172 | - if (!isset(self::$defaultsKeywords[$key])) { |
|
| 172 | + if ( ! isset(self::$defaultsKeywords[$key])) { |
|
| 173 | 173 | throw new InvalidArgumentException(\sprintf('The configuration key "%s" cannot be used to define a default value in "%s". Allowed keys are "%s".', $key, $file, \implode('", "', self::$defaultsKeywords))); |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | if (isset($defaults['tags'])) { |
| 177 | - if (!\is_array($tags = $defaults['tags'])) { |
|
| 177 | + if ( ! \is_array($tags = $defaults['tags'])) { |
|
| 178 | 178 | throw new InvalidArgumentException(\sprintf('Parameter "tags" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file)); |
| 179 | 179 | } |
| 180 | 180 | foreach ($tags as $tag) { |
| 181 | - if (!\is_array($tag)) { |
|
| 181 | + if ( ! \is_array($tag)) { |
|
| 182 | 182 | $tag = ['name' => $tag]; |
| 183 | 183 | } |
| 184 | - if (!isset($tag['name'])) { |
|
| 184 | + if ( ! isset($tag['name'])) { |
|
| 185 | 185 | throw new InvalidArgumentException(\sprintf('A "tags" entry in "_defaults" is missing a "name" key in "%s".', $file)); |
| 186 | 186 | } |
| 187 | 187 | $name = $tag['name']; |
| 188 | 188 | unset($tag['name']); |
| 189 | - if (!\is_string($name) || '' === $name) { |
|
| 189 | + if ( ! \is_string($name) || '' === $name) { |
|
| 190 | 190 | throw new InvalidArgumentException(\sprintf('The tag name in "_defaults" must be a non-empty string in "%s".', $file)); |
| 191 | 191 | } |
| 192 | 192 | foreach ($tag as $attribute => $value) { |
| 193 | - if (!\is_scalar($value) && null !== $value) { |
|
| 193 | + if ( ! \is_scalar($value) && null !== $value) { |
|
| 194 | 194 | throw new InvalidArgumentException(\sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type in "%s". Check your YAML syntax.', $name, $attribute, $file)); |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | if (isset($defaults['bind'])) { |
| 200 | - if (!\is_array($defaults['bind'])) { |
|
| 200 | + if ( ! \is_array($defaults['bind'])) { |
|
| 201 | 201 | throw new InvalidArgumentException(\sprintf('Parameter "bind" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file)); |
| 202 | 202 | } |
| 203 | - $defaults['bind'] = \array_map(function ($v) { |
|
| 203 | + $defaults['bind'] = \array_map(function($v) { |
|
| 204 | 204 | return new BoundArgument($v); |
| 205 | 205 | }, $this->resolveServices($defaults['bind'], $file)); |
| 206 | 206 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | if (null === $service) { |
| 246 | 246 | $service = []; |
| 247 | 247 | } |
| 248 | - if (!\is_array($service)) { |
|
| 248 | + if ( ! \is_array($service)) { |
|
| 249 | 249 | throw new InvalidArgumentException(\sprintf('A service definition must be an array or a string starting with "@" but "%s" found for service "%s" in "%s". Check your YAML syntax.', \gettype($service), $id, $file)); |
| 250 | 250 | } |
| 251 | 251 | $this->checkDefinition($id, $service, $file); |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $alias->setPublic($defaults['public']); |
| 258 | 258 | } |
| 259 | 259 | foreach ($service as $key => $value) { |
| 260 | - if (!\in_array($key, ['alias', 'public'])) { |
|
| 260 | + if ( ! \in_array($key, ['alias', 'public'])) { |
|
| 261 | 261 | @\trigger_error(\sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias" and "public". The YamlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $key, $id, $file), \E_USER_DEPRECATED); |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | if ($this->isLoadingInstanceof) { |
| 267 | 267 | $definition = new ChildDefinition(''); |
| 268 | 268 | } elseif (isset($service['parent'])) { |
| 269 | - if (!empty($this->instanceof)) { |
|
| 269 | + if ( ! empty($this->instanceof)) { |
|
| 270 | 270 | 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.', $id)); |
| 271 | 271 | } |
| 272 | 272 | foreach ($defaults as $k => $v) { |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | if ('bind' === $k) { |
| 279 | 279 | throw new InvalidArgumentException(\sprintf('Attribute "bind" on service "%s" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file.', $id)); |
| 280 | 280 | } |
| 281 | - if (!isset($service[$k])) { |
|
| 281 | + if ( ! isset($service[$k])) { |
|
| 282 | 282 | 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, $id)); |
| 283 | 283 | } |
| 284 | 284 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $definition->setConfigurator($this->parseCallable($service['configurator'], 'configurator', $id, $file)); |
| 334 | 334 | } |
| 335 | 335 | if (isset($service['calls'])) { |
| 336 | - if (!\is_array($service['calls'])) { |
|
| 336 | + if ( ! \is_array($service['calls'])) { |
|
| 337 | 337 | throw new InvalidArgumentException(\sprintf('Parameter "calls" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); |
| 338 | 338 | } |
| 339 | 339 | foreach ($service['calls'] as $call) { |
@@ -344,33 +344,33 @@ discard block |
||
| 344 | 344 | $method = $call[0]; |
| 345 | 345 | $args = isset($call[1]) ? $this->resolveServices($call[1], $file) : []; |
| 346 | 346 | } |
| 347 | - if (!\is_array($args)) { |
|
| 347 | + if ( ! \is_array($args)) { |
|
| 348 | 348 | throw new InvalidArgumentException(\sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in "%s". Check your YAML syntax.', $method, $id, $file)); |
| 349 | 349 | } |
| 350 | 350 | $definition->addMethodCall($method, $args); |
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | $tags = isset($service['tags']) ? $service['tags'] : []; |
| 354 | - if (!\is_array($tags)) { |
|
| 354 | + if ( ! \is_array($tags)) { |
|
| 355 | 355 | throw new InvalidArgumentException(\sprintf('Parameter "tags" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); |
| 356 | 356 | } |
| 357 | 357 | if (isset($defaults['tags'])) { |
| 358 | 358 | $tags = \array_merge($tags, $defaults['tags']); |
| 359 | 359 | } |
| 360 | 360 | foreach ($tags as $tag) { |
| 361 | - if (!\is_array($tag)) { |
|
| 361 | + if ( ! \is_array($tag)) { |
|
| 362 | 362 | $tag = ['name' => $tag]; |
| 363 | 363 | } |
| 364 | - if (!isset($tag['name'])) { |
|
| 364 | + if ( ! isset($tag['name'])) { |
|
| 365 | 365 | throw new InvalidArgumentException(\sprintf('A "tags" entry is missing a "name" key for service "%s" in "%s".', $id, $file)); |
| 366 | 366 | } |
| 367 | 367 | $name = $tag['name']; |
| 368 | 368 | unset($tag['name']); |
| 369 | - if (!\is_string($name) || '' === $name) { |
|
| 369 | + if ( ! \is_string($name) || '' === $name) { |
|
| 370 | 370 | throw new InvalidArgumentException(\sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', $id, $file)); |
| 371 | 371 | } |
| 372 | 372 | foreach ($tag as $attribute => $value) { |
| 373 | - if (!\is_scalar($value) && null !== $value) { |
|
| 373 | + if ( ! \is_scalar($value) && null !== $value) { |
|
| 374 | 374 | throw new InvalidArgumentException(\sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in "%s". Check your YAML syntax.', $id, $name, $attribute, $file)); |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -391,11 +391,11 @@ discard block |
||
| 391 | 391 | if (\is_string($service['autowiring_types'])) { |
| 392 | 392 | $definition->addAutowiringType($service['autowiring_types']); |
| 393 | 393 | } else { |
| 394 | - if (!\is_array($service['autowiring_types'])) { |
|
| 394 | + if ( ! \is_array($service['autowiring_types'])) { |
|
| 395 | 395 | throw new InvalidArgumentException(\sprintf('Parameter "autowiring_types" must be a string or an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); |
| 396 | 396 | } |
| 397 | 397 | foreach ($service['autowiring_types'] as $autowiringType) { |
| 398 | - if (!\is_string($autowiringType)) { |
|
| 398 | + if ( ! \is_string($autowiringType)) { |
|
| 399 | 399 | throw new InvalidArgumentException(\sprintf('A "autowiring_types" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file)); |
| 400 | 400 | } |
| 401 | 401 | $definition->addAutowiringType($autowiringType); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | // deep clone, to avoid multiple process of the same instance in the passes |
| 407 | 407 | $bindings = isset($defaults['bind']) ? \unserialize(\serialize($defaults['bind'])) : []; |
| 408 | 408 | if (isset($service['bind'])) { |
| 409 | - if (!\is_array($service['bind'])) { |
|
| 409 | + if ( ! \is_array($service['bind'])) { |
|
| 410 | 410 | throw new InvalidArgumentException(\sprintf('Parameter "bind" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); |
| 411 | 411 | } |
| 412 | 412 | $bindings = \array_merge($bindings, $this->resolveServices($service['bind'], $file)); |
@@ -414,17 +414,17 @@ discard block |
||
| 414 | 414 | $definition->setBindings($bindings); |
| 415 | 415 | } |
| 416 | 416 | if (isset($service['autoconfigure'])) { |
| 417 | - if (!$definition instanceof ChildDefinition) { |
|
| 417 | + if ( ! $definition instanceof ChildDefinition) { |
|
| 418 | 418 | $definition->setAutoconfigured($service['autoconfigure']); |
| 419 | 419 | } elseif ($service['autoconfigure']) { |
| 420 | 420 | throw new InvalidArgumentException(\sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try setting "autoconfigure: false" for the service.', $id)); |
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | - if (\array_key_exists('namespace', $service) && !\array_key_exists('resource', $service)) { |
|
| 423 | + if (\array_key_exists('namespace', $service) && ! \array_key_exists('resource', $service)) { |
|
| 424 | 424 | throw new InvalidArgumentException(\sprintf('A "resource" attribute must be set when the "namespace" attribute is set for service "%s" in "%s". Check your YAML syntax.', $id, $file)); |
| 425 | 425 | } |
| 426 | 426 | if (\array_key_exists('resource', $service)) { |
| 427 | - if (!\is_string($service['resource'])) { |
|
| 427 | + if ( ! \is_string($service['resource'])) { |
|
| 428 | 428 | throw new InvalidArgumentException(\sprintf('A "resource" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file)); |
| 429 | 429 | } |
| 430 | 430 | $exclude = isset($service['exclude']) ? $service['exclude'] : null; |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | } |
| 455 | 455 | if (\false !== \strpos($callable, ':') && \false === \strpos($callable, '::')) { |
| 456 | 456 | $parts = \explode(':', $callable); |
| 457 | - return [$this->resolveServices('@' . $parts[0], $file), $parts[1]]; |
|
| 457 | + return [$this->resolveServices('@'.$parts[0], $file), $parts[1]]; |
|
| 458 | 458 | } |
| 459 | 459 | return $callable; |
| 460 | 460 | } |
@@ -480,26 +480,26 @@ discard block |
||
| 480 | 480 | */ |
| 481 | 481 | protected function loadFile($file) |
| 482 | 482 | { |
| 483 | - if (!\class_exists('Wordlift\\Modules\\Common\\Symfony\\Component\\Yaml\\Parser')) { |
|
| 483 | + if ( ! \class_exists('Wordlift\\Modules\\Common\\Symfony\\Component\\Yaml\\Parser')) { |
|
| 484 | 484 | throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.'); |
| 485 | 485 | } |
| 486 | - if (!\stream_is_local($file)) { |
|
| 486 | + if ( ! \stream_is_local($file)) { |
|
| 487 | 487 | throw new InvalidArgumentException(\sprintf('This is not a local file "%s".', $file)); |
| 488 | 488 | } |
| 489 | - if (!\file_exists($file)) { |
|
| 489 | + if ( ! \file_exists($file)) { |
|
| 490 | 490 | throw new InvalidArgumentException(\sprintf('The file "%s" does not exist.', $file)); |
| 491 | 491 | } |
| 492 | 492 | if (null === $this->yamlParser) { |
| 493 | 493 | $this->yamlParser = new YamlParser(); |
| 494 | 494 | } |
| 495 | - $prevErrorHandler = \set_error_handler(function ($level, $message, $script, $line) use($file, &$prevErrorHandler) { |
|
| 496 | - $message = \E_USER_DEPRECATED === $level ? \preg_replace('/ on line \\d+/', ' in "' . $file . '"$0', $message) : $message; |
|
| 495 | + $prevErrorHandler = \set_error_handler(function($level, $message, $script, $line) use($file, &$prevErrorHandler) { |
|
| 496 | + $message = \E_USER_DEPRECATED === $level ? \preg_replace('/ on line \\d+/', ' in "'.$file.'"$0', $message) : $message; |
|
| 497 | 497 | return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : \false; |
| 498 | 498 | }); |
| 499 | 499 | try { |
| 500 | 500 | $configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS); |
| 501 | 501 | } catch (ParseException $e) { |
| 502 | - throw new InvalidArgumentException(\sprintf('The file "%s" does not contain valid YAML: ', $file) . $e->getMessage(), 0, $e); |
|
| 502 | + throw new InvalidArgumentException(\sprintf('The file "%s" does not contain valid YAML: ', $file).$e->getMessage(), 0, $e); |
|
| 503 | 503 | } finally { |
| 504 | 504 | \restore_error_handler(); |
| 505 | 505 | } |
@@ -520,15 +520,15 @@ discard block |
||
| 520 | 520 | if (null === $content) { |
| 521 | 521 | return $content; |
| 522 | 522 | } |
| 523 | - if (!\is_array($content)) { |
|
| 523 | + if ( ! \is_array($content)) { |
|
| 524 | 524 | throw new InvalidArgumentException(\sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file)); |
| 525 | 525 | } |
| 526 | 526 | foreach ($content as $namespace => $data) { |
| 527 | 527 | if (\in_array($namespace, ['imports', 'parameters', 'services'])) { |
| 528 | 528 | continue; |
| 529 | 529 | } |
| 530 | - if (!$this->container->hasExtension($namespace)) { |
|
| 531 | - $extensionNamespaces = \array_filter(\array_map(function ($ext) { |
|
| 530 | + if ( ! $this->container->hasExtension($namespace)) { |
|
| 531 | + $extensionNamespaces = \array_filter(\array_map(function($ext) { |
|
| 532 | 532 | return $ext->getAlias(); |
| 533 | 533 | }, $this->container->getExtensions())); |
| 534 | 534 | throw new InvalidArgumentException(\sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $file, $namespace, $extensionNamespaces ? \sprintf('"%s"', \implode('", "', $extensionNamespaces)) : 'none')); |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | if ($value instanceof TaggedValue) { |
| 551 | 551 | $argument = $value->getValue(); |
| 552 | 552 | if ('iterator' === $value->getTag()) { |
| 553 | - if (!\is_array($argument)) { |
|
| 553 | + if ( ! \is_array($argument)) { |
|
| 554 | 554 | throw new InvalidArgumentException(\sprintf('"!iterator" tag only accepts sequences in "%s".', $file)); |
| 555 | 555 | } |
| 556 | 556 | $argument = $this->resolveServices($argument, $file, $isParameter); |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | if ('tagged' === $value->getTag()) { |
| 564 | - if (!\is_string($argument) || !$argument) { |
|
| 564 | + if ( ! \is_string($argument) || ! $argument) { |
|
| 565 | 565 | throw new InvalidArgumentException(\sprintf('"!tagged" tag only accepts non empty string in "%s".', $file)); |
| 566 | 566 | } |
| 567 | 567 | return new TaggedIteratorArgument($argument); |
@@ -574,9 +574,9 @@ discard block |
||
| 574 | 574 | $this->isLoadingInstanceof = \false; |
| 575 | 575 | $instanceof = $this->instanceof; |
| 576 | 576 | $this->instanceof = []; |
| 577 | - $id = \sprintf('%d_%s', ++$this->anonymousServicesCount, \preg_replace('/^.*\\\\/', '', isset($argument['class']) ? $argument['class'] : '') . $this->anonymousServicesSuffix); |
|
| 577 | + $id = \sprintf('%d_%s', ++$this->anonymousServicesCount, \preg_replace('/^.*\\\\/', '', isset($argument['class']) ? $argument['class'] : '').$this->anonymousServicesSuffix); |
|
| 578 | 578 | $this->parseDefinition($id, $argument, $file, []); |
| 579 | - if (!$this->container->hasDefinition($id)) { |
|
| 579 | + if ( ! $this->container->hasDefinition($id)) { |
|
| 580 | 580 | throw new InvalidArgumentException(\sprintf('Creating an alias using the tag "!service" is not allowed in "%s".', $file)); |
| 581 | 581 | } |
| 582 | 582 | $this->container->getDefinition($id)->setPublic(\false); |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | $value[$k] = $this->resolveServices($v, $file, $isParameter); |
| 592 | 592 | } |
| 593 | 593 | } elseif (\is_string($value) && 0 === \strpos($value, '@=')) { |
| 594 | - if (!\class_exists(Expression::class)) { |
|
| 594 | + if ( ! \class_exists(Expression::class)) { |
|
| 595 | 595 | throw new \LogicException(\sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".')); |
| 596 | 596 | } |
| 597 | 597 | return new Expression(\substr($value, 2)); |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | if (\in_array($namespace, ['imports', 'parameters', 'services'])) { |
| 629 | 629 | continue; |
| 630 | 630 | } |
| 631 | - if (!\is_array($values) && null !== $values) { |
|
| 631 | + if ( ! \is_array($values) && null !== $values) { |
|
| 632 | 632 | $values = []; |
| 633 | 633 | } |
| 634 | 634 | $this->container->loadFromExtension($namespace, $values); |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | $keywords = self::$serviceKeywords; |
| 652 | 652 | } |
| 653 | 653 | foreach ($definition as $key => $value) { |
| 654 | - if (!isset($keywords[$key])) { |
|
| 654 | + if ( ! isset($keywords[$key])) { |
|
| 655 | 655 | if ($throw) { |
| 656 | 656 | throw new InvalidArgumentException(\sprintf('The configuration key "%s" is unsupported for definition "%s" in "%s". Allowed configuration keys are "%s".', $key, $id, $file, \implode('", "', $keywords))); |
| 657 | 657 | } |
@@ -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 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->setCurrentDir(\dirname($path)); |
| 34 | 34 | $this->container->fileExists($path); |
| 35 | 35 | // the closure forbids access to the private scope in the included file |
| 36 | - $load = \Closure::bind(function ($path) use($container, $loader, $resource, $type) { |
|
| 36 | + $load = \Closure::bind(function($path) use($container, $loader, $resource, $type) { |
|
| 37 | 37 | return include $path; |
| 38 | 38 | }, $this, ProtectedPhpFileLoader::class); |
| 39 | 39 | $callback = $load($path); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function supports($resource, $type = null) |
| 48 | 48 | { |
| 49 | - if (!\is_string($resource)) { |
|
| 49 | + if ( ! \is_string($resource)) { |
|
| 50 | 50 | return \false; |
| 51 | 51 | } |
| 52 | 52 | if (null === $type && 'php' === \pathinfo($resource, \PATHINFO_EXTENSION)) { |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | { |
| 53 | 53 | parent::__destruct(); |
| 54 | 54 | $this->container->removeBindings($this->id); |
| 55 | - if (!$this->definition instanceof ChildDefinition) { |
|
| 55 | + if ( ! $this->definition instanceof ChildDefinition) { |
|
| 56 | 56 | $this->container->setDefinition($this->id, $this->definition->setInstanceofConditionals($this->instanceof)); |
| 57 | 57 | } else { |
| 58 | 58 | $this->container->setDefinition($this->id, $this->definition); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->defaults = new Definition(); |
| 34 | 34 | $this->container = $container; |
| 35 | 35 | $this->loader = $loader; |
| 36 | - $this->instanceof =& $instanceof; |
|
| 36 | + $this->instanceof = & $instanceof; |
|
| 37 | 37 | $instanceof = []; |
| 38 | 38 | } |
| 39 | 39 | /** |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | public final function set($id, $class = null) |
| 69 | 69 | { |
| 70 | 70 | $defaults = $this->defaults; |
| 71 | - $allowParent = !$defaults->getChanges() && empty($this->instanceof); |
|
| 71 | + $allowParent = ! $defaults->getChanges() && empty($this->instanceof); |
|
| 72 | 72 | $definition = new Definition(); |
| 73 | - if (!$defaults->isPublic() || !$defaults->isPrivate()) { |
|
| 74 | - $definition->setPublic($defaults->isPublic() && !$defaults->isPrivate()); |
|
| 73 | + if ( ! $defaults->isPublic() || ! $defaults->isPrivate()) { |
|
| 74 | + $definition->setPublic($defaults->isPublic() && ! $defaults->isPrivate()); |
|
| 75 | 75 | } |
| 76 | 76 | $definition->setAutowired($defaults->isAutowired()); |
| 77 | 77 | $definition->setAutoconfigured($defaults->isAutoconfigured()); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $ref = static::processValue($referencedId, \true); |
| 95 | 95 | $alias = new Alias((string) $ref); |
| 96 | - if (!$this->defaults->isPublic() || !$this->defaults->isPrivate()) { |
|
| 96 | + if ( ! $this->defaults->isPublic() || ! $this->defaults->isPrivate()) { |
|
| 97 | 97 | $alias->setPublic($this->defaults->isPublic()); |
| 98 | 98 | } |
| 99 | 99 | $this->container->setAlias($id, $alias); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public final function load($namespace, $resource) |
| 111 | 111 | { |
| 112 | - $allowParent = !$this->defaults->getChanges() && empty($this->instanceof); |
|
| 112 | + $allowParent = ! $this->defaults->getChanges() && empty($this->instanceof); |
|
| 113 | 113 | return new PrototypeConfigurator($this, $this->loader, $this->defaults, $namespace, $resource, $allowParent); |
| 114 | 114 | } |
| 115 | 115 | /** |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public final function get($id) |
| 125 | 125 | { |
| 126 | - $allowParent = !$this->defaults->getChanges() && empty($this->instanceof); |
|
| 126 | + $allowParent = ! $this->defaults->getChanges() && empty($this->instanceof); |
|
| 127 | 127 | $definition = $this->container->getDefinition($id); |
| 128 | 128 | return new ServiceConfigurator($this->container, $definition->getInstanceofConditionals(), $allowParent, $this, $definition, $id, []); |
| 129 | 129 | } |
@@ -32,14 +32,14 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $this->container = $container; |
| 34 | 34 | $this->loader = $loader; |
| 35 | - $this->instanceof =& $instanceof; |
|
| 35 | + $this->instanceof = & $instanceof; |
|
| 36 | 36 | $this->path = $path; |
| 37 | 37 | $this->file = $file; |
| 38 | 38 | } |
| 39 | 39 | public final function extension($namespace, array $config) |
| 40 | 40 | { |
| 41 | - if (!$this->container->hasExtension($namespace)) { |
|
| 42 | - $extensions = \array_filter(\array_map(function ($ext) { |
|
| 41 | + if ( ! $this->container->hasExtension($namespace)) { |
|
| 42 | + $extensions = \array_filter(\array_map(function($ext) { |
|
| 43 | 43 | return $ext->getAlias(); |
| 44 | 44 | }, $this->container->getExtensions())); |
| 45 | 45 | throw new InvalidArgumentException(\sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $this->file, $namespace, $extensions ? \implode('", "', $extensions) : 'none')); |
@@ -35,11 +35,11 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public final function tag($name, array $attributes = []) |
| 37 | 37 | { |
| 38 | - if (!\is_string($name) || '' === $name) { |
|
| 38 | + if ( ! \is_string($name) || '' === $name) { |
|
| 39 | 39 | throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.'); |
| 40 | 40 | } |
| 41 | 41 | foreach ($attributes as $attribute => $value) { |
| 42 | - if (!\is_scalar($value) && null !== $value) { |
|
| 42 | + if ( ! \is_scalar($value) && null !== $value) { |
|
| 43 | 43 | throw new InvalidArgumentException(\sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type.', $name, $attribute)); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | public function __construct(ServicesConfigurator $parent, PhpFileLoader $loader, Definition $defaults, $namespace, $resource, $allowParent) |
| 41 | 41 | { |
| 42 | 42 | $definition = new Definition(); |
| 43 | - if (!$defaults->isPublic() || !$defaults->isPrivate()) { |
|
| 43 | + if ( ! $defaults->isPublic() || ! $defaults->isPrivate()) { |
|
| 44 | 44 | $definition->setPublic($defaults->isPublic()); |
| 45 | 45 | } |
| 46 | 46 | $definition->setAutowired($defaults->isAutowired()); |
@@ -23,11 +23,11 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public final function tag($name, array $attributes = []) |
| 25 | 25 | { |
| 26 | - if (!\is_string($name) || '' === $name) { |
|
| 26 | + if ( ! \is_string($name) || '' === $name) { |
|
| 27 | 27 | throw new InvalidArgumentException(\sprintf('The tag name for service "%s" must be a non-empty string.', $this->id)); |
| 28 | 28 | } |
| 29 | 29 | foreach ($attributes as $attribute => $value) { |
| 30 | - if (!\is_scalar($value) && null !== $value) { |
|
| 30 | + if ( ! \is_scalar($value) && null !== $value) { |
|
| 31 | 31 | throw new InvalidArgumentException(\sprintf('A tag attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $this->id, $name, $attribute)); |
| 32 | 32 | } |
| 33 | 33 | } |