Following the execution of Psalm, here is the error generated :
ERROR: TypeDoesNotContainType - src/Contoller/MyController.php:150:10 - Type string for $param is never bool (see https://psalm.dev/056)
assert(is_bool($param));
The problem is that it tells me that the type of $param is string, but I declared it as a boolean.
My goal is to delete my assert, and for Psalm to correctly detect the type.
I inspected the code, the ParameterBagHandler handler is loaded correctly.
Only in my App_KernelDevDebugContainer.xml, my parameter is in this format:
In the handler ParameterBagHandler, the parameter type is tested with the gettype method, which does not work because the environment variables are not resolved, and the result is the same as stated in the configuration file.
Hello
I am faced with a parameter typing problem arising from the bag parameter.
I declared a boolean type parameter in the
parameters.yaml
file :Below, the code from a controller which aims to retrieve a parameter :
Following the execution of Psalm, here is the error generated :
The problem is that it tells me that the type of
$param
is string, but I declared it as a boolean. My goal is to delete my assert, and for Psalm to correctly detect the type. I inspected the code, theParameterBagHandler
handler is loaded correctly. Only in myApp_KernelDevDebugContainer.xml
, my parameter is in this format:In the handler
ParameterBagHandler
, the parameter type is tested with thegettype
method, which does not work because the environment variables are not resolved, and the result is the same as stated in the configuration file.What is tested is:
instead of :
If it helps, here is my Psalm setup:
Do you have any idea, I'm doing something wrong ? Thanks