@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | protected function processValue($value, $isRoot = \false) |
| 27 | 27 | { |
| 28 | - if (!$value instanceof Definition || $value->isAbstract() || $value->isSynthetic() || !$value->hasTag('container.service_subscriber')) { |
|
| 28 | + if ( ! $value instanceof Definition || $value->isAbstract() || $value->isSynthetic() || ! $value->hasTag('container.service_subscriber')) { |
|
| 29 | 29 | return parent::processValue($value, $isRoot); |
| 30 | 30 | } |
| 31 | 31 | $serviceMap = []; |
| 32 | 32 | $autowire = $value->isAutowired(); |
| 33 | 33 | foreach ($value->getTag('container.service_subscriber') as $attributes) { |
| 34 | - if (!$attributes) { |
|
| 34 | + if ( ! $attributes) { |
|
| 35 | 35 | $autowire = \true; |
| 36 | 36 | continue; |
| 37 | 37 | } |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | if ([] !== \array_diff(\array_keys($attributes), ['id', 'key'])) { |
| 40 | 40 | throw new InvalidArgumentException(\sprintf('The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "%s" given for service "%s".', \implode('", "', \array_keys($attributes)), $this->currentId)); |
| 41 | 41 | } |
| 42 | - if (!\array_key_exists('id', $attributes)) { |
|
| 42 | + if ( ! \array_key_exists('id', $attributes)) { |
|
| 43 | 43 | throw new InvalidArgumentException(\sprintf('Missing "id" attribute on "container.service_subscriber" tag with key="%s" for service "%s".', $attributes['key'], $this->currentId)); |
| 44 | 44 | } |
| 45 | - if (!\array_key_exists('key', $attributes)) { |
|
| 45 | + if ( ! \array_key_exists('key', $attributes)) { |
|
| 46 | 46 | $attributes['key'] = $attributes['id']; |
| 47 | 47 | } |
| 48 | 48 | if (isset($serviceMap[$attributes['key']])) { |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | $serviceMap[$attributes['key']] = new Reference($attributes['id']); |
| 52 | 52 | } |
| 53 | 53 | $class = $value->getClass(); |
| 54 | - if (!($r = $this->container->getReflectionClass($class))) { |
|
| 54 | + if ( ! ($r = $this->container->getReflectionClass($class))) { |
|
| 55 | 55 | throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $this->currentId)); |
| 56 | 56 | } |
| 57 | - if (!$r->isSubclassOf(ServiceSubscriberInterface::class)) { |
|
| 57 | + if ( ! $r->isSubclassOf(ServiceSubscriberInterface::class)) { |
|
| 58 | 58 | throw new InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $this->currentId, ServiceSubscriberInterface::class)); |
| 59 | 59 | } |
| 60 | 60 | $class = $r->name; |
| 61 | 61 | $subscriberMap = []; |
| 62 | 62 | $declaringClass = (new \ReflectionMethod($class, 'getSubscribedServices'))->class; |
| 63 | 63 | foreach ($class::getSubscribedServices() as $key => $type) { |
| 64 | - if (!\is_string($type) || !\preg_match('/^\\??[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $type)) { |
|
| 64 | + if ( ! \is_string($type) || ! \preg_match('/^\\??[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+(?:\\\\[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*+)*+$/', $type)) { |
|
| 65 | 65 | throw new InvalidArgumentException(\sprintf('"%s::getSubscribedServices()" must return valid PHP types for service "%s" key "%s", "%s" returned.', $class, $this->currentId, $key, \is_string($type) ? $type : \gettype($type))); |
| 66 | 66 | } |
| 67 | 67 | if ($optionalBehavior = '?' === $type[0]) { |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | if (\is_int($key)) { |
| 72 | 72 | $key = $type; |
| 73 | 73 | } |
| 74 | - if (!isset($serviceMap[$key])) { |
|
| 75 | - if (!$autowire) { |
|
| 74 | + if ( ! isset($serviceMap[$key])) { |
|
| 75 | + if ( ! $autowire) { |
|
| 76 | 76 | throw new InvalidArgumentException(\sprintf('Service "%s" misses a "container.service_subscriber" tag with "key"/"id" attributes corresponding to entry "%s" as returned by "%s::getSubscribedServices()".', $this->currentId, $key, $class)); |
| 77 | 77 | } |
| 78 | 78 | $serviceMap[$key] = new Reference($type); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | protected function processValue($value, $isRoot = \false) |
| 26 | 26 | { |
| 27 | - if (!$value instanceof TaggedIteratorArgument) { |
|
| 27 | + if ( ! $value instanceof TaggedIteratorArgument) { |
|
| 28 | 28 | return parent::processValue($value, $isRoot); |
| 29 | 29 | } |
| 30 | 30 | $value->setValues($this->findAndSortTaggedServices($value->getTag(), $this->container)); |
@@ -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. |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | foreach ($container->getExtensions() as $name => $extension) { |
| 44 | - if (!($config = $container->getExtensionConfig($name))) { |
|
| 44 | + if ( ! ($config = $container->getExtensionConfig($name))) { |
|
| 45 | 45 | // this extension was not called |
| 46 | 46 | continue; |
| 47 | 47 | } |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | public function freezeAfterProcessing(Extension $extension, ContainerBuilder $container) |
| 94 | 94 | { |
| 95 | - if (!($config = $extension->getProcessedConfigs())) { |
|
| 95 | + if ( ! ($config = $extension->getProcessedConfigs())) { |
|
| 96 | 96 | // Extension::processConfiguration() wasn't called, we cannot know how configs were merged |
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | $this->processedEnvPlaceholders = []; |
| 100 | 100 | // serialize config and container to catch env vars nested in object graphs |
| 101 | - $config = \serialize($config) . \serialize($container->getDefinitions()) . \serialize($container->getAliases()) . \serialize($container->getParameterBag()->all()); |
|
| 101 | + $config = \serialize($config).\serialize($container->getDefinitions()).\serialize($container->getAliases()).\serialize($container->getParameterBag()->all()); |
|
| 102 | 102 | foreach (parent::getEnvPlaceholders() as $env => $placeholders) { |
| 103 | 103 | foreach ($placeholders as $placeholder) { |
| 104 | 104 | if (\false !== \stripos($config, $placeholder)) { |
@@ -155,12 +155,12 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs = null) |
| 157 | 157 | { |
| 158 | - if (\true !== $format || !\is_string($value)) { |
|
| 158 | + if (\true !== $format || ! \is_string($value)) { |
|
| 159 | 159 | return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); |
| 160 | 160 | } |
| 161 | 161 | $bag = $this->getParameterBag(); |
| 162 | 162 | $value = $bag->resolveValue($value); |
| 163 | - if (!$bag instanceof EnvPlaceholderParameterBag) { |
|
| 163 | + if ( ! $bag instanceof EnvPlaceholderParameterBag) { |
|
| 164 | 164 | return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); |
| 165 | 165 | } |
| 166 | 166 | foreach ($bag->getEnvPlaceholders() as $env => $placeholders) { |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | if ($value instanceof Reference && $this->serviceLocator && ContainerInterface::class === $this->container->normalizeId($value)) { |
| 27 | 27 | return new Reference($this->serviceLocator); |
| 28 | 28 | } |
| 29 | - if (!$value instanceof Definition) { |
|
| 29 | + if ( ! $value instanceof Definition) { |
|
| 30 | 30 | return parent::processValue($value, $isRoot); |
| 31 | 31 | } |
| 32 | 32 | $serviceLocator = $this->serviceLocator; |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | protected function processValue($value, $isRoot = \false) |
| 26 | 26 | { |
| 27 | - if (!$value instanceof Definition || empty($value->getErrors())) { |
|
| 27 | + if ( ! $value instanceof Definition || empty($value->getErrors())) { |
|
| 28 | 28 | return parent::processValue($value, $isRoot); |
| 29 | 29 | } |
| 30 | 30 | // only show the first error so the user can focus on it |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public static function createResourceForClass(\ReflectionClass $reflectionClass) |
| 79 | 79 | { |
| 80 | - @\trigger_error('The ' . __METHOD__ . '() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', \E_USER_DEPRECATED); |
|
| 80 | + @\trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', \E_USER_DEPRECATED); |
|
| 81 | 81 | $metadata = []; |
| 82 | 82 | foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { |
| 83 | - if (!$reflectionMethod->isStatic()) { |
|
| 83 | + if ( ! $reflectionMethod->isStatic()) { |
|
| 84 | 84 | $metadata[$reflectionMethod->name] = self::getResourceMetadataForMethod($reflectionMethod); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | $this->container->log($this, $this->createTypeNotFoundMessage($value, 'it')); |
| 112 | 112 | } |
| 113 | 113 | $value = parent::processValue($value, $isRoot); |
| 114 | - if (!$value instanceof Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) { |
|
| 114 | + if ( ! $value instanceof Definition || ! $value->isAutowired() || $value->isAbstract() || ! $value->getClass()) { |
|
| 115 | 115 | return $value; |
| 116 | 116 | } |
| 117 | - if (!($reflectionClass = $this->container->getReflectionClass($value->getClass(), \false))) { |
|
| 117 | + if ( ! ($reflectionClass = $this->container->getReflectionClass($value->getClass(), \false))) { |
|
| 118 | 118 | $this->container->log($this, \sprintf('Skipping service "%s": Class or interface "%s" cannot be loaded.', $this->currentId, $value->getClass())); |
| 119 | 119 | return $value; |
| 120 | 120 | } |
@@ -186,12 +186,12 @@ discard block |
||
| 186 | 186 | continue; |
| 187 | 187 | } |
| 188 | 188 | $type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, \true); |
| 189 | - if (!$type) { |
|
| 189 | + if ( ! $type) { |
|
| 190 | 190 | if (isset($arguments[$index])) { |
| 191 | 191 | continue; |
| 192 | 192 | } |
| 193 | 193 | // no default value? Then fail |
| 194 | - if (!$parameter->isDefaultValueAvailable()) { |
|
| 194 | + if ( ! $parameter->isDefaultValueAvailable()) { |
|
| 195 | 195 | // For core classes, isDefaultValueAvailable() can |
| 196 | 196 | // be false when isOptional() returns true. If the |
| 197 | 197 | // argument *is* optional, allow it to be missing |
@@ -200,27 +200,27 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | $type = ProxyHelper::getTypeHint($reflectionMethod, $parameter, \false); |
| 202 | 202 | $type = $type ? \sprintf('is type-hinted "%s"', $type) : 'has no type-hint'; |
| 203 | - throw new AutowiringFailedException($this->currentId, \sprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.', $this->currentId, $parameter->name, $class !== $this->currentId ? $class . '::' . $method : $method, $type)); |
|
| 203 | + throw new AutowiringFailedException($this->currentId, \sprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.', $this->currentId, $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method, $type)); |
|
| 204 | 204 | } |
| 205 | 205 | // specifically pass the default value |
| 206 | 206 | $arguments[$index] = $parameter->getDefaultValue(); |
| 207 | 207 | continue; |
| 208 | 208 | } |
| 209 | - if (!($value = $this->getAutowiredReference($ref = new TypedReference($type, $type, !$parameter->isOptional() ? $class : ''), 'for ' . \sprintf('argument "$%s" of method "%s()"', $parameter->name, $class . '::' . $method)))) { |
|
| 210 | - $failureMessage = $this->createTypeNotFoundMessage($ref, \sprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class . '::' . $method : $method)); |
|
| 209 | + if ( ! ($value = $this->getAutowiredReference($ref = new TypedReference($type, $type, ! $parameter->isOptional() ? $class : ''), 'for '.\sprintf('argument "$%s" of method "%s()"', $parameter->name, $class.'::'.$method)))) { |
|
| 210 | + $failureMessage = $this->createTypeNotFoundMessage($ref, \sprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method)); |
|
| 211 | 211 | if ($parameter->isDefaultValueAvailable()) { |
| 212 | 212 | $value = $parameter->getDefaultValue(); |
| 213 | - } elseif (!$parameter->allowsNull()) { |
|
| 213 | + } elseif ( ! $parameter->allowsNull()) { |
|
| 214 | 214 | throw new AutowiringFailedException($this->currentId, $failureMessage); |
| 215 | 215 | } |
| 216 | 216 | $this->container->log($this, $failureMessage); |
| 217 | 217 | } |
| 218 | 218 | $arguments[$index] = $value; |
| 219 | 219 | } |
| 220 | - if ($parameters && !isset($arguments[++$index])) { |
|
| 220 | + if ($parameters && ! isset($arguments[++$index])) { |
|
| 221 | 221 | while (0 <= --$index) { |
| 222 | 222 | $parameter = $parameters[$index]; |
| 223 | - if (!$parameter->isDefaultValueAvailable() || $parameter->getDefaultValue() !== $arguments[$index]) { |
|
| 223 | + if ( ! $parameter->isDefaultValueAvailable() || $parameter->getDefaultValue() !== $arguments[$index]) { |
|
| 224 | 224 | break; |
| 225 | 225 | } |
| 226 | 226 | unset($arguments[$index]); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | { |
| 239 | 239 | $this->lastFailure = null; |
| 240 | 240 | $type = $reference->getType(); |
| 241 | - if ($type !== $this->container->normalizeId($reference) || $this->container->has($type) && !$this->container->findDefinition($type)->isAbstract()) { |
|
| 241 | + if ($type !== $this->container->normalizeId($reference) || $this->container->has($type) && ! $this->container->findDefinition($type)->isAbstract()) { |
|
| 242 | 242 | return $reference; |
| 243 | 243 | } |
| 244 | 244 | if (null === $this->types) { |
@@ -247,23 +247,23 @@ discard block |
||
| 247 | 247 | if (isset($this->definedTypes[$type])) { |
| 248 | 248 | return new TypedReference($this->types[$type], $type); |
| 249 | 249 | } |
| 250 | - if (!$this->strictMode && isset($this->types[$type])) { |
|
| 250 | + if ( ! $this->strictMode && isset($this->types[$type])) { |
|
| 251 | 251 | $message = 'Autowiring services based on the types they implement is deprecated since Symfony 3.3 and won\'t be supported in version 4.0.'; |
| 252 | 252 | if ($aliasSuggestion = $this->getAliasesSuggestionForType($type = $reference->getType(), $deprecationMessage)) { |
| 253 | - $message .= ' ' . $aliasSuggestion; |
|
| 253 | + $message .= ' '.$aliasSuggestion; |
|
| 254 | 254 | } else { |
| 255 | 255 | $message .= \sprintf(' You should %s the "%s" service to "%s" instead.', isset($this->types[$this->types[$type]]) ? 'alias' : 'rename (or alias)', $this->types[$type], $type); |
| 256 | 256 | } |
| 257 | 257 | @\trigger_error($message, \E_USER_DEPRECATED); |
| 258 | 258 | return new TypedReference($this->types[$type], $type); |
| 259 | 259 | } |
| 260 | - if (!$reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) { |
|
| 260 | + if ( ! $reference->canBeAutoregistered() || isset($this->types[$type]) || isset($this->ambiguousServiceTypes[$type])) { |
|
| 261 | 261 | return null; |
| 262 | 262 | } |
| 263 | 263 | if (isset($this->autowired[$type])) { |
| 264 | 264 | return $this->autowired[$type] ? new TypedReference($this->autowired[$type], $type) : null; |
| 265 | 265 | } |
| 266 | - if (!$this->strictMode) { |
|
| 266 | + if ( ! $this->strictMode) { |
|
| 267 | 267 | return $this->createAutowiredDefinition($type); |
| 268 | 268 | } |
| 269 | 269 | return null; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | private function populateAvailableTypes($onlyAutowiringTypes = \false) |
| 275 | 275 | { |
| 276 | 276 | $this->types = []; |
| 277 | - if (!$onlyAutowiringTypes) { |
|
| 277 | + if ( ! $onlyAutowiringTypes) { |
|
| 278 | 278 | $this->ambiguousServiceTypes = []; |
| 279 | 279 | } |
| 280 | 280 | foreach ($this->container->getDefinitions() as $id => $definition) { |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | if ($onlyAutowiringTypes) { |
| 301 | 301 | return; |
| 302 | 302 | } |
| 303 | - if (\preg_match('/^\\d+_[^~]++~[._a-zA-Z\\d]{7}$/', $id) || $definition->isDeprecated() || !($reflectionClass = $this->container->getReflectionClass($definition->getClass(), \false))) { |
|
| 303 | + if (\preg_match('/^\\d+_[^~]++~[._a-zA-Z\\d]{7}$/', $id) || $definition->isDeprecated() || ! ($reflectionClass = $this->container->getReflectionClass($definition->getClass(), \false))) { |
|
| 304 | 304 | return; |
| 305 | 305 | } |
| 306 | 306 | foreach ($reflectionClass->getInterfaces() as $reflectionInterface) { |
@@ -327,12 +327,12 @@ discard block |
||
| 327 | 327 | return; |
| 328 | 328 | } |
| 329 | 329 | // check to make sure the type doesn't match multiple services |
| 330 | - if (!isset($this->types[$type]) || $this->types[$type] === $id) { |
|
| 330 | + if ( ! isset($this->types[$type]) || $this->types[$type] === $id) { |
|
| 331 | 331 | $this->types[$type] = $id; |
| 332 | 332 | return; |
| 333 | 333 | } |
| 334 | 334 | // keep an array of all services matching this type |
| 335 | - if (!isset($this->ambiguousServiceTypes[$type])) { |
|
| 335 | + if ( ! isset($this->ambiguousServiceTypes[$type])) { |
|
| 336 | 336 | $this->ambiguousServiceTypes[$type] = [$this->types[$type]]; |
| 337 | 337 | unset($this->types[$type]); |
| 338 | 338 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | private function createAutowiredDefinition($type) |
| 349 | 349 | { |
| 350 | - if (!($typeHint = $this->container->getReflectionClass($type, \false)) || !$typeHint->isInstantiable()) { |
|
| 350 | + if ( ! ($typeHint = $this->container->getReflectionClass($type, \false)) || ! $typeHint->isInstantiable()) { |
|
| 351 | 351 | return null; |
| 352 | 352 | } |
| 353 | 353 | $currentId = $this->currentId; |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | } finally { |
| 386 | 386 | $this->container->setResourceTracking($trackResources); |
| 387 | 387 | } |
| 388 | - if (!$r) { |
|
| 388 | + if ( ! $r) { |
|
| 389 | 389 | // either $type does not exist or a parent class does not exist |
| 390 | 390 | try { |
| 391 | 391 | $resource = new ClassExistenceResource($type, \false); |
@@ -399,13 +399,13 @@ discard block |
||
| 399 | 399 | } else { |
| 400 | 400 | $message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists'; |
| 401 | 401 | $message = \sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives); |
| 402 | - if ($r->isInterface() && !$alternatives) { |
|
| 402 | + if ($r->isInterface() && ! $alternatives) { |
|
| 403 | 403 | $message .= ' Did you create a class that implements this interface?'; |
| 404 | 404 | } |
| 405 | 405 | } |
| 406 | 406 | $message = \sprintf('Cannot autowire service "%s": %s %s', $this->currentId, $label, $message); |
| 407 | 407 | if (null !== $this->lastFailure) { |
| 408 | - $message = $this->lastFailure . "\n" . $message; |
|
| 408 | + $message = $this->lastFailure."\n".$message; |
|
| 409 | 409 | $this->lastFailure = null; |
| 410 | 410 | } |
| 411 | 411 | return $message; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | { |
| 415 | 415 | // try suggesting available aliases first |
| 416 | 416 | if ($message = $this->getAliasesSuggestionForType($type = $reference->getType())) { |
| 417 | - return ' ' . $message; |
|
| 417 | + return ' '.$message; |
|
| 418 | 418 | } |
| 419 | 419 | if (null === $this->ambiguousServiceTypes) { |
| 420 | 420 | $this->populateAvailableTypes(); |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $message = \sprintf('one of these existing services: "%s"', \implode('", "', $this->ambiguousServiceTypes[$type])); |
| 424 | 424 | } elseif (isset($this->types[$type])) { |
| 425 | 425 | $message = \sprintf('the existing "%s" service', $this->types[$type]); |
| 426 | - } elseif ($reference->getRequiringClass() && !$reference->canBeAutoregistered() && !$this->strictMode) { |
|
| 426 | + } elseif ($reference->getRequiringClass() && ! $reference->canBeAutoregistered() && ! $this->strictMode) { |
|
| 427 | 427 | return ' It cannot be auto-registered because it is from a different root namespace.'; |
| 428 | 428 | } else { |
| 429 | 429 | return ''; |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | try { |
| 441 | 441 | if (\method_exists($parameter, 'getType')) { |
| 442 | 442 | $type = $parameter->getType(); |
| 443 | - if ($type && !$type->isBuiltin()) { |
|
| 443 | + if ($type && ! $type->isBuiltin()) { |
|
| 444 | 444 | $class = new \ReflectionClass($type instanceof \ReflectionNamedType ? $type->getName() : (string) $type); |
| 445 | 445 | } else { |
| 446 | 446 | $class = null; |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $class = \false; |
| 454 | 454 | } |
| 455 | 455 | $isVariadic = \method_exists($parameter, 'isVariadic') && $parameter->isVariadic(); |
| 456 | - $methodArgumentsMetadata[] = ['class' => $class, 'isOptional' => $parameter->isOptional(), 'defaultValue' => $parameter->isOptional() && !$isVariadic ? $parameter->getDefaultValue() : null]; |
|
| 456 | + $methodArgumentsMetadata[] = ['class' => $class, 'isOptional' => $parameter->isOptional(), 'defaultValue' => $parameter->isOptional() && ! $isVariadic ? $parameter->getDefaultValue() : null]; |
|
| 457 | 457 | } |
| 458 | 458 | return $methodArgumentsMetadata; |
| 459 | 459 | } |
@@ -461,11 +461,11 @@ discard block |
||
| 461 | 461 | { |
| 462 | 462 | $aliases = []; |
| 463 | 463 | foreach (\class_parents($type) + \class_implements($type) as $parent) { |
| 464 | - if ($this->container->has($parent) && !$this->container->findDefinition($parent)->isAbstract()) { |
|
| 464 | + if ($this->container->has($parent) && ! $this->container->findDefinition($parent)->isAbstract()) { |
|
| 465 | 465 | $aliases[] = $parent; |
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | - $extraContext = $extraContext ? ' ' . $extraContext : ''; |
|
| 468 | + $extraContext = $extraContext ? ' '.$extraContext : ''; |
|
| 469 | 469 | if (1 < ($len = \count($aliases))) { |
| 470 | 470 | $message = \sprintf('Try changing the type-hint%s to one of its parents: ', $extraContext); |
| 471 | 471 | for ($i = 0, --$len; $i < $len; ++$i) { |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | $value[$k] = $processedValue; |
| 70 | 70 | } |
| 71 | 71 | } catch (RuntimeException $e) { |
| 72 | - if ($rootLevel < $level || $rootLevel && !$level) { |
|
| 72 | + if ($rootLevel < $level || $rootLevel && ! $level) { |
|
| 73 | 73 | unset($value[$k]); |
| 74 | 74 | } elseif ($rootLevel) { |
| 75 | 75 | throw $e; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $message .= \sprintf("\nCould be related to%s:", 1 < \count($this->errorMessages) ? ' one of' : ''); |
| 41 | 41 | } |
| 42 | 42 | foreach ($this->errorMessages as $m) { |
| 43 | - $message .= "\n - " . $m; |
|
| 43 | + $message .= "\n - ".$m; |
|
| 44 | 44 | } |
| 45 | 45 | throw new InvalidArgumentException($message); |
| 46 | 46 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | return parent::processValue($value, $isRoot); |
| 65 | 65 | } |
| 66 | - if (!$value instanceof Definition || !($bindings = $value->getBindings())) { |
|
| 66 | + if ( ! $value instanceof Definition || ! ($bindings = $value->getBindings())) { |
|
| 67 | 67 | return parent::processValue($value, $isRoot); |
| 68 | 68 | } |
| 69 | 69 | foreach ($bindings as $key => $binding) { |
@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | if ($used) { |
| 72 | 72 | $this->usedBindings[$bindingId] = \true; |
| 73 | 73 | unset($this->unusedBindings[$bindingId]); |
| 74 | - } elseif (!isset($this->usedBindings[$bindingId])) { |
|
| 74 | + } elseif ( ! isset($this->usedBindings[$bindingId])) { |
|
| 75 | 75 | $this->unusedBindings[$bindingId] = [$key, $this->currentId]; |
| 76 | 76 | } |
| 77 | 77 | if (isset($key[0]) && '$' === $key[0]) { |
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | - if (null !== $bindingValue && !$bindingValue instanceof Reference && !$bindingValue instanceof Definition) { |
|
| 80 | + if (null !== $bindingValue && ! $bindingValue instanceof Reference && ! $bindingValue instanceof Definition) { |
|
| 81 | 81 | throw new InvalidArgumentException(\sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of "%s" or an instance of "%s", "%s" given.', $key, $this->currentId, Reference::class, Definition::class, \gettype($bindingValue))); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | if (\array_key_exists($key, $arguments) && '' !== $arguments[$key]) { |
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | - if (\array_key_exists('$' . $parameter->name, $bindings)) { |
|
| 116 | - $arguments[$key] = $this->getBindingValue($bindings['$' . $parameter->name]); |
|
| 115 | + if (\array_key_exists('$'.$parameter->name, $bindings)) { |
|
| 116 | + $arguments[$key] = $this->getBindingValue($bindings['$'.$parameter->name]); |
|
| 117 | 117 | continue; |
| 118 | 118 | } |
| 119 | 119 | $typeHint = ProxyHelper::getTypeHint($reflectionMethod, $parameter, \true); |
| 120 | - if (!isset($bindings[$typeHint])) { |
|
| 120 | + if ( ! isset($bindings[$typeHint])) { |
|
| 121 | 121 | continue; |
| 122 | 122 | } |
| 123 | 123 | $arguments[$key] = $this->getBindingValue($bindings[$typeHint]); |