With the manual strategy you have to indicate the application what is the dependency tree between classes.
This method only takes the name of the class as parameter when the class has no dependencies.
However, when the instantiation is more complex it takes a method as second parameters that pass as parameter the definition of the class.
Inside that function you can use the container to get dependencies and pass them to the class as following:
class Provider extends AbstractServiceProvider {
public function define() {
$this->register_service(MyClass::class, function($defintion) {
$definition->addArgument($this->getContainer()->get(MyDependency::class));
});
}
}
To define the type from we need to register subscribers in the method matching the right type: