8000 litle code style fix · symfony/symfony@22b87b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 22b87b6

Browse files
committed
litle code style fix
1 parent 2fcf19e commit 22b87b6

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

src/Symfony/Component/OptionsResolver/OptionsResolver.php

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public function setAllowedValues($option, $allowedValues)
433433
));
434434
}
435435

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

438438
// Make sure the option is processed
439439
unset($this->resolved[$option]);
@@ -877,7 +877,7 @@ public function offsetGet($option)
877877
*/
878878
private function verifyTypes($type, $value, array &$invalidTypes)
879879
{
880-
if ('[]' === substr($type, -2) && is_array($value)) {
880+
if (\is_array($value) && '[]' === substr($type, -2)) {
881881
if ($this->verifyArrayType($type, $value, $invalidTypes, $type)) {
882882
return true;
883883
}
@@ -905,10 +905,6 @@ private function verifyTypes($type, $value, array &$invalidTypes)
905905
}
906906

907907
/**
908-
* @param $type
909-
* @param array $value
910-
* @param array $invalidTypes
911-
*
912908
* @return bool
913909
*/
914910
private function verifyArrayType($type, array $value, array &$invalidTypes)
@@ -918,7 +914,7 @@ private function verifyArrayType($type, array $value, array &$invalidTypes)
918914
if ('[]' === substr($type, -2)) {
919915
$success = true;
920916
foreach ($value as $item) {
921-
if (!is_array($item)) {
917+
if (!\is_array($item)) {
922918
$invalidTypes[$this->formatTypeOf($item, null)] = true;
923919

924920
return false;
@@ -932,9 +928,7 @@ private function verifyArrayType($type, array $value, array &$invalidTypes)
932928
return $success;
933929
}
934930

935-
$invalid = $this->getInvalidValues($value, $type);
936-
937-
return !count($invalid);
931+
return !$this->getInvalidValues($value, $type);
938932
}
939933

940934
/**
@@ -1020,13 +1014,13 @@ private function formatTypeOf($value, $type)
10201014
while ('[]' === substr($type, -2)) {
10211015
$type = substr($type, 0, -2);
10221016
$value = array_shift($value);
1023-
if (!is_array($value)) {
1017+
if (!\is_array($value)) {
10241018
break;
10251019
}
10261020
$suffix .= '[]';
10271021
}
10281022

1029-
if (is_array($value)) {
1023+
if (\is_array($value)) {
10301024
$subTypes = array();
10311025
foreach ($value as $val) {
10321026
$subTypes[$this->formatTypeOf($val, null)] = true;
@@ -1036,7 +1030,7 @@ private function formatTypeOf($value, $type)
10361030
}
10371031
}
10381032

1039-
return (is_object($value) ? get_class($value) : gettype($value)).$suffix;
1033+
return (\is_object($value) ? get_class($value) : gettype($value)).$suffix;
10401034
}
10411035

10421036
/**
@@ -1052,19 +1046,19 @@ private function formatTypeOf($value, $type)
10521046
*/
10531047
private function formatValue($value)
10541048
{
1055-
if (is_object($value)) {
1049+
if (\is_object($value)) {
10561050
return get_class($value);
10571051
}
10581052

1059-
if (is_array($value)) {
1053+
if (\is_array($value)) {
10601054
return 'array';
10611055
}
10621056

1063-
if (is_string($value)) {
1057+
if (\is_string($value)) {
10641058
return '"'.$value.'"';
10651059
}
10661060

1067-
if (is_resource($value)) {
1061+
if (\is_resource($value)) {
10681062
return 'resource';
10691063
}
10701064

@@ -1110,8 +1104,6 @@ private static function isValueValidType($type, $value)
11101104
}
11111105

11121106
/**
1113-
* @param array $arrayValues
1114-
*
11151107
* @return array
11161108
*/
11171109
private function getInvalidValues(array $arrayValues, $type)

0 commit comments

Comments
 (0)
0