Hi everyone.
I made some nice validtion middleware. I defined it in my container and everythnig works well while I add it as an application middleware:
$app->addMiddleware($container->get(ValidationMiddleware::class));
but the moment I try to add it as a rotute middleware:
$app->map(['GET', 'POST'], '/subscribe', function(Request $req, Response $resp) {
return $this->get(AuthenticationController::class)->subscribeCredential($req, $resp);
})->setName('authe.credentials.subscribe')
->addMiddleware($container->get(ValidationMiddleware::class));
I received some annoying error message:
PHP Fatal error: Cannot declare class Paneric\Validation\ValidationMiddleware, because the name is already in use in ValidationMiddleware.php (my class definition).
Any suggestion on “why” and “how” highly appreciated :).