-
Notifications
You must be signed in to change notification settings - Fork 95
Closed
@raalderink
Description
If you use HTTPFoundation's Request, and then get specific input bags (query/request,...), the get may return string|null. However, if you pass parameter #2 $default as non-null value, it will never return null, and always a string.
So for example this code can never return null;
$request->query->get('name', 'default value');
Currently, because the typehint on the function is string|null, PHPStan will complain if you pass this to a function with a non-null argument, even though it will never return null;
Parameter #2 $name of class Foo constructor expects string, string|null given
This is tested on Symfony 5.1.
Metadata
Metadata
Assignees
Labels
No labels