Closed
Description
Symfony version(s) affected: tested with 3.4 and 4.3
Description
If I define a synthetic service in my service.yaml config file where binds are already defined, I get the error
Invalid service "my_synthetic_service": class "" does not exist.
How to reproduce
- Create a new app:
symfony new my-app
- Add the service definition and the bind in
config/services.yaml
services:
_defaults:
# ...
bind:
$someBind: someValue
# ...
my_synthetic_service:
synthetic: true
public: true
- Run any console command
./bin/console debug:container my_synthetic_service
- Get the full error
Unused binding "$someBind" in service "my_synthetic_service".
Could be related to:
- Invalid service "my_synthetic_service": class "" does not exist.
This error is a little more understandable than the first one, but I have to try finding the minimal failing exemple to get this error
- Add some service that use the bind
<?php
namespace App\Service;
class SomeService
{
public function __construct(string $someBind) { }
}
- Re-run the console command
- Get the minimal error
Invalid service "my_synthetic_service": class "" does not exist.
This error is way worse to debug the real problem