Skip to content

Commit b0a3208

Browse files
Apply php-cs-fixer rule for array_key_exists()
1 parent af66641 commit b0a3208

File tree

88 files changed

+157
-157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+157
-157
lines changed

src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ protected function getMetadata($class)
157157
// normalize class name
158158
$class = ClassUtils::getRealClass(ltrim($class, '\\'));
159159

160-
if (array_key_exists($class, $this->cache)) {
160+
if (\array_key_exists($class, $this->cache)) {
161161
return $this->cache[$class];
162162
}
163163

src/Symfony/Bridge/Twig/NodeVisitor/Scope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function set($key, $value)
7777
*/
7878
public function has($key)
7979
{
80-
if (array_key_exists($key, $this->data)) {
80+
if (\array_key_exists($key, $this->data)) {
8181
return true;
8282
}
8383

@@ -98,7 +98,7 @@ public function has($key)
9898
*/
9999
public function get($key, $default = null)
100100
{
101-
if (array_key_exists($key, $this->data)) {
101+
if (\array_key_exists($key, $this->data)) {
102102
return $this->data[$key];
103103
}
104104

src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private function getConfigForPath(array $config, $path, $alias)
139139
$steps = explode('.', $path);
140140

141141
foreach ($steps as $step) {
142-
if (!array_key_exists($step, $config)) {
142+
if (!\array_key_exists($step, $config)) {
143143
throw new LogicException(sprintf('Unable to find configuration for "%s.%s"', $alias, $path));
144144
}
145145

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
156156
*/
157157
protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = [])
158158
{
159-
$this->writeData($this->getEventDispatcherListenersData($eventDispatcher, array_key_exists('event', $options) ? $options['event'] : null), $options);
159+
$this->writeData($this->getEventDispatcherListenersData($eventDispatcher, \array_key_exists('event', $options) ? $options['event'] : null), $options);
160160
}
161161

162162
/**

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ protected function describeContainerParameter($parameter, array $options = [])
275275
*/
276276
protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = [])
277277
{
278-
$event = array_key_exists('event', $options) ? $options['event'] : null;
278+
$event = \array_key_exists('event', $options) ? $options['event'] : null;
279279

280280
$title = 'Registered listeners';
281281
if (null !== $event) {

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ protected function describeContainerParameter($parameter, array $options = [])
385385
*/
386386
protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = [])
387387
{
388-
$event = array_key_exists('event', $options) ? $options['event'] : null;
388+
$event = \array_key_exists('event', $options) ? $options['event'] : null;
389389

390390
if (null !== $event) {
391391
$title = sprintf('Registered Listeners for "%s" Event', $event);

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function describeContainerAlias(Alias $alias, array $options = [], Con
111111
*/
112112
protected function describeEventDispatcherListeners(EventDispatcherInterface $eventDispatcher, array $options = [])
113113
{
114-
$this->writeDocument($this->getEventDispatcherListenersDocument($eventDispatcher, array_key_exists('event', $options) ? $options['event'] : null));
114+
$this->writeDocument($this->getEventDispatcherListenersDocument($eventDispatcher, \array_key_exists('event', $options) ? $options['event'] : null));
115115
}
116116

117117
/**

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
371371
}
372372

373373
foreach ($transitions as $name => $transition) {
374-
if (array_key_exists('name', $transition)) {
374+
if (\array_key_exists('name', $transition)) {
375375
continue;
376376
}
377377
$transition['name'] = $name;

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
602602
$registryDefinition = $container->getDefinition('workflow.registry');
603603

604604
foreach ($config['workflows'] as $name => $workflow) {
605-
if (!array_key_exists('type', $workflow)) {
605+
if (!\array_key_exists('type', $workflow)) {
606606
$workflow['type'] = 'workflow';
607607
@trigger_error(sprintf('The "type" option of the "framework.workflows.%s" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.', $name), E_USER_DEPRECATED);
608608
}
@@ -1052,7 +1052,7 @@ private function registerAssetsConfiguration(array $config, ContainerBuilder $co
10521052
foreach ($config['packages'] as $name => $package) {
10531053
if (null !== $package['version_strategy']) {
10541054
$version = new Reference($package['version_strategy']);
1055-
} elseif (!array_key_exists('version', $package) && null === $package['json_manifest_path']) {
1055+
} elseif (!\array_key_exists('version', $package) && null === $package['json_manifest_path']) {
10561056
// if neither version nor json_manifest_path are specified, use the default
10571057
$version = $defaultVersion;
10581058
} else {
@@ -1273,15 +1273,15 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
12731273
$definition = $container->findDefinition('validator.email');
12741274
$definition->replaceArgument(0, $config['strict_email']);
12751275

1276-
if (array_key_exists('enable_annotations', $config) && $config['enable_annotations']) {
1276+
if (\array_key_exists('enable_annotations', $config) && $config['enable_annotations']) {
12771277
if (!$this->annotationsConfigEnabled) {
12781278
throw new \LogicException('"enable_annotations" on the validator cannot be set as Annotations support is disabled.');
12791279
}
12801280

12811281
$validatorBuilder->addMethodCall('enableAnnotationMapping', [new Reference('annotation_reader')]);
12821282
}
12831283

1284-
if (array_key_exists('static_method', $config) && $config['static_method']) {
1284+
if (\array_key_exists('static_method', $config) && $config['static_method']) {
12851285
foreach ($config['static_method'] as $methodName) {
12861286
$validatorBuilder->addMethodCall('addMethodMapping', [$methodName]);
12871287
}

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
479479
foreach ($this->factories as $position) {
480480
foreach ($position as $factory) {
481481
$key = str_replace('-', '_', $factory->getKey());
482-
if (array_key_exists($key, $firewall)) {
482+
if (\array_key_exists($key, $firewall)) {
483483
$listenerKeys[] = $key;
484484
}
485485
}

src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private function getBundleHierarchy(ContainerBuilder $container, array $config)
193193
$bundleHierarchy = [];
194194

195195
foreach ($container->getParameter('kernel.bundles_metadata') as $name => $bundle) {
196-
if (!array_key_exists($name, $bundleHierarchy)) {
196+
if (!\array_key_exists($name, $bundleHierarchy)) {
197197
$bundleHierarchy[$name] = [
198198
'paths' => [],
199199
'parents' => [],
@@ -222,7 +222,7 @@ private function getBundleHierarchy(ContainerBuilder $container, array $config)
222222

223223
$bundleHierarchy[$name]['parents'][] = $bundle['parent'];
224224

225-
if (!array_key_exists($bundle['parent'], $bundleHierarchy)) {
225+
if (!\array_key_exists($bundle['parent'], $bundleHierarchy)) {
226226
$bundleHierarchy[$bundle['parent']] = [
227227
'paths' => [],
228228
'parents' => [],

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public function back()
452452
{
453453
do {
454454
$request = $this->history->back();
455-
} while (array_key_exists(serialize($request), $this->redirects));
455+
} while (\array_key_exists(serialize($request), $this->redirects));
456456

457457
return $this->requestFromRequest($request, false);
458458
}
@@ -466,7 +466,7 @@ public function forward()
466466
{
467467
do {
468468
$request = $this->history->forward();
469-
} while (array_key_exists(serialize($request), $this->redirects));
469+
} while (\array_key_exists(serialize($request), $this->redirects));
470470

471471
return $this->requestFromRequest($request, false);
472472
}

src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ protected function setUp()
2121
{
2222
parent::setUp();
2323

24-
if (!array_key_exists('testDeferredSaveWithoutCommit', $this->skippedTests) && \defined('HHVM_VERSION')) {
24+
if (!\array_key_exists('testDeferredSaveWithoutCommit', $this->skippedTests) && \defined('HHVM_VERSION')) {
2525
$this->skippedTests['testDeferredSaveWithoutCommit'] = 'Destructors are called late on HHVM.';
2626
}
2727

28-
if (!array_key_exists('testPrune', $this->skippedTests) && !$this->createCachePool() instanceof PruneableInterface) {
28+
if (!\array_key_exists('testPrune', $this->skippedTests) && !$this->createCachePool() instanceof PruneableInterface) {
2929
$this->skippedTests['testPrune'] = 'Not a pruneable cache pool.';
3030
}
3131
}

src/Symfony/Component/Cache/Tests/Simple/CacheTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ protected function setUp()
2121
{
2222
parent::setUp();
2323

24-
if (!array_key_exists('testPrune', $this->skippedTests) && !$this->createSimpleCache() instanceof PruneableInterface) {
24+
if (!\array_key_exists('testPrune', $this->skippedTests) && !$this->createSimpleCache() instanceof PruneableInterface) {
2525
$this->skippedTests['testPrune'] = 'Not a pruneable cache pool.';
2626
}
2727
}

src/Symfony/Component/Cache/Traits/MemcachedTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static function createConnection($servers, array $options = [])
135135
$client->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
136136
$client->setOption(\Memcached::OPT_NO_BLOCK, true);
137137
$client->setOption(\Memcached::OPT_TCP_NODELAY, true);
138-
if (!array_key_exists('LIBKETAMA_COMPATIBLE', $options) && !array_key_exists(\Memcached::OPT_LIBKETAMA_COMPATIBLE, $options)) {
138+
if (!\array_key_exists('LIBKETAMA_COMPATIBLE', $options) && !\array_key_exists(\Memcached::OPT_LIBKETAMA_COMPATIBLE, $options)) {
139139
$client->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
140140
}
141141
foreach ($options as $name => $value) {

src/Symfony/Component/Config/Definition/ArrayNode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function preNormalize($value)
5959
$normalized = [];
6060

6161
foreach ($value as $k => $v) {
62-
if (false !== strpos($k, '-') && false === strpos($k, '_') && !array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) {
62+
if (false !== strpos($k, '-') && false === strpos($k, '_') && !\array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) {
6363
$normalized[$normalizedKey] = $v;
6464
} else {
6565
$normalized[$k] = $v;
@@ -223,7 +223,7 @@ protected function finalizeValue($value)
223223
}
224224

225225
foreach ($this->children as $name => $child) {
226-
if (!array_key_exists($name, $value)) {
226+
if (!\array_key_exists($name, $value)) {
227227
if ($child->isRequired()) {
228228
$ex = new InvalidConfigurationException(sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath()));
229229
$ex->setPath($this->getPath());
@@ -359,7 +359,7 @@ protected function mergeValues($leftSide, $rightSide)
359359

360360
foreach ($rightSide as $k => $v) {
361361
// no conflict
362-
if (!array_key_exists($k, $leftSide)) {
362+
if (!\array_key_exists($k, $leftSide)) {
363363
if (!$this->allowNewKeys) {
364364
$ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file. If you are trying to overwrite an element, make sure you redefine it with the same name.', $this->getPath()));
365365
$ex->setPath($this->getPath());

src/Symfony/Component/Config/Definition/PrototypedArrayNode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ protected function normalizeValue($value)
245245
// if only "value" is left
246246
if (array_keys($v) === ['value']) {
247247
$v = $v['value'];
248-
if ($this->prototype instanceof ArrayNode && ($children = $this->prototype->getChildren()) && array_key_exists('value', $children)) {
248+
if ($this->prototype instanceof ArrayNode && ($children = $this->prototype->getChildren()) && \array_key_exists('value', $children)) {
249249
$valuePrototype = current($this->valuePrototypes) ?: clone $children['value'];
250250
$valuePrototype->parent = $this;
251251
$originalClosures = $this->prototype->normalizationClosures;
@@ -258,7 +258,7 @@ protected function normalizeValue($value)
258258
}
259259
}
260260

261-
if (array_key_exists($k, $normalized)) {
261+
if (\array_key_exists($k, $normalized)) {
262262
$ex = new DuplicateKeyException(sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath()));
263263
$ex->setPath($this->getPath());
264264

@@ -308,7 +308,7 @@ protected function mergeValues($leftSide, $rightSide)
308308
}
309309

310310
// no conflict
311-
if (!array_key_exists($k, $leftSide)) {
311+
if (!\array_key_exists($k, $leftSide)) {
312312
if (!$this->allowNewKeys) {
313313
$ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file.', $this->getPath()));
314314
$ex->setPath($this->getPath());

src/Symfony/Component/Console/Input/Input.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function validate()
6969
$givenArguments = $this->arguments;
7070

7171
$missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
72-
return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
72+
return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
7373
});
7474

7575
if (\count($missingArguments) > 0) {
@@ -150,7 +150,7 @@ public function getOption($name)
150150
throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
151151
}
152152

153-
return array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
153+
return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
154154
}
155155

156156
/**

src/Symfony/Component/Console/Tester/ApplicationTester.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function run(array $input, $options = [])
6666
$this->input->setInteractive($options['interactive']);
6767
}
6868

69-
$this->captureStreamsIndependently = array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
69+
$this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
7070
if (!$this->captureStreamsIndependently) {
7171
$this->output = new StreamOutput(fopen('php://memory', 'w', false));
7272
if (isset($options['decorated'])) {

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function setLoggers(array $loggers)
222222
}
223223
if (!\is_array($log)) {
224224
$log = [$log];
225-
} elseif (!array_key_exists(0, $log)) {
225+
} elseif (!\array_key_exists(0, $log)) {
226226
throw new \InvalidArgumentException('No logger provided');
227227
}
228228
if (null === $log[0]) {

src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public function testExtendedFinalClass()
297297
require __DIR__.'/Fixtures/FinalClasses.php';
298298

299299
$i = 1;
300-
while(class_exists($finalClass = __NAMESPACE__.'\\Fixtures\\FinalClass'.$i++, false)) {
300+
while (class_exists($finalClass = __NAMESPACE__.'\\Fixtures\\FinalClass'.$i++, false)) {
301301
spl_autoload_call($finalClass);
302302
class_exists('Test\\'.__NAMESPACE__.'\\Extends'.substr($finalClass, strrpos($finalClass, '\\') + 1), true);
303303
}

src/Symfony/Component/DependencyInjection/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

src/Symfony/Component/DependencyInjection/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

src/Symfony/Component/DependencyInjection/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']])) {

src/Symfony/Component/DependencyInjection/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;

src/Symfony/Component/DependencyInjection/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
}

src/Symfony/Component/DependencyInjection/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')) {

0 commit comments

Comments
 (0)