|
8 | 8 | use PHPStan\Rules\Rule; |
9 | 9 | use PHPStan\ShouldNotHappenException; |
10 | 10 | use PHPStan\Type\ArrayType; |
11 | | -use PHPStan\Type\Constant\ConstantBooleanType; |
| 11 | +use PHPStan\Type\BooleanType; |
12 | 12 | use PHPStan\Type\Constant\ConstantIntegerType; |
13 | 13 | use PHPStan\Type\IntegerType; |
14 | 14 | use PHPStan\Type\MixedType; |
15 | 15 | use PHPStan\Type\NullType; |
16 | 16 | use PHPStan\Type\ObjectType; |
17 | 17 | use PHPStan\Type\StringType; |
18 | | -use PHPStan\Type\TypeCombinator; |
19 | 18 | use PHPStan\Type\TypeUtils; |
20 | 19 | use PHPStan\Type\UnionType; |
21 | 20 | use PHPStan\Type\VerbosityLevel; |
@@ -70,10 +69,7 @@ public function processNode(Node $node, Scope $scope): array |
70 | 69 |
|
71 | 70 | // not an array |
72 | 71 | if (($mode & 8) !== 8) { |
73 | | - $checkType = new UnionType([new StringType(), new IntegerType(), new NullType()]); |
74 | | - if (($mode & 4) === 4) { // https://symfony.com/doc/current/console/input.html#options-with-optional-arguments |
75 | | - $checkType = TypeCombinator::union($checkType, new ConstantBooleanType(false)); |
76 | | - } |
| 72 | + $checkType = new UnionType([new StringType(), new IntegerType(), new NullType(), new BooleanType()]); |
77 | 73 | if (!$checkType->isSuperTypeOf($defaultType)->yes()) { |
78 | 74 | return [sprintf('Parameter #5 $default of method Symfony\Component\Console\Command\Command::addOption() expects %s, %s given.', $checkType->describe(VerbosityLevel::typeOnly()), $defaultType->describe(VerbosityLevel::typeOnly()))]; |
79 | 75 | } |
|
0 commit comments