Closed
Description
Symfony version(s) affected:
Both 4.x and 5.x
Description
Symfony cannot inject by default the Session
service because it's not mapped as a service, so we need to inject the SessionInterface
. However, PHP Stan
reports an error when calling getFlashBag()
Call to an undefined method Symfony\Component\HttpFoundation\Session\SessionInterface::getFlashBag().
How to reproduce
Inject the SessionInterface
and then call the getFlashBag()
method. Finally, run vendor/bin/phpstan analyse src -l 2
for a level 2
analysis, where we should get that error message.
Possible Solution
Define the getFlashBag()
method into the SessionInterface
.
Alternatively, maybe you can give another option to pass this error reported by PHP Stan without adding extra annotations to ignore these lines once after another when they are in use in several services.