Skip to content

Commit 0e4fd93

Browse files
Merge branch '4.1'
* 4.1: Fix Clidumper tests Enable the fixer enforcing fully-qualified calls for compiler-optimized functions Apply fixers Disable the native_constant_invocation fixer until it can be scoped Update the list of excluded files for the CS fixer
2 parents 433e2f9 + 1913f19 commit 0e4fd93

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

Debug/OptionsResolverIntrospector.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(OptionsResolver $optionsResolver)
4747
*/
4848
public function getDefault(string $option)
4949
{
50-
return call_user_func($this->get, 'defaults', $option, sprintf('No default value was set for the "%s" option.', $option));
50+
return \call_user_func($this->get, 'defaults', $option, sprintf('No default value was set for the "%s" option.', $option));
5151
}
5252

5353
/**
@@ -57,7 +57,7 @@ public function getDefault(string $option)
5757
*/
5858
public function getLazyClosures(string $option): array
5959
{
60-
return call_user_func($this->get, 'lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option));
60+
return \call_user_func($this->get, 'lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option));
6161
}
6262

6363
/**
@@ -67,7 +67,7 @@ public function getLazyClosures(string $option): array
6767
*/
6868
public function getAllowedTypes(string $option): array
6969
{
70-
return call_user_func($this->get, 'allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option));
70+
return \call_user_func($this->get, 'allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option));
7171
}
7272

7373
/**
@@ -77,14 +77,14 @@ public function getAllowedTypes(string $option): array
7777
*/
7878
public function getAllowedValues(string $option): array
7979
{
80-
return call_user_func($this->get, 'allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option));
80+
return \call_user_func($this->get, 'allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option));
8181
}
8282

8383
/**
8484
* @throws NoConfigurationException on no configured normalizer
8585
*/
8686
public function getNormalizer(string $option): \Closure
8787
{
88-
return call_user_func($this->get, 'normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option));
88+
return \call_user_func($this->get, 'normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option));
8989
}
9090
}

OptionsResolver.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ public function addAllowedValues($option, $allowedValues)
535535
));
536536
}
537537

538-
if (!is_array($allowedValues)) {
538+
if (!\is_array($allowedValues)) {
539539
$allowedValues = array($allowedValues);
540540
}
541541

@@ -718,12 +718,12 @@ public function resolve(array $options = array())
718718
// Make sure that no unknown options are passed
719719
$diff = array_diff_key($options, $clone->defined);
720720

721-
if (count($diff) > 0) {
721+
if (\count($diff) > 0) {
722722
ksort($clone->defined);
723723
ksort($diff);
724724

725725
throw new UndefinedOptionsException(sprintf(
726-
(count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".',
726+
(\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".',
727727
implode('", "', array_keys($diff)),
728728
implode('", "', array_keys($clone->defined))
729729
));
@@ -738,11 +738,11 @@ public function resolve(array $options = array())
738738
// Check whether any required option is missing
739739
$diff = array_diff_key($clone->required, $clone->defaults);
740740

741-
if (count($diff) > 0) {
741+
if (\count($diff) > 0) {
742742
ksort($diff);
743743

744744
throw new MissingOptionsException(sprintf(
745-
count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.',
745+
\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.',
746746
implode('", "', array_keys($diff))
747747
));
748748
}
@@ -882,7 +882,7 @@ public function offsetGet($option)
882882
$this->formatValue($value)
883883
);
884884

885-
if (count($printableAllowedValues) > 0) {
885+
if (\count($printableAllowedValues) > 0) {
886886
$message .= sprintf(
887887
' Accepted values are: %s.',
888888
$this->formatValues($printableAllowedValues)
@@ -1049,7 +1049,7 @@ public function count()
10491049
throw new AccessException('Counting is only supported within closures of lazy options and normalizers.');
10501050
}
10511051

1052-
return count($this->defaults);
1052+
return \count($this->defaults);
10531053
}
10541054

10551055
/**
@@ -1088,7 +1088,7 @@ private function formatTypeOf($value, ?string $type): string
10881088
}
10891089
}
10901090

1091-
return (\is_object($value) ? get_class($value) : gettype($value)).$suffix;
1091+
return (\is_object($value) ? \get_class($value) : \gettype($value)).$suffix;
10921092
}
10931093

10941094
/**
@@ -1103,7 +1103,7 @@ private function formatTypeOf($value, ?string $type): string
11031103
private function formatValue($value): string
11041104
{
11051105
if (\is_object($value)) {
1106-
return get_class($value);
1106+
return \get_class($value);
11071107
}
11081108

11091109
if (\is_array($value)) {
@@ -1152,7 +1152,7 @@ private function formatValues(array $values): string
11521152

11531153
private static function isValueValidType(string $type, $value): bool
11541154
{
1155-
return (function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type;
1155+
return (\function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type;
11561156
}
11571157

11581158
private function getInvalidValues(array $arrayValues, string $type): array

Tests/OptionsResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ public function testCountFailsOutsideResolve()
17651765
$this->resolver->setDefined('bar');
17661766
$this->resolver->setDefault('lazy1', function () {});
17671767

1768-
count($this->resolver);
1768+
\count($this->resolver);
17691769
}
17701770

17711771
public function testNestedArrays()

0 commit comments

Comments
 (0)