Skip to content

Commit cdadb37

Browse files
Merge branch '3.4' into 4.2
* 3.4: (24 commits) Apply php-cs-fixer rule for array_key_exists() [Security] Change FormAuthenticator if condition handles multi-byte characters in autocomplete speed up tests running them without debug flag [Translations] added missing Croatian validators Fix getItems() performance issue with RedisCluster (php-redis) [VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning IntegerType: reject submitted non-integer numbers be keen to newcomers [HttpKernel] Fix possible infinite loop of exceptions fixed CS [Validator] Added missing translations for Afrikaans do not validate non-submitted form fields in PATCH requests Update usage example in ArrayInput doc block. [Console] Prevent ArgvInput::getFirstArgument() from returning an option value [Validator] Fixed duplicate UUID fixed CS [EventDispatcher] Fix unknown priority Avoid mutating the Finder when building the iterator [Validator] Add the missing translations for the Greek (el) locale ...
2 parents b59f729 + c3dd7b7 commit cdadb37

14 files changed

+24
-24
lines changed

ChildDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function setParent($parent)
7171
*/
7272
public function getArgument($index)
7373
{
74-
if (array_key_exists('index_'.$index, $this->arguments)) {
74+
if (\array_key_exists('index_'.$index, $this->arguments)) {
7575
return $this->arguments['index_'.$index];
7676
}
7777

Compiler/AutowirePass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a
189189
}
190190

191191
foreach ($parameters as $index => $parameter) {
192-
if (array_key_exists($index, $arguments) && '' !== $arguments[$index]) {
192+
if (\array_key_exists($index, $arguments) && '' !== $arguments[$index]) {
193193
continue;
194194
}
195195

Compiler/RegisterServiceSubscribersPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ protected function processValue($value, $isRoot = false)
4343
if ([] !== array_diff(array_keys($attributes), ['id', 'key'])) {
4444
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));
4545
}
46-
if (!array_key_exists('id', $attributes)) {
46+
if (!\array_key_exists('id', $attributes)) {
4747
throw new InvalidArgumentException(sprintf('Missing "id" attribute on "container.service_subscriber" tag with key="%s" for service "%s".', $attributes['key'], $this->currentId));
4848
}
49-
if (!array_key_exists('key', $attributes)) {
49+
if (!\array_key_exists('key', $attributes)) {
5050
$attributes['key'] = $attributes['id'];
5151
}
5252
if (isset($serviceMap[$attributes['key']])) {

Compiler/ResolveBindingsPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,19 @@ protected function processValue($value, $isRoot = false)
119119
}
120120

121121
foreach ($reflectionMethod->getParameters() as $key => $parameter) {
122-
if (array_key_exists($key, $arguments) && '' !== $arguments[$key]) {
122+
if (\array_key_exists($key, $arguments) && '' !== $arguments[$key]) {
123123
continue;
124124
}
125125

126126
$typeHint = ProxyHelper::getTypeHint($reflectionMethod, $parameter);
127127

128-
if (array_key_exists($k = ltrim($typeHint, '\\').' $'.$parameter->name, $bindings)) {
128+
if (\array_key_exists($k = ltrim($typeHint, '\\').' $'.$parameter->name, $bindings)) {
129129
$arguments[$key] = $this->getBindingValue($bindings[$k]);
130130

131131
continue;
132132
}
133133

134-
if (array_key_exists('$'.$parameter->name, $bindings)) {
134+
if (\array_key_exists('$'.$parameter->name, $bindings)) {
135135
$arguments[$key] = $this->getBindingValue($bindings['$'.$parameter->name]);
136136

137137
continue;

Compiler/ResolveNamedArgumentsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected function processValue($value, $isRoot = false)
7777

7878
$typeFound = false;
7979
foreach ($parameters as $j => $p) {
80-
if (!array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) {
80+
if (!\array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) {
8181
$resolvedArguments[$j] = $argument;
8282
$typeFound = true;
8383
}

Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ protected function getEnv($name)
385385
if (isset($this->resolving[$envName = "env($name)"])) {
386386
throw new ParameterCircularReferenceException(array_keys($this->resolving));
387387
}
388-
if (isset($this->envCache[$name]) || array_key_exists($name, $this->envCache)) {
388+
if (isset($this->envCache[$name]) || \array_key_exists($name, $this->envCache)) {
389389
return $this->envCache[$name];
390390
}
391391
if (!$this->has($id = 'container.env_var_processors_locator')) {

Definition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function replaceArgument($index, $argument)
269269
throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, \count($this->arguments) - 1));
270270
}
271271

272-
if (!array_key_exists($index, $this->arguments)) {
272+
if (!\array_key_exists($index, $this->arguments)) {
273273
throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index));
274274
}
275275

@@ -314,7 +314,7 @@ public function getArguments()
314314
*/
315315
public function getArgument($index)
316316
{
317-
if (!array_key_exists($index, $this->arguments)) {
317+
if (!\array_key_exists($index, $this->arguments)) {
318318
throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index));
319319
}
320320

Dumper/GraphvizDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private function findNodes(): array
171171
}
172172

173173
foreach ($container->getServiceIds() as $id) {
174-
if (array_key_exists($id, $container->getAliases())) {
174+
if (\array_key_exists($id, $container->getAliases())) {
175175
continue;
176176
}
177177

EnvVarProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
6565
if (!\is_array($array)) {
6666
throw new RuntimeException(sprintf('Resolved value of "%s" did not result in an array value.', $next));
6767
}
68-
if (!array_key_exists($key, $array)) {
68+
if (!\array_key_exists($key, $array)) {
6969
throw new RuntimeException(sprintf('Key "%s" not found in "%s" (resolved from "%s")', $key, json_encode($array), $next));
7070
}
7171

Extension/Extension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ final public function getProcessedConfigs()
127127
*/
128128
protected function isConfigEnabled(ContainerBuilder $container, array $config)
129129
{
130-
if (!array_key_exists('enabled', $config)) {
130+
if (!\array_key_exists('enabled', $config)) {
131131
throw new InvalidArgumentException("The config array has no 'enabled' key.");
132132
}
133133

LazyProxy/Instantiator/RealServiceInstantiator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* {@inheritdoc}
1919
*
20-
* Noop proxy instantiator - simply produces the real service instead of a proxy instance.
20+
* Noop proxy instantiator - produces the real service instead of a proxy instance.
2121
*
2222
* @author Marco Pivetta <[email protected]>
2323
*/

Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults)
349349
continue;
350350
}
351351

352-
if (false !== strpos($name, '-') && false === strpos($name, '_') && !array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) {
352+
if (false !== strpos($name, '-') && false === strpos($name, '_') && !\array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) {
353353
$parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue);
354354
}
355355
// keep not normalized key

Loader/YamlFileLoader.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private function parseDefinitions(array $content, string $file)
203203
throw new InvalidArgumentException(sprintf('The "services" key should contain an array in %s. Check your YAML syntax.', $file));
204204
}
205205

206-
if (array_key_exists('_instanceof', $content['services'])) {
206+
if (\array_key_exists('_instanceof', $content['services'])) {
207207
$instanceof = $content['services']['_instanceof'];
208208
unset($content['services']['_instanceof']);
209209

@@ -235,7 +235,7 @@ private function parseDefinitions(array $content, string $file)
235235
*/
236236
private function parseDefaults(array &$content, string $file): array
237237
{
238-
if (!array_key_exists('_defaults', $content['services'])) {
238+
if (!\array_key_exists('_defaults', $content['services'])) {
239239
return [];
240240
}
241241
$defaults = $content['services']['_defaults'];
@@ -342,7 +342,7 @@ private function parseDefinition($id, $service, $file, array $defaults)
342342

343343
if (isset($service['alias'])) {
344344
$this->container->setAlias($id, $alias = new Alias($service['alias']));
345-
if (array_key_exists('public', $service)) {
345+
if (\array_key_exists('public', $service)) {
346346
$alias->setPublic($service['public']);
347347
} elseif (isset($defaults['public'])) {
348348
$alias->setPublic($defaults['public']);
@@ -426,7 +426,7 @@ private function parseDefinition($id, $service, $file, array $defaults)
426426
$definition->setAbstract($service['abstract']);
427427
}
428428

429-
if (array_key_exists('deprecated', $service)) {
429+
if (\array_key_exists('deprecated', $service)) {
430430
$definition->setDeprecated(true, $service['deprecated']);
431431
}
432432

@@ -541,11 +541,11 @@ private function parseDefinition($id, $service, $file, array $defaults)
541541
}
542542
}
543543

544-
if (array_key_exists('namespace', $service) && !array_key_exists('resource', $service)) {
544+
if (\array_key_exists('namespace', $service) && !\array_key_exists('resource', $service)) {
545545
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));
546546
}
547547

548-
if (array_key_exists('resource', $service)) {
548+
if (\array_key_exists('resource', $service)) {
549549
if (!\is_string($service['resource'])) {
550550
throw new InvalidArgumentException(sprintf('A "resource" attribute must be of type string for service "%s" in %s. Check your YAML syntax.', $id, $file));
551551
}

ParameterBag/ParameterBag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function get($name)
6868
{
6969
$name = (string) $name;
7070

71-
if (!array_key_exists($name, $this->parameters)) {
71+
if (!\array_key_exists($name, $this->parameters)) {
7272
if (!$name) {
7373
throw new ParameterNotFoundException($name);
7474
}
@@ -119,7 +119,7 @@ public function set($name, $value)
119119
*/
120120
public function has($name)
121121
{
122-
return array_key_exists((string) $name, $this->parameters);
122+
return \array_key_exists((string) $name, $this->parameters);
123123
}
124124

125125
/**

0 commit comments

Comments
 (0)