Symfony 6 InputBag Stub
Related: https://github.com/psalm/psalm-plugin-symfony/pull/235
The changes to the InputBag sub is causing the following error:
ERROR: InvalidArgument - src/Controller/TestController.php:154:132 - Argument 2 of Symfony\Component\HttpFoundation\InputBag::get cannot be false, null|string value expected (see https://psalm.dev/004)
return (bool)$request->query->get('inline', false);
It looks like @psalm-param D $default is thinking D is null|string where the line above is setting more types. If I replace D with the full string|int|float|bool|null it functions as expected.
Also, it looks like there's duplication going on. null can likely be added to T and D can be removed completely
It looks like if I set the template on the function, rather than the class, it works as expected. Potentially this is a bug with Psalm itself.
@natewiebe13 thanks for the report.
Instead of return (bool)$request->query->get('inline', false); the following should be used:
return $request->query->getBoolean('inline', false);