[Slim] Fix AbstractAuthenticator constructor TypeError (#2641)

* Fix AbstractAuthenticator  constructor TypeError

* Refresh samples

* Remove container argument reassign

* Refresh samples
This commit is contained in:
Yuriy Belenko 2019-04-13 21:03:12 +05:00 committed by William Cheng
parent 687b5aabf3
commit c88b0a10b7
2 changed files with 12 additions and 6 deletions

View File

@ -116,14 +116,17 @@ class SlimRouter
/** /**
* Class constructor * 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 InvalidArgumentException When no container is provided that implements ContainerInterface
* @throws Exception When implementation class doesn't exists * @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}} {{#hasAuthMethods}}
$authPackage = '{{authPackage}}'; $authPackage = '{{authPackage}}';

View File

@ -577,14 +577,17 @@ class SlimRouter
/** /**
* Class constructor * 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 InvalidArgumentException When no container is provided that implements ContainerInterface
* @throws Exception When implementation class doesn't exists * @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'; $authPackage = 'OpenAPIServer\Auth';
$basicAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) { $basicAuthenticator = function (ServerRequestInterface &$request, TokenSearch $tokenSearch) use ($authPackage) {