Autowiring for constructors with not required parameters
Romashka opened this issue · 4 comments
Romashka commented
When service definition passes more arguments than required at constructor
Undefined offset: 3
/home/dev/projects/DefaultAutowire/src/DependencyInjection/Compiler/TurnOnAutowireCompilerPass.php:113
TomasVotruba commented
Thanks for reporting. Could you add service registration in yaml and the constructor, please?
Romashka commented
public function __construct(SomeService $someService, EventDispatcherInterface $eventDispatcher, $a = 1, $b = 2)
{
$this->someService = $someService;
$this->eventDispatcher = $eventDispatcher;
$this->a = $a;
$this->b = $b;
}
some_autowired_service:
class: Symplify\DefaultAutowire\Tests\Source\SomeAutowiredService
arguments:
- '@some_service'
- '@event_dispatcher'
- 1
TomasVotruba commented
Much better, thank you! Would you be able to add failing test with this service?
You could speed up the whole process and I would be able to fix this issue during the weekend then.
TomasVotruba commented
Fixed and released 1.0.1, thank you