Because the Symfony\Component\Console\Style\SymfonyStyle is a real class, the ReflectionContainer tries to instantiate it and fails. Anyway this is undesirable behavior - the register method uses 1st argument as an array key.
I propose to wrap these arguments (SymfonyStyle & ConsoleIO) in \League\Container\Argument\Literal\StringArgument objects. This way a container delegation works as expected.
Steps to reproduce
I created the following executable file and ran it in terminal without any arguments:
Expected behavior
I expected to get the standard output, kind of:
Actual behavior
Instead I get the fatal error:
System Configuration
Linux, PHP 8.2.0, robo 4.0.3, league/container 4.2.0.
Proposed solution
There is a code in
\Robo\Robo::configureContainer
:Because the
Symfony\Component\Console\Style\SymfonyStyle
is a real class, the ReflectionContainer tries to instantiate it and fails. Anyway this is undesirable behavior - theregister
method uses 1st argument as an array key.I propose to wrap these arguments (SymfonyStyle & ConsoleIO) in
\League\Container\Argument\Literal\StringArgument
objects. This way a container delegation works as expected.