Symfony 3.3 services autoconfiguration
I had same error message, but caused by different bug. Maybe somebody will find this useful.
My initial config in service.yml was:
app.my_service: class: 'AppBundle\Service\MyService' arguments: $foobar: 'some value for foobar' public: true
And I was getting this error:
Cannot autowire service "AppBundle\Service\MyService": argument "$foobar" of method "__construct()" must have a type-hint or be given a value explicitly.
Then few hours later I found the solution:
AppBundle\Service\MyService: arguments: $foobar: 'some value for foobar'app.my_service: alias: AppBundle\Service\MyService public: true
So problem was in case that i was trying to use services.yml from AppBundle, if i understand right, old style of importing services from bundles doesn't work with autowiring/autoconfiguring because we need to rewrite load()
method from AppExtension
to use type hints. So i've replaced all my services to app/config/services.yml
and it helps me.