Skip to content

Commit ad69931

Browse files
committed
Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
1 parent d9077ee commit ad69931

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

OptionsResolver.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ public function setAllowedValues($option, $allowedValues = null)
457457
}
458458

459459
// BC
460-
if (is_array($option) && null === $allowedValues) {
460+
if (\is_array($option) && null === $allowedValues) {
461461
@trigger_error('Calling the '.__METHOD__.' method with an array of options is deprecated since Symfony 2.6 and will be removed in 3.0. Use the new signature with a single option instead.', E_USER_DEPRECATED);
462462

463463
foreach ($option as $optionName => $optionValues) {
@@ -475,7 +475,7 @@ public function setAllowedValues($option, $allowedValues = null)
475475
));
476476
}
477477

478-
$this->allowedValues[$option] = is_array($allowedValues) ? $allowedValues : array($allowedValues);
478+
$this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : array($allowedValues);
479479

480480
// Make sure the option is processed
481481
unset($this->resolved[$option]);
@@ -513,7 +513,7 @@ public function addAllowedValues($option, $allowedValues = null)
513513
}
514514

515515
// BC
516-
if (is_array($option) && null === $allowedValues) {
516+
if (\is_array($option) && null === $allowedValues) {
517517
@trigger_error('Calling the '.__METHOD__.' method with an array of options is deprecated since Symfony 2.6 and will be removed in 3.0. Use the new signature with a single option instead.', E_USER_DEPRECATED);
518518

519519
foreach ($option as $optionName => $optionValues) {
@@ -531,7 +531,7 @@ public function addAllowedValues($option, $allowedValues = null)
531531
));
532532
}
533533

534-
if (!is_array($allowedValues)) {
534+
if (!\is_array($allowedValues)) {
535535
$allowedValues = array($allowedValues);
536536
}
537537

@@ -569,7 +569,7 @@ public function setAllowedTypes($option, $allowedTypes = null)
569569
}
570570

571571
// BC
572-
if (is_array($option) && null === $allowedTypes) {
572+
if (\is_array($option) && null === $allowedTypes) {
573573
@trigger_error('Calling the '.__METHOD__.' method with an array of options is deprecated since Symfony 2.6 and will be removed in 3.0. Use the new signature with a single option instead.', E_USER_DEPRECATED);
574574

575575
foreach ($option as $optionName => $optionTypes) {
@@ -619,7 +619,7 @@ public function addAllowedTypes($option, $allowedTypes = null)
619619
}
620620

621621
// BC
622-
if (is_array($option) && null === $allowedTypes) {
622+
if (\is_array($option) && null === $allowedTypes) {
623623
@trigger_error('Calling the '.__METHOD__.' method with an array of options is deprecated since Symfony 2.6 and will be removed in 3.0. Use the new signature with a single option instead.', E_USER_DEPRECATED);
624624

625625
foreach ($option as $optionName => $optionTypes) {
@@ -735,12 +735,12 @@ public function resolve(array $options = array())
735735
// Make sure that no unknown options are passed
736736
$diff = array_diff_key($options, $clone->defined);
737737

738-
if (count($diff) > 0) {
738+
if (\count($diff) > 0) {
739739
ksort($clone->defined);
740740
ksort($diff);
741741

742742
throw new UndefinedOptionsException(sprintf(
743-
(count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".',
743+
(\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".',
744744
implode('", "', array_keys($diff)),
745745
implode('", "', array_keys($clone->defined))
746746
));
@@ -755,11 +755,11 @@ public function resolve(array $options = array())
755755
// Check whether any required option is missing
756756
$diff = array_diff_key($clone->required, $clone->defaults);
757757

758-
if (count($diff) > 0) {
758+
if (\count($diff) > 0) {
759759
ksort($diff);
760760

761761
throw new MissingOptionsException(sprintf(
762-
count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.',
762+
\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.',
763763
implode('", "', array_keys($diff))
764764
));
765765
}
@@ -858,7 +858,7 @@ public function offsetGet($option)
858858
foreach ($this->allowedTypes[$option] as $type) {
859859
$type = isset(self::$typeAliases[$type]) ? self::$typeAliases[$type] : $type;
860860

861-
if (function_exists($isFunction = 'is_'.$type)) {
861+
if (\function_exists($isFunction = 'is_'.$type)) {
862862
if ($isFunction($value)) {
863863
$valid = true;
864864
break;
@@ -914,7 +914,7 @@ public function offsetGet($option)
914914
$this->formatValue($value)
915915
);
916916

917-
if (count($printableAllowedValues) > 0) {
917+
if (\count($printableAllowedValues) > 0) {
918918
$message .= sprintf(
919919
' Accepted values are: %s.',
920920
$this->formatValues($printableAllowedValues)
@@ -1019,7 +1019,7 @@ public function count()
10191019
throw new AccessException('Counting is only supported within closures of lazy options and normalizers.');
10201020
}
10211021

1022-
return count($this->defaults);
1022+
return \count($this->defaults);
10231023
}
10241024

10251025
/**
@@ -1136,7 +1136,7 @@ public function isKnown($option)
11361136
*/
11371137
private function formatTypeOf($value)
11381138
{
1139-
return is_object($value) ? get_class($value) : gettype($value);
1139+
return \is_object($value) ? \get_class($value) : \gettype($value);
11401140
}
11411141

11421142
/**
@@ -1152,19 +1152,19 @@ private function formatTypeOf($value)
11521152
*/
11531153
private function formatValue($value)
11541154
{
1155-
if (is_object($value)) {
1156-
return get_class($value);
1155+
if (\is_object($value)) {
1156+
return \get_class($value);
11571157
}
11581158

1159-
if (is_array($value)) {
1159+
if (\is_array($value)) {
11601160
return 'array';
11611161
}
11621162

1163-
if (is_string($value)) {
1163+
if (\is_string($value)) {
11641164
return '"'.$value.'"';
11651165
}
11661166

1167-
if (is_resource($value)) {
1167+
if (\is_resource($value)) {
11681168
return 'resource';
11691169
}
11701170

Tests/OptionsResolver2Dot6Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,6 @@ public function testCountFailsOutsideResolve()
14901490
$this->resolver->setDefined('bar');
14911491
$this->resolver->setDefault('lazy1', function () {});
14921492

1493-
count($this->resolver);
1493+
\count($this->resolver);
14941494
}
14951495
}

0 commit comments

Comments
 (0)