Skip to content

Commit c3dd7b7

Browse files
Apply php-cs-fixer rule for array_key_exists()
1 parent ca1653d commit c3dd7b7

12 files changed

+21
-21
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
@@ -214,7 +214,7 @@ private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, a
214214
}
215215

216216
foreach ($parameters as $index => $parameter) {
217-
if (array_key_exists($index, $arguments) && '' !== $arguments[$index]) {
217+
if (\array_key_exists($index, $arguments) && '' !== $arguments[$index]) {
218218
continue;
219219
}
220220

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ 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

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

129129
continue;

Compiler/ResolveNamedArgumentsPass.php

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

7272
$typeFound = false;
7373
foreach ($parameters as $j => $p) {
74-
if (!array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) {
74+
if (!\array_key_exists($j, $resolvedArguments) && ProxyHelper::getTypeHint($r, $p, true) === $key) {
7575
$resolvedArguments[$j] = $argument;
7676
$typeFound = true;
7777
}

Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ protected function getEnv($name)
466466
if (isset($this->resolving[$envName = "env($name)"])) {
467467
throw new ParameterCircularReferenceException(array_keys($this->resolving));
468468
}
469-
if (isset($this->envCache[$name]) || array_key_exists($name, $this->envCache)) {
469+
if (isset($this->envCache[$name]) || \array_key_exists($name, $this->envCache)) {
470470
return $this->envCache[$name];
471471
}
472472
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
@@ -263,7 +263,7 @@ public function replaceArgument($index, $argument)
263263
throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, \count($this->arguments) - 1));
264264
}
265265

266-
if (!array_key_exists($index, $this->arguments)) {
266+
if (!\array_key_exists($index, $this->arguments)) {
267267
throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index));
268268
}
269269

@@ -308,7 +308,7 @@ public function getArguments()
308308
*/
309309
public function getArgument($index)
310310
{
311-
if (!array_key_exists($index, $this->arguments)) {
311+
if (!\array_key_exists($index, $this->arguments)) {
312312
throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index));
313313
}
314314

Dumper/GraphvizDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private function findNodes()
193193
}
194194

195195
foreach ($container->getServiceIds() as $id) {
196-
if (array_key_exists($id, $container->getAliases())) {
196+
if (\array_key_exists($id, $container->getAliases())) {
197197
continue;
198198
}
199199

Extension/Extension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ final public function getProcessedConfigs()
115115
*/
116116
protected function isConfigEnabled(ContainerBuilder $container, array $config)
117117
{
118-
if (!array_key_exists('enabled', $config)) {
118+
if (!\array_key_exists('enabled', $config)) {
119119
throw new InvalidArgumentException("The config array has no 'enabled' key.");
120120
}
121121

Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults)
333333
continue;
334334
}
335335

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

Loader/YamlFileLoader.php

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

216-
if (array_key_exists('_instanceof', $content['services'])) {
216+
if (\array_key_exists('_instanceof', $content['services'])) {
217217
$instanceof = $content['services']['_instanceof'];
218218
unset($content['services']['_instanceof']);
219219

@@ -250,7 +250,7 @@ private function parseDefinitions(array $content, $file)
250250
*/
251251
private function parseDefaults(array &$content, $file)
252252
{
253-
if (!array_key_exists('_defaults', $content['services'])) {
253+
if (!\array_key_exists('_defaults', $content['services'])) {
254254
return [];
255255
}
256256
$defaults = $content['services']['_defaults'];
@@ -361,7 +361,7 @@ private function parseDefinition($id, $service, $file, array $defaults)
361361

362362
if (isset($service['alias'])) {
363363
$this->container->setAlias($id, $alias = new Alias($service['alias']));
364-
if (array_key_exists('public', $service)) {
364+
if (\array_key_exists('public', $service)) {
365365
$alias->setPublic($service['public']);
366366
} elseif (isset($defaults['public'])) {
367367
$alias->setPublic($defaults['public']);
@@ -438,7 +438,7 @@ private function parseDefinition($id, $service, $file, array $defaults)
438438
$definition->setAbstract($service['abstract']);
439439
}
440440

441-
if (array_key_exists('deprecated', $service)) {
441+
if (\array_key_exists('deprecated', $service)) {
442442
$definition->setDeprecated(true, $service['deprecated']);
443443
}
444444

@@ -571,11 +571,11 @@ private function parseDefinition($id, $service, $file, array $defaults)
571571
}
572572
}
573573

574-
if (array_key_exists('namespace', $service) && !array_key_exists('resource', $service)) {
574+
if (\array_key_exists('namespace', $service) && !\array_key_exists('resource', $service)) {
575575
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));
576576
}
577577

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

ParameterBag/ParameterBag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function get($name)
7070
{
7171
$name = $this->normalizeName($name);
7272

73-
if (!array_key_exists($name, $this->parameters)) {
73+
if (!\array_key_exists($name, $this->parameters)) {
7474
if (!$name) {
7575
throw new ParameterNotFoundException($name);
7676
}
@@ -121,7 +121,7 @@ public function set($name, $value)
121121
*/
122122
public function has($name)
123123
{
124-
return array_key_exists($this->normalizeName($name), $this->parameters);
124+
return \array_key_exists($this->normalizeName($name), $this->parameters);
125125
}
126126

127127
/**

0 commit comments

Comments
 (0)