Skip to content

Commit f7d5782

Browse files
VincentLangletondrejmirtes
authored andcommitted
Fix InputBagTypeSpecifyingExtension
1 parent 51ab243 commit f7d5782

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Type/Symfony/InputBagTypeSpecifyingExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getClass(): string
3030

3131
public function isMethodSupported(MethodReflection $methodReflection, MethodCall $node, TypeSpecifierContext $context): bool
3232
{
33-
return $methodReflection->getName() === self::HAS_METHOD_NAME && !$context->null();
33+
return $methodReflection->getName() === self::HAS_METHOD_NAME && $context->false();
3434
}
3535

3636
public function specifyTypes(MethodReflection $methodReflection, MethodCall $node, Scope $scope, TypeSpecifierContext $context): SpecifiedTypes

tests/Type/Symfony/data/input_bag.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
assertType('bool|float|int|string|null', $bag->get('foo'));
88

99
if ($bag->has('foo')) {
10-
assertType('bool|float|int|string', $bag->get('foo'));
10+
// Because `has` rely on `array_key_exists` we can still have set the NULL value.
11+
assertType('bool|float|int|string|null', $bag->get('foo'));
1112
assertType('bool|float|int|string|null', $bag->get('bar'));
1213
} else {
1314
assertType('null', $bag->get('foo'));

0 commit comments

Comments
 (0)