I think you are confusing the ParameterBag class from DependencyInjection and the one in HttpFoundation. There are totally different.