0

i'm having problems registering a factory causing a strange behaviour.

When my dependency is resolved by the factory function i can see (by testing..), that actually only the constructor is called, nothing more.

Here's the factory function + DI definition:

AuthStrategySelectorInterface::class => function (ContainerInterface $container): AuthStrategySelector {
    $authStrategySelector = new AuthStrategySelector();
    $authStrategySelector
      ->register($container->get(JwtAuthStrategy::class));
    return $authStrategySelector;
  }

And heres the behaviour i can see, but i don't understand: It seems like the register-function never gets called.. I also confirmed that by just writing something like die('test'); behind the instantiation of $authStrategySelector.

I can't see any error inside the logs, etc. and i wrapped my head around that problem since like 2 hours..

And i tested every other involved component like the AuthStrategy, which is even empty for testing..

mademyday
  • 83
  • 2
  • 9
  • Did you declared AuthStrategySelectorInterface as dependency in a class constructor? – odan Jan 04 '22 at 07:46
  • Yeah, i‘m currently writing test cases which actually work for the same di container. I‘m really clueless :/.. – mademyday Jan 04 '22 at 08:42

0 Answers0