diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache index 9bba236a758..9ab1ed336f9 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache @@ -116,14 +116,17 @@ class SlimRouter /** * Class constructor * - * @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings + * @param ContainerInterface|array $settings Either a ContainerInterface or an associative array of app settings * * @throws InvalidArgumentException When no container is provided that implements ContainerInterface * @throws Exception When implementation class doesn't exists */ - public function __construct($container = []) + public function __construct($settings = []) { - $this->slimApp = new App($container); + $this->slimApp = new App($settings); + + // middlewares requires Psr\Container\ContainerInterface + $container = $this->slimApp->getContainer(); {{#hasAuthMethods}} $authPackage = '{{authPackage}}'; diff --git a/samples/server/petstore/php-slim/lib/SlimRouter.php b/samples/server/petstore/php-slim/lib/SlimRouter.php index 4d30e8f40a8..94fc95ef8a3 100644 --- a/samples/server/petstore/php-slim/lib/SlimRouter.php +++ b/samples/server/petstore/php-slim/lib/SlimRouter.php @@ -577,14 +577,17 @@ class SlimRouter /** * Class constructor * - * @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings + * @param ContainerInterface|array $settings Either a ContainerInterface or an associative array of app settings * * @throws InvalidArgumentException When no container is provided that implements ContainerInterface * @throws Exception When implementation class doesn't exists */ - public function __construct($container = []) + public function __construct($settings = []) { - $this->slimApp = new App($container); + $this->slimApp = new App($settings); + + // middlewares requires Psr\Container\ContainerInterface + $container = $this->slimApp->getContainer(); $authPackage = 'OpenAPIServer\Auth'; $basicAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) {