0

I am getting the fatal error below while posting the email and password for JWT Authentication in Slim3 using Postman. How can I solve this?

Fatal error: Uncaught Exception: The PHP-DI definition is not indexed by an entry name in the definition array in
C:\new_xampp\htdocs\project\vendor\php-di\php-di\src\Definition\Source\DefinitionArray.php:45

Stack trace:

0 C:\new_xampp\htdocs\project\vendor\php-di\php-di\src\ContainerBuilder.php(148):
DI\Definition\Source\DefinitionArray->__construct(Array, Object(DI\Definition\Source\ReflectionBasedAutowiring))

1 [internal function]: DI\ContainerBuilder->DI{closure}(Array)

2 C:\new_xampp\htdocs\project\vendor\php-di\php-di\src\ContainerBuilder.php(143): array_map(Object(Closure), Array)

3 C:\new_xampp\htdocs\project\public\index.php(33): DI\ContainerBuilder->build()

4 {main}
thrown in C:\new_xampp\htdocs\project\vendor\php-di\php-di\src\Definition\Source\DefinitionArray.php on line45
theduck
  • 2,589
  • 13
  • 17
  • 23

1 Answers1

0

Maybe a bit late for this, but for anyone facing the exact same error, the problem might be that in the definitions array the index key is missing. eg:

Wrong

$containerBuilder->addDefinitions(array(
  function(Container $container){
     //Code 
  }
));

Correct

$containerBuilder->addDefinitions(array(
  'myAwesomeClass' => function(Container $container){
     //Code 
  }
));