@@ -32,7 +32,7 @@ |
||
32 | 32 | public function __construct(array $passes) |
33 | 33 | { |
34 | 34 | foreach ($passes as $pass) { |
35 | - if (!$pass instanceof RepeatablePassInterface) { |
|
35 | + if ( ! $pass instanceof RepeatablePassInterface) { |
|
36 | 36 | throw new InvalidArgumentException('$passes must be an array of RepeatablePassInterface.'); |
37 | 37 | } |
38 | 38 | $pass->setRepeatedPass($this); |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | protected function processValue($value, $isRoot = \false) |
25 | 25 | { |
26 | 26 | $value = parent::processValue($value, $isRoot); |
27 | - if (!$value instanceof Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) { |
|
27 | + if ( ! $value instanceof Definition || ! $value->isAutowired() || $value->isAbstract() || ! $value->getClass()) { |
|
28 | 28 | return $value; |
29 | 29 | } |
30 | - if (!($reflectionClass = $this->container->getReflectionClass($value->getClass(), \false))) { |
|
30 | + if ( ! ($reflectionClass = $this->container->getReflectionClass($value->getClass(), \false))) { |
|
31 | 31 | return $value; |
32 | 32 | } |
33 | 33 | $alreadyCalledMethods = []; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $value->addMethodCall($reflectionMethod->name); |
46 | 46 | break; |
47 | 47 | } |
48 | - if (\false === \stripos($doc, '@inheritdoc') || !\preg_match('#(?:^/\\*\\*|\\n\\s*+\\*)\\s*+(?:\\{@inheritdoc\\}|@inheritdoc)(?:\\s|\\*/$)#i', $doc)) { |
|
48 | + if (\false === \stripos($doc, '@inheritdoc') || ! \preg_match('#(?:^/\\*\\*|\\n\\s*+\\*)\\s*+(?:\\{@inheritdoc\\}|@inheritdoc)(?:\\s|\\*/$)#i', $doc)) { |
|
49 | 49 | break; |
50 | 50 | } |
51 | 51 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | continue; |
30 | 30 | } |
31 | 31 | 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]*+)++$/', $id)) { |
32 | - if ($definition instanceof ChildDefinition && !\class_exists($id)) { |
|
32 | + if ($definition instanceof ChildDefinition && ! \class_exists($id)) { |
|
33 | 33 | throw new InvalidArgumentException(\sprintf('Service definition "%s" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.', $id)); |
34 | 34 | } |
35 | 35 | $this->changes[\strtolower($id)] = $id; |
@@ -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); |
@@ -47,12 +47,12 @@ |
||
47 | 47 | if ($value instanceof ArgumentInterface) { |
48 | 48 | return $value; |
49 | 49 | } |
50 | - if ($value instanceof Definition && $isRoot && (isset($this->resolvedIds[$this->currentId]) || !$value->hasTag($this->tagName) || $value->isDeprecated())) { |
|
50 | + if ($value instanceof Definition && $isRoot && (isset($this->resolvedIds[$this->currentId]) || ! $value->hasTag($this->tagName) || $value->isDeprecated())) { |
|
51 | 51 | return $value->isDeprecated() ? $value->clearTag($this->tagName) : $value; |
52 | 52 | } |
53 | 53 | if ($value instanceof Reference && ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE !== $value->getInvalidBehavior() && $this->container->has($id = $this->container->normalizeId($value))) { |
54 | 54 | $definition = $this->container->findDefinition($id); |
55 | - if (!$definition->hasTag($this->tagName) && !$definition->isDeprecated()) { |
|
55 | + if ( ! $definition->hasTag($this->tagName) && ! $definition->isDeprecated()) { |
|
56 | 56 | $this->resolvedIds[$id] = \true; |
57 | 57 | $definition->addTag($this->tagName); |
58 | 58 | parent::processValue($definition, \false); |
@@ -69,12 +69,12 @@ |
||
69 | 69 | } |
70 | 70 | $priority = 0; |
71 | 71 | } |
72 | - $property = $type . 'Passes'; |
|
73 | - if (!isset($this->{$property})) { |
|
72 | + $property = $type.'Passes'; |
|
73 | + if ( ! isset($this->{$property})) { |
|
74 | 74 | throw new InvalidArgumentException(\sprintf('Invalid type "%s".', $type)); |
75 | 75 | } |
76 | - $passes =& $this->{$property}; |
|
77 | - if (!isset($passes[$priority])) { |
|
76 | + $passes = & $this->{$property}; |
|
77 | + if ( ! isset($passes[$priority])) { |
|
78 | 78 | $passes[$priority] = []; |
79 | 79 | } |
80 | 80 | $passes[$priority][] = $pass; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | protected function processValue($value, $isRoot = \false) |
28 | 28 | { |
29 | - if (!$value instanceof Definition) { |
|
29 | + if ( ! $value instanceof Definition) { |
|
30 | 30 | return parent::processValue($value, $isRoot); |
31 | 31 | } |
32 | 32 | $calls = $value->getMethodCalls(); |
@@ -48,25 +48,25 @@ discard block |
||
48 | 48 | } |
49 | 49 | if (isset($key[0]) && '$' === $key[0]) { |
50 | 50 | foreach ($parameters as $j => $p) { |
51 | - if ($key === '$' . $p->name) { |
|
51 | + if ($key === '$'.$p->name) { |
|
52 | 52 | $resolvedArguments[$j] = $argument; |
53 | 53 | continue 2; |
54 | 54 | } |
55 | 55 | } |
56 | - throw new InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument named "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method, $key)); |
|
56 | + throw new InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument named "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key)); |
|
57 | 57 | } |
58 | - if (null !== $argument && !$argument instanceof Reference && !$argument instanceof Definition) { |
|
59 | - throw new InvalidArgumentException(\sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class . '::' . $method : $method, Reference::class, Definition::class, \gettype($argument))); |
|
58 | + if (null !== $argument && ! $argument instanceof Reference && ! $argument instanceof Definition) { |
|
59 | + throw new InvalidArgumentException(\sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, \gettype($argument))); |
|
60 | 60 | } |
61 | 61 | $typeFound = \false; |
62 | 62 | foreach ($parameters as $j => $p) { |
63 | - if (!\array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, \true) === $key) { |
|
63 | + if ( ! \array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, \true) === $key) { |
|
64 | 64 | $resolvedArguments[$j] = $argument; |
65 | 65 | $typeFound = \true; |
66 | 66 | } |
67 | 67 | } |
68 | - if (!$typeFound) { |
|
69 | - throw new InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class . '::' . $method : $method, $key)); |
|
68 | + if ( ! $typeFound) { |
|
69 | + throw new InvalidArgumentException(\sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key)); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | if ($resolvedArguments !== $call[1]) { |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | { |
48 | 48 | $instanceofConditionals = $definition->getInstanceofConditionals(); |
49 | 49 | $autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : []; |
50 | - if (!$instanceofConditionals && !$autoconfiguredInstanceof) { |
|
50 | + if ( ! $instanceofConditionals && ! $autoconfiguredInstanceof) { |
|
51 | 51 | return $definition; |
52 | 52 | } |
53 | - if (!($class = $container->getParameterBag()->resolveValue($definition->getClass()))) { |
|
53 | + if ( ! ($class = $container->getParameterBag()->resolveValue($definition->getClass()))) { |
|
54 | 54 | return $definition; |
55 | 55 | } |
56 | 56 | $conditionals = $this->mergeConditionals($autoconfiguredInstanceof, $instanceofConditionals, $container); |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | $instanceofTags = []; |
60 | 60 | $reflectionClass = null; |
61 | 61 | foreach ($conditionals as $interface => $instanceofDefs) { |
62 | - if ($interface !== $class && !(null === $reflectionClass ? $reflectionClass = $container->getReflectionClass($class, \false) ?: \false : $reflectionClass)) { |
|
62 | + if ($interface !== $class && ! (null === $reflectionClass ? $reflectionClass = $container->getReflectionClass($class, \false) ?: \false : $reflectionClass)) { |
|
63 | 63 | continue; |
64 | 64 | } |
65 | - if ($interface !== $class && !\is_subclass_of($class, $interface)) { |
|
65 | + if ($interface !== $class && ! \is_subclass_of($class, $interface)) { |
|
66 | 66 | continue; |
67 | 67 | } |
68 | 68 | foreach ($instanceofDefs as $key => $instanceofDef) { |
69 | 69 | /** @var ChildDefinition $instanceofDef */ |
70 | 70 | $instanceofDef = clone $instanceofDef; |
71 | - $instanceofDef->setAbstract(\true)->setParent($parent ?: 'abstract.instanceof.' . $id); |
|
72 | - $parent = 'instanceof.' . $interface . '.' . $key . '.' . $id; |
|
71 | + $instanceofDef->setAbstract(\true)->setParent($parent ?: 'abstract.instanceof.'.$id); |
|
72 | + $parent = 'instanceof.'.$interface.'.'.$key.'.'.$id; |
|
73 | 73 | $container->setDefinition($parent, $instanceofDef); |
74 | 74 | $instanceofTags[] = $instanceofDef->getTags(); |
75 | 75 | $instanceofDef->setTags([]); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | if ($parent) { |
82 | 82 | $bindings = $definition->getBindings(); |
83 | - $abstract = $container->setDefinition('abstract.instanceof.' . $id, $definition); |
|
83 | + $abstract = $container->setDefinition('abstract.instanceof.'.$id, $definition); |
|
84 | 84 | // cast Definition to ChildDefinition |
85 | 85 | $definition->setBindings([]); |
86 | 86 | $definition = \serialize($definition); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $definition = \substr_replace($definition, 'Child', 44, 0); |
89 | 89 | $definition = \unserialize($definition); |
90 | 90 | $definition->setParent($parent); |
91 | - if (null !== $shared && !isset($definition->getChanges()['shared'])) { |
|
91 | + if (null !== $shared && ! isset($definition->getChanges()['shared'])) { |
|
92 | 92 | $definition->setShared($shared); |
93 | 93 | } |
94 | 94 | $i = \count($instanceofTags); |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | private function mergeConditionals(array $autoconfiguredInstanceof, array $instanceofConditionals, ContainerBuilder $container) |
112 | 112 | { |
113 | 113 | // make each value an array of ChildDefinition |
114 | - $conditionals = \array_map(function ($childDef) { |
|
114 | + $conditionals = \array_map(function($childDef) { |
|
115 | 115 | return [$childDef]; |
116 | 116 | }, $autoconfiguredInstanceof); |
117 | 117 | foreach ($instanceofConditionals as $interface => $instanceofDef) { |
118 | 118 | // make sure the interface/class exists (but don't validate automaticInstanceofConditionals) |
119 | - if (!$container->getReflectionClass($interface)) { |
|
119 | + if ( ! $container->getReflectionClass($interface)) { |
|
120 | 120 | throw new RuntimeException(\sprintf('"%s" is set as an "instanceof" conditional, but it does not exist.', $interface)); |
121 | 121 | } |
122 | - if (!isset($autoconfiguredInstanceof[$interface])) { |
|
122 | + if ( ! isset($autoconfiguredInstanceof[$interface])) { |
|
123 | 123 | $conditionals[$interface] = []; |
124 | 124 | } |
125 | 125 | $conditionals[$interface][] = $instanceofDef; |
@@ -31,7 +31,7 @@ |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | $value = parent::processValue($value, $isRoot); |
34 | - if ($value && \is_array($value) && !$isRoot) { |
|
34 | + if ($value && \is_array($value) && ! $isRoot) { |
|
35 | 35 | $value = \array_combine($this->container->resolveEnvPlaceholders(\array_keys($value), \true), $value); |
36 | 36 | } |
37 | 37 | return $value; |