Skip to content

Commit

Permalink
Fixed nullability of authenticator (#290)
Browse files Browse the repository at this point in the history
* Fixed nullability of authenticator

* Fixed Psalm error

* Fixed Psalm error
  • Loading branch information
davidbyoung committed Aug 19, 2023
1 parent cfe2101 commit a02a992
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/Framework/src/Api/Testing/IntegrationTest.php
Expand Up @@ -123,12 +123,15 @@ protected function createApiGateway(IContainer $container): IRequestHandler
* Creates the authenticator
*
* @param IContainer $container The DI container
* @return IAuthenticator The authenticator
* @throws ResolutionException Thrown if the authenticator could not be resolved
* @return IAuthenticator|IMockAuthenticator|null The authenticator if one could be created, otherwise null
*/
protected function createAuthenticator(IContainer $container): IAuthenticator
protected function createAuthenticator(IContainer $container): IAuthenticator|IMockAuthenticator|null
{
return $container->resolve(IAuthenticator::class);
/** @var IAuthenticator|IMockAuthenticator|null $authenticator */
$authenticator = null;
$container->tryResolve(IAuthenticator::class, $authenticator);

return $authenticator;
}

/**
Expand Down
Expand Up @@ -178,7 +178,7 @@ protected function createApplication(IContainer $container): IApplication
return $this->app;
}

protected function createAuthenticator(IContainer $container): IAuthenticator
protected function createAuthenticator(IContainer $container): IAuthenticator|IMockAuthenticator|null
{
if ($this->authenticator === null) {
throw new LogicException('The authenticator was not set in the integration test');
Expand Down

0 comments on commit a02a992

Please sign in to comment.