diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index 2e5be59b..434bad3b 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -14,7 +14,7 @@ jobs: php-version: '7.4' coverage: 'none' extensions: 'json, mbstring, tokenizer' - tools: 'composer-normalize, php-cs-fixer:2.16.4' + tools: 'composer-normalize, php-cs-fixer:3.10.0' env: update: true @@ -24,7 +24,7 @@ jobs: php-cs-fixer --version - name: 'Check PHP code' - run: 'php-cs-fixer fix --diff --dry-run --using-cache=false' + run: 'php-cs-fixer fix --diff --dry-run --using-cache=no --config=.php-cs-fixer.dist-php' - name: 'Check composer.json' run: 'composer-normalize --diff --dry-run --no-update-lock' @@ -58,17 +58,14 @@ jobs: name: 'Unit Tests' strategy: matrix: - php: - - '7.2' - - '7.3' - - '7.4' - - '8.0' dependencies: - - 'lowest' - 'highest' - 'beta' include: - dependencies: 'beta' + symfony_version: + - 5.3 + - 5.4 env: SYMFONY_VERSION: '${{ matrix.symfony_version }}' steps: @@ -78,7 +75,7 @@ jobs: - name: 'Setup PHP' uses: 'shivammathur/setup-php@v2' with: - php-version: '${{ matrix.php }}' + php-version: '7.4' coverage: 'none' tools: 'composer:2' extensions: 'mongodb' @@ -90,7 +87,7 @@ jobs: - run: | if [ "${{ matrix.dependencies }}" = "beta" ]; then make composer-config-beta; fi; - - run: 'composer rem symfony/form -n --no-update && composer req "symfony/form: ^4.4 || ^5.1" doctrine/annotations --no-update -n' + - run: 'composer rem symfony/form -n --no-update && composer req "symfony/form: ^5.3 || ^6.0" doctrine/annotations --no-update -n' - uses: 'ramsey/composer-install@v2' with: diff --git a/.gitignore b/.gitignore index b1a9bef1..f69bf23f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ Propel/map/ composer.lock .php_cs.cache .phpunit.result.cache +.php-cs-fixer.php diff --git a/.php_cs.dist b/.php-cs-fixer.dist-php similarity index 80% rename from .php_cs.dist rename to .php-cs-fixer.dist-php index cd8261a0..8e3f83ad 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist-php @@ -18,11 +18,11 @@ For the full copyright and license information, please view the LICENSE file that was distributed with this source code. EOF; -$finder = PhpCsFixer\Finder::create() +$finder = (new PhpCsFixer\Finder()) ->exclude('vendor') ->in(__DIR__); -return PhpCsFixer\Config::create() +return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) ->setUsingCache(false) ->setRules( @@ -33,16 +33,16 @@ return PhpCsFixer\Config::create() 'combine_consecutive_unsets' => true, 'declare_strict_types' => true, 'dir_constant' => true, - 'general_phpdoc_annotation_remove' => ['@author'], + 'echo_tag_syntax' => ['format' => 'long'], + 'general_phpdoc_annotation_remove' => ['annotations' => ['@author']], 'header_comment' => ['header' => $header], 'linebreak_after_opening_tag' => true, 'mb_str_functions' => true, 'modernize_types_casting' => true, // 'native_function_invocation' => true, - 'no_extra_consecutive_blank_lines' => ['continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'], 'multiline_whitespace_before_semicolons' => ['strategy' => 'new_line_for_chained_calls'], + 'no_extra_blank_lines' => ['tokens' => ['continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']], 'no_php4_constructor' => true, - 'no_short_echo_tag' => true, 'no_unreachable_default_argument_value' => true, 'no_useless_else' => true, 'no_useless_return' => true, @@ -54,11 +54,12 @@ return PhpCsFixer\Config::create() 'php_unit_strict' => true, 'phpdoc_add_missing_param_annotation' => true, 'phpdoc_annotation_without_dot' => true, - 'phpdoc_inline_tag' => false, 'phpdoc_no_empty_return' => false, 'phpdoc_order' => true, + // phpdoc tag defaults are annotation + // see https://cs.symfony.com/doc/rules/phpdoc/phpdoc_tag_type.html + // 'phpdoc_tag_type' => [], 'phpdoc_to_comment' => false, - 'psr4' => true, 'random_api_migration' => true, 'semicolon_after_instruction' => true, 'single_import_per_statement' => true, diff --git a/DependencyInjection/FOSOAuthServerExtension.php b/DependencyInjection/FOSOAuthServerExtension.php index 92773af5..74c016cd 100644 --- a/DependencyInjection/FOSOAuthServerExtension.php +++ b/DependencyInjection/FOSOAuthServerExtension.php @@ -78,7 +78,7 @@ public function load(array $configs, ContainerBuilder $container) } else { $container->setAlias('fos_oauth_server.document_manager', new Alias( sprintf('doctrine.odm.%s_mongodb.document_manager', - $config['model_manager_name']), + $config['model_manager_name']), false )); } diff --git a/DependencyInjection/Security/Factory/OAuthFactory.php b/DependencyInjection/Security/Factory/OAuthFactory.php index c638bcc3..e97ac786 100644 --- a/DependencyInjection/Security/Factory/OAuthFactory.php +++ b/DependencyInjection/Security/Factory/OAuthFactory.php @@ -13,6 +13,7 @@ namespace FOS\OAuthServerBundle\DependencyInjection\Security\Factory; +use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface; use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\DependencyInjection\ChildDefinition; @@ -24,8 +25,24 @@ * * @author Arnaud Le Blanc */ -class OAuthFactory implements SecurityFactoryInterface +class OAuthFactory implements AuthenticatorFactoryInterface, SecurityFactoryInterface { + /** + * {@inheritdoc} + */ + public function createAuthenticator(ContainerBuilder $container, string $id, array $config, string $userProviderId) + { + $providerId = 'fos_oauth_server.security.authentication.authenticator.'.$id; + $container + ->setDefinition($providerId, new ChildDefinition('fos_oauth_server.security.authentication.authenticator')) + ->replaceArgument(0, new Reference('fos_oauth_server.server')) + ->replaceArgument(1, new Reference('security.user_checker.'.$id)) + ->replaceArgument(2, new Reference($userProviderId)) + ; + + return $providerId; + } + /** * {@inheritdoc} */ diff --git a/Makefile b/Makefile index ff405a34..99c12e9c 100644 --- a/Makefile +++ b/Makefile @@ -12,18 +12,29 @@ cs: sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --diff" cs-full: - sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --using-cache=false --diff" + if [ ! -f .php-cs-fixer.php ]; then cp .php-cs-fixer.dist-php .php-cs-fixer.php; fi + sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --using-cache=no --diff" cs-full-check: - sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --using-cache=false --diff --dry-run" + if [ ! -f .php-cs-fixer.php ]; then cp .php-cs-fixer.dist-php .php-cs-fixer.php; fi + sh -c "${QA_DOCKER_COMMAND} php-cs-fixer fix -vvv --using-cache=no --diff --dry-run" composer-compat: composer config "platform.ext-mongo" "1.6.16" + composer config --no-plugins allow-plugins.symfony/runtime true composer require alcaeus/mongo-php-adapter --no-update composer-config-beta: composer config "minimum-stability" "beta" +composer-php7: + # when php 7 and 8 are both installed, to test with php7 - for example: + # $ make composer-compat + # $ make composer-php7 + # $ SYMFONY_VERSION=5.3 make composer-install + # $ php7.4 vendor/bin/phpunit + composer config platform.php 7.4 + composer-install: rm -f composer.lock && cp composer.json composer.json~ ifdef SYMFONY_VERSION diff --git a/Resources/config/security.xml b/Resources/config/security.xml index ff0aae12..d2961b6d 100644 --- a/Resources/config/security.xml +++ b/Resources/config/security.xml @@ -5,12 +5,19 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + FOS\OAuthServerBundle\Security\Authentication\Authenticator\OAuthAuthenticator FOS\OAuthServerBundle\Security\Authentication\Provider\OAuthProvider FOS\OAuthServerBundle\Security\Firewall\OAuthListener FOS\OAuthServerBundle\Security\EntryPoint\OAuthEntryPoint + + + + + + diff --git a/Security/Authentication/Authenticator/OAuthAuthenticator.php b/Security/Authentication/Authenticator/OAuthAuthenticator.php new file mode 100644 index 00000000..e82c5c4b --- /dev/null +++ b/Security/Authentication/Authenticator/OAuthAuthenticator.php @@ -0,0 +1,181 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\OAuthServerBundle\Security\Authentication\Authenticator; + +use FOS\OAuthServerBundle\Security\Authentication\Passport\OAuthCredentials; +use FOS\OAuthServerBundle\Security\Authentication\Token\OAuthToken; +use OAuth2\OAuth2; +use OAuth2\OAuth2AuthenticateException; +use OAuth2\OAuth2ServerException; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Exception\AccountStatusException; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; +use Symfony\Component\Security\Http\Authenticator\Passport\PassportInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\UserPassportInterface; + +/** + * OAuthAuthenticator class. + * + * @author Israel J. Carberry + */ +class OAuthAuthenticator implements AuthenticatorInterface +{ + /** + * @var OAuth2 + */ + protected $serverService; + + /** + * @var UserCheckerInterface + */ + protected $userChecker; + + /** + * @var UserProviderInterface + */ + protected $userProvider; + + public function __construct( + OAuth2 $serverService, + UserCheckerInterface $userChecker, + UserProviderInterface $userProvider + ) { + $this->serverService = $serverService; + $this->userChecker = $userChecker; + $this->userProvider = $userProvider; + } + + /** + * {@inheritdoc} + */ + public function authenticate(Request $request): UserPassportInterface + { + // remove the authorization header from the request on this check + $tokenString = $this->serverService->getBearerToken($request, true); + $accessToken = $scope = $user = $username = null; + + try { + $accessToken = $this->serverService->verifyAccessToken($tokenString); + $scope = $accessToken->getScope(); + $user = $accessToken->getUser(); + // allow for dependency on deprecated getUsername method + $username = $user instanceof UserInterface + ? (method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername()) + : null + ; + } catch (OAuth2AuthenticateException $e) { + // do nothing - credentials will remain unresolved below + } + + // configure the passport badges, ensuring requisite string types + $userBadge = new UserBadge($username ?? ''); + $credentials = new OAuthCredentials($tokenString ?? '', $scope ?? ''); + + // check the user if not null + if ($user instanceof UserInterface) { + try { + $this->userChecker->checkPreAuth($user); + + // mark the credentials as resolved + $credentials->markResolved(); + } catch (AccountStatusException $e) { + // do nothing - credentials remain unresolved + } + } + + // passport will only be valid if all badges are resolved (user badge + // is always resolved, credentials badge if passing the above check) + return new Passport($userBadge, $credentials); + } + + /** + * {@inheritdoc} + */ + public function createAuthenticatedToken(PassportInterface $passport, string $firewallName): TokenInterface + { + try { + // expect the badges in the passport from authenticate method above + if (!$passport->hasBadge(OAuthCredentials::class) + || !$passport->hasBadge(UserBadge::class) + ) { + throw new OAuth2AuthenticateException((string) Response::HTTP_UNAUTHORIZED, OAuth2::TOKEN_TYPE_BEARER, $this->serverService->getVariable(OAuth2::CONFIG_WWW_REALM), 'access_denied', 'Unexpected credentials type.'); + } + + // get the passport badges + $credentials = $passport->getBadge(OAuthCredentials::class); + $user = $this->userProvider->loadUserByIdentifier( + $passport->getBadge(UserBadge::class)->getUserIdentifier() + ); + + // check the user + try { + $this->userChecker->checkPostAuth($user); + } catch (AccountStatusException $e) { + throw new OAuth2AuthenticateException((string) Response::HTTP_UNAUTHORIZED, OAuth2::TOKEN_TYPE_BEARER, $this->serverService->getVariable(OAuth2::CONFIG_WWW_REALM), 'access_denied', $e->getMessage()); + } + } catch (OAuth2ServerException $e) { + throw new AuthenticationException('OAuth2 authentication failed', 0, $e); + } + + $token = new OAuthToken($credentials->getRoles($user)); + $token->setAuthenticated(true); + $token->setToken($credentials->getTokenString()); + $token->setUser($user); + + return $token; + } + + /** + * {@inheritdoc} + */ + public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response + { + return null; + } + + /** + * {@inheritdoc} + */ + public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response + { + $responseException = new OAuth2AuthenticateException( + (string) Response::HTTP_UNAUTHORIZED, + OAuth2::TOKEN_TYPE_BEARER, + $this->serverService->getVariable(OAuth2::CONFIG_WWW_REALM), + 'access_denied', + $exception->getMessage() + ); + + return $responseException->getHttpResponse(); + } + + /** + * {@inheritdoc} + */ + public function supports(Request $request): ?bool + { + // do not remove the authorization header from the request on this check + $tokenString = $this->serverService->getBearerToken($request); + + return is_string($tokenString) && !empty($tokenString); + } +} diff --git a/Security/Authentication/Passport/OAuthCredentials.php b/Security/Authentication/Passport/OAuthCredentials.php new file mode 100644 index 00000000..0444a64f --- /dev/null +++ b/Security/Authentication/Passport/OAuthCredentials.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\OAuthServerBundle\Security\Authentication\Passport; + +use Symfony\Component\Security\Core\User\UserInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\CredentialsInterface; + +/** + * Implements credentials checking for an OAuth token. + * + * @author Israel J. Carberry + * + * @final + */ +class OAuthCredentials implements CredentialsInterface +{ + /** + * @var bool + */ + private $resolved = false; + + /** + * @var string + */ + private $scope; + + /** + * @var string + */ + private $tokenString; + + public function __construct(string $tokenString, string $scope) + { + $this->tokenString = $tokenString; + $this->scope = $scope; + } + + public function getRoles(UserInterface $user): array + { + $roles = $user->getRoles(); + + if (empty($this->scope)) { + return $roles; + } + + foreach (explode(' ', $this->scope) as $role) { + $roles[] = 'ROLE_'.mb_strtoupper($role); + } + + return array_unique($roles, SORT_REGULAR); + } + + public function getTokenString(): ?string + { + return $this->tokenString; + } + + public function markResolved(): void + { + $this->resolved = true; + } + + public function isResolved(): bool + { + return $this->resolved; + } +} diff --git a/Storage/OAuthStorage.php b/Storage/OAuthStorage.php index 5ab6b7c9..5ead512b 100644 --- a/Storage/OAuthStorage.php +++ b/Storage/OAuthStorage.php @@ -152,7 +152,7 @@ public function checkUserCredentials(IOAuth2Client $client, $username, $password } try { - $user = $this->userProvider->loadUserByUsername($username); + $user = $this->userProvider->loadUserByIdentifier($username); } catch (AuthenticationException $e) { return false; } diff --git a/Tests/Controller/AuthorizeControllerTest.php b/Tests/Controller/AuthorizeControllerTest.php index 04d2319a..d155f4d4 100644 --- a/Tests/Controller/AuthorizeControllerTest.php +++ b/Tests/Controller/AuthorizeControllerTest.php @@ -236,13 +236,13 @@ public function testAuthorizeActionWillThrowAccessDeniedException(): void ; $this->tokenStorage - ->expects($this->at(0)) + ->expects($this->once()) ->method('getToken') ->willReturn($token) ; $token - ->expects($this->at(0)) + ->expects($this->once()) ->method('getUser') ->willReturn(null) ; @@ -261,19 +261,19 @@ public function testAuthorizeActionWillRenderTemplate(): void ; $this->tokenStorage - ->expects($this->at(0)) + ->expects($this->once()) ->method('getToken') ->willReturn($token) ; $token - ->expects($this->at(0)) + ->expects($this->once()) ->method('getUser') ->willReturn($this->user) ; $this->session - ->expects($this->at(0)) + ->expects($this->once()) ->method('get') ->with('_fos_oauth_server.ensure_logout') ->willReturn(false) @@ -297,14 +297,14 @@ public function testAuthorizeActionWillRenderTemplate(): void ; $this->authorizeFormHandler - ->expects($this->at(0)) + ->expects($this->once()) ->method('process') ->with() ->willReturn(false) ; $this->form - ->expects($this->at(0)) + ->expects($this->once()) ->method('createView') ->willReturn($this->formView) ; @@ -333,19 +333,19 @@ public function testAuthorizeActionWillFinishClientAuthorization(): void ; $this->tokenStorage - ->expects($this->at(0)) + ->expects($this->once()) ->method('getToken') ->willReturn($token) ; $token - ->expects($this->at(0)) + ->expects($this->once()) ->method('getUser') ->willReturn($this->user) ; $this->session - ->expects($this->at(0)) + ->expects($this->once()) ->method('get') ->with('_fos_oauth_server.ensure_logout') ->willReturn(false) @@ -371,7 +371,7 @@ public function testAuthorizeActionWillFinishClientAuthorization(): void $randomScope = 'scope'.\random_bytes(10); $this->request - ->expects($this->at(0)) + ->expects($this->once()) ->method('get') ->with('scope', null) ->willReturn($randomScope) @@ -380,7 +380,7 @@ public function testAuthorizeActionWillFinishClientAuthorization(): void $response = new Response(); $this->oAuth2Server - ->expects($this->at(0)) + ->expects($this->once()) ->method('finishClientAuthorization') ->with( true, @@ -402,33 +402,33 @@ public function testAuthorizeActionWillEnsureLogout(): void ; $this->tokenStorage - ->expects($this->at(0)) + ->expects($this->once()) ->method('getToken') ->willReturn($token) ; $token - ->expects($this->at(0)) + ->expects($this->once()) ->method('getUser') ->willReturn($this->user) ; $this->session - ->expects($this->at(0)) + ->expects($this->once()) ->method('get') ->with('_fos_oauth_server.ensure_logout') ->willReturn(true) ; $this->session - ->expects($this->at(1)) + ->expects($this->once()) ->method('invalidate') ->with(600) ->willReturn(true) ; $this->session - ->expects($this->at(2)) + ->expects($this->once()) ->method('set') ->with('_fos_oauth_server.ensure_logout', true) ->willReturn(null) @@ -452,14 +452,14 @@ public function testAuthorizeActionWillEnsureLogout(): void ; $this->authorizeFormHandler - ->expects($this->at(0)) + ->expects($this->once()) ->method('process') ->with() ->willReturn(false) ; $this->form - ->expects($this->at(0)) + ->expects($this->once()) ->method('createView') ->willReturn($this->formView) ; @@ -510,18 +510,12 @@ public function testAuthorizeActionWillProcessAuthorizationForm(): void $propertyReflection->setAccessible(true); $propertyReflection->setValue($this->instance, $this->client); - $this->eventDispatcher - ->expects($this->at(0)) - ->method('dispatch') - ->with(new PreAuthorizationEvent($this->user, $this->client)) - ->willReturn($this->preAuthorizationEvent) - ; - $this->preAuthorizationEvent ->expects($this->once()) ->method('isAuthorizedClient') ->willReturn(false) ; + $postAuthorizationEvent = new PostAuthorizationEvent($this->user, $this->client, true); $this->authorizeFormHandler ->expects($this->once()) @@ -536,9 +530,16 @@ public function testAuthorizeActionWillProcessAuthorizationForm(): void ; $this->eventDispatcher - ->expects($this->at(1)) + ->expects($this->exactly(2)) ->method('dispatch') - ->with(new PostAuthorizationEvent($this->user, $this->client, true)) + ->withConsecutive( + [$this->equalTo(new PreAuthorizationEvent($this->user, $this->client))], + [$this->equalTo($postAuthorizationEvent)] + ) + ->willReturn( + $this->preAuthorizationEvent, + $postAuthorizationEvent + ) ; $formName = 'formName'.\random_bytes(10); diff --git a/Tests/DependencyInjection/Compiler/GrantExtensionsCompilerPassTest.php b/Tests/DependencyInjection/Compiler/GrantExtensionsCompilerPassTest.php index 81ab02d2..760897f4 100644 --- a/Tests/DependencyInjection/Compiler/GrantExtensionsCompilerPassTest.php +++ b/Tests/DependencyInjection/Compiler/GrantExtensionsCompilerPassTest.php @@ -169,7 +169,7 @@ public function testProcessWillFailIfUriIsEmpty(): void $exceptionMessage = 'Service "%s" must define the "uri" attribute on "fos_oauth_server.grant_extension" tags.'; - $idx = 0; + $addMethodCallWiths = []; foreach ($data as $id => $tags) { foreach ($tags as $tag) { if (empty($tag['uri'])) { @@ -177,20 +177,22 @@ public function testProcessWillFailIfUriIsEmpty(): void break; } - $storageDefinition - ->expects($this->at(++$idx)) - ->method('addMethodCall') - ->with( - 'setGrantExtension', - [ - $tag['uri'], - new Reference($id), - ] - ) - ; + $addMethodCallWiths[] = [ + $this->equalTo('setGrantExtension'), + $this->equalTo([ + $tag['uri'], + new Reference($id), + ]), + ]; } } + $storageDefinition + ->expects($this->exactly(count($addMethodCallWiths))) + ->method('addMethodCall') + ->withConsecutive(...$addMethodCallWiths) + ; + $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($exceptionMessage); @@ -279,23 +281,26 @@ public function testProcess(): void ->willReturn($data) ; - $idx = 0; + $addMethodCallWiths = []; foreach ($data as $id => $tags) { foreach ($tags as $tag) { - $storageDefinition - ->expects($this->at(++$idx)) - ->method('addMethodCall') - ->with( - 'setGrantExtension', - [ - $tag['uri'], - new Reference($id), - ] - ) - ; + $addMethodCallWiths[] = [ + $this->equalTo('setGrantExtension'), + $this->equalTo([ + $tag['uri'], + new Reference($id), + ]), + $this->equalTo(false), + ]; } } + $storageDefinition + ->expects($this->exactly(count($addMethodCallWiths))) + ->method('addMethodCall') + ->withConsecutive(...$addMethodCallWiths) + ; + $this->assertNull($this->instance->process($container)); } } diff --git a/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php b/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php index 301e1712..22daf5a8 100644 --- a/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php +++ b/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php @@ -113,6 +113,64 @@ public function testCreate(): void ], $this->instance->create($container, $id, $config, $userProvider, $defaultEntryPoint)); } + public function testCreateAuthenticator(): void + { + $container = $this->getMockBuilder(ContainerBuilder::class) + ->disableOriginalConstructor() + ->setMethods([ + 'setDefinition', + ]) + ->getMock() + ; + $id = '12'; + $config = []; + $userProviderId = 'mock.user.provider.service'; + + $definition = $this->getMockBuilder(Definition::class) + ->disableOriginalConstructor() + ->getMock() + ; + + $container + ->expects($this->once()) + ->method('setDefinition') + ->with( + 'fos_oauth_server.security.authentication.authenticator.'.$id, + new ChildDefinition('fos_oauth_server.security.authentication.authenticator') + ) + ->will($this->returnValue($definition)) + ; + + $definition + ->expects($this->exactly(3)) + ->method('replaceArgument') + ->withConsecutive( + [ + 0, + new Reference('fos_oauth_server.server'), + ], + [ + 1, + new Reference('security.user_checker.'.$id), + ], + [ + 2, + new Reference($userProviderId), + ] + ) + ->willReturnOnConsecutiveCalls( + $definition, + $definition, + $definition + ) + ; + + $this->assertSame( + 'fos_oauth_server.security.authentication.authenticator.'.$id, + $this->instance->createAuthenticator($container, $id, $config, $userProviderId) + ); + } + public function testAddConfigurationDoesNothing(): void { $nodeDefinition = $this->getMockBuilder(NodeDefinition::class) diff --git a/Tests/Document/AuthCodeManagerTest.php b/Tests/Document/AuthCodeManagerTest.php index 1f0033ca..4ccb5a52 100644 --- a/Tests/Document/AuthCodeManagerTest.php +++ b/Tests/Document/AuthCodeManagerTest.php @@ -200,7 +200,7 @@ public function testDeleteExpired(): void $collection, [ 'type' => Query::TYPE_REMOVE, - 'query' => null, + 'query' => [], ], [], false diff --git a/Tests/Document/TokenManagerTest.php b/Tests/Document/TokenManagerTest.php index f7f6a667..02fbb8f0 100644 --- a/Tests/Document/TokenManagerTest.php +++ b/Tests/Document/TokenManagerTest.php @@ -196,7 +196,7 @@ public function testDeleteExpired(): void $collection, [ 'type' => Query::TYPE_REMOVE, - 'query' => null, + 'query' => [], ], [], false diff --git a/Tests/FOSOAuthServerBundleTest.php b/Tests/FOSOAuthServerBundleTest.php index d437c0bb..53f75235 100644 --- a/Tests/FOSOAuthServerBundleTest.php +++ b/Tests/FOSOAuthServerBundleTest.php @@ -47,21 +47,21 @@ public function testConstruction(): void ; $containerBuilder - ->expects($this->at(0)) + ->expects($this->once()) ->method('getExtension') ->with('security') ->willReturn($securityExtension) ; $securityExtension - ->expects($this->at(0)) + ->expects($this->once()) ->method('addSecurityListenerFactory') ->with(new OAuthFactory()) ->willReturn(null) ; $containerBuilder - ->expects($this->at(1)) + ->expects($this->exactly(2)) ->method('addCompilerPass') ->withConsecutive( [new Compiler\GrantExtensionsCompilerPass()], diff --git a/Tests/Form/Handler/AuthorizeFormHandlerTest.php b/Tests/Form/Handler/AuthorizeFormHandlerTest.php index 3c261c5a..168f048d 100644 --- a/Tests/Form/Handler/AuthorizeFormHandlerTest.php +++ b/Tests/Form/Handler/AuthorizeFormHandlerTest.php @@ -188,7 +188,7 @@ public function testGetCurrentRequestWillReturnRequestServiceFromContainerIfNone $randomData = \random_bytes(10); $this->container - ->expects($this->at(0)) + ->expects($this->once()) ->method('get') ->with('request') ->willReturn($randomData) diff --git a/Tests/Form/Type/AuthorizeFormTypeTest.php b/Tests/Form/Type/AuthorizeFormTypeTest.php index 74185fbd..6828951f 100644 --- a/Tests/Form/Type/AuthorizeFormTypeTest.php +++ b/Tests/Form/Type/AuthorizeFormTypeTest.php @@ -105,7 +105,7 @@ public function testGetBlockPrefix(): void */ protected function getTypes() { - return [ + return [ new AuthorizeFormType(), ]; } diff --git a/Tests/Functional/TestBundle/Entity/AccessToken.php b/Tests/Functional/TestBundle/Entity/AccessToken.php index 78ffb576..54923b6f 100644 --- a/Tests/Functional/TestBundle/Entity/AccessToken.php +++ b/Tests/Functional/TestBundle/Entity/AccessToken.php @@ -15,6 +15,8 @@ use Doctrine\ORM\Mapping as ORM; use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken; +use FOS\OAuthServerBundle\Model\ClientInterface; +use Symfony\Component\Security\Core\User\UserInterface; /** * @ORM\Entity @@ -32,11 +34,15 @@ class AccessToken extends BaseAccessToken /** * @ORM\ManyToOne(targetEntity="Client") * @ORM\JoinColumn(nullable=false) + * + * @var ClientInterface */ protected $client; /** * @ORM\ManyToOne(targetEntity="User") + * + * @var UserInterface */ protected $user; } diff --git a/Tests/Functional/TestBundle/Entity/AuthCode.php b/Tests/Functional/TestBundle/Entity/AuthCode.php index 0d654696..db55c06e 100644 --- a/Tests/Functional/TestBundle/Entity/AuthCode.php +++ b/Tests/Functional/TestBundle/Entity/AuthCode.php @@ -15,6 +15,8 @@ use Doctrine\ORM\Mapping as ORM; use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode; +use FOS\OAuthServerBundle\Model\ClientInterface; +use Symfony\Component\Security\Core\User\UserInterface; /** * @ORM\Entity @@ -32,11 +34,15 @@ class AuthCode extends BaseAuthCode /** * @ORM\ManyToOne(targetEntity="Client") * @ORM\JoinColumn(nullable=false) + * + * @var ClientInterface */ protected $client; /** * @ORM\ManyToOne(targetEntity="User") + * + * @var UserInterface */ protected $user; } diff --git a/Tests/Functional/TestBundle/Entity/RefreshToken.php b/Tests/Functional/TestBundle/Entity/RefreshToken.php index f8aadfa9..1b55b2c3 100644 --- a/Tests/Functional/TestBundle/Entity/RefreshToken.php +++ b/Tests/Functional/TestBundle/Entity/RefreshToken.php @@ -15,6 +15,8 @@ use Doctrine\ORM\Mapping as ORM; use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken; +use FOS\OAuthServerBundle\Model\ClientInterface; +use Symfony\Component\Security\Core\User\UserInterface; /** * @ORM\Entity @@ -32,11 +34,15 @@ class RefreshToken extends BaseRefreshToken /** * @ORM\ManyToOne(targetEntity="Client") * @ORM\JoinColumn(nullable=false) + * + * @var ClientInterface */ protected $client; /** * @ORM\ManyToOne(targetEntity="User") + * + * @var UserInterface */ protected $user; } diff --git a/Tests/Functional/TestCase.php b/Tests/Functional/TestCase.php index 3061ee51..fb5c924b 100644 --- a/Tests/Functional/TestCase.php +++ b/Tests/Functional/TestCase.php @@ -19,26 +19,16 @@ abstract class TestCase extends WebTestCase { - /** - * @var KernelInterface|null - */ - protected static $kernel; - protected function setUp(): void { $fs = new Filesystem(); $fs->remove(sys_get_temp_dir().'/FOSOAuthServerBundle/'); } - protected function tearDown(): void - { - static::$kernel = null; - } - /** * @param array $options */ - protected static function createKernel(array $options = []) + protected static function createKernel(array $options = []): KernelInterface { $env = @$options['env'] ?: 'test'; diff --git a/Tests/Security/Authentication/Authenticator/OAuthAuthenticatorTest.php b/Tests/Security/Authentication/Authenticator/OAuthAuthenticatorTest.php new file mode 100644 index 00000000..e584696e --- /dev/null +++ b/Tests/Security/Authentication/Authenticator/OAuthAuthenticatorTest.php @@ -0,0 +1,344 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\OAuthServerBundle\Tests\Security\Authentication\Authenticator; + +use FOS\OAuthServerBundle\Model\AccessToken; +use FOS\OAuthServerBundle\Security\Authentication\Authenticator\OAuthAuthenticator; +use FOS\OAuthServerBundle\Security\Authentication\Passport\OAuthCredentials; +use OAuth2\OAuth2; +use OAuth2\OAuth2AuthenticateException; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\Exception\CredentialsExpiredException; +use Symfony\Component\Security\Core\Exception\DisabledException; +use Symfony\Component\Security\Core\User\User; +use Symfony\Component\Security\Core\User\UserCheckerInterface; +use Symfony\Component\Security\Core\User\UserProviderInterface; +use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge; +use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials; +use Symfony\Component\Security\Http\Authenticator\Passport\Passport; + +class OAuthAuthenticatorTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var OAuthAuthenticator + */ + protected $authenticator; + + /** + * @var \PHPUnit\Framework\MockObject\MockObject|OAuth2 + */ + protected $serverService; + + /** + * @var \PHPUnit\Framework\MockObject\MockObject|User + */ + protected $user; + + /** + * @var \PHPUnit\Framework\MockObject\MockObject|UserCheckerInterface + */ + protected $userChecker; + + /** + * @var \PHPUnit\Framework\MockObject\MockObject|UserProviderInterface + */ + protected $userProvider; + + public function setUp(): void + { + $this->serverService = $this->getMockBuilder(OAuth2::class) + ->disableOriginalConstructor() + ->setMethods([ + 'getBearerToken', + 'getVariable', + 'verifyAccessToken', + ]) + ->getMock() + ; + $this->userChecker = $this->getMockBuilder(UserCheckerInterface::class)->disableOriginalConstructor()->getMock(); + $this->userProvider = $this->getMockBuilder(UserProviderInterface::class) + ->disableOriginalConstructor() + ->setMethods([ + 'loadUserByIdentifier', + 'loadUserByUsername', + 'refreshUser', + 'supportsClass', + ]) + ->getMock() + ; + + // mock the core user object rather than the user interface that the new + // getUserIdentifier method is used rather than the deprecated getUsername + $this->user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock(); + + $this->authenticator = new OAuthAuthenticator( + $this->serverService, + $this->userChecker, + $this->userProvider + ); + } + + public function testAuthenticateReturnsPassportIfValid(): void + { + // expect the OAuth2 service to get the token from the request header, + // flagging the authorization header to be removed at the same time + $this->serverService->expects($this->once()) + ->method('getBearerToken') + ->with( + $this->isInstanceOf(Request::class), + $this->equalTo(true) + ) + ->will($this->returnValue('mock_token_string')) + ; + + // expect the OAuth2 service to verify the token, returning an access token + $accessToken = new AccessToken(); + $accessToken->setUser($this->user); + $accessToken->setScope('scope_1 scope_2'); + $this->serverService->expects($this->once()) + ->method('verifyAccessToken') + ->with('mock_token_string') + ->will($this->returnValue($accessToken)) + ; + + // expect the username from the user + $this->user->expects($this->once()) + ->method('getUserIdentifier') + ->will($this->returnValue('test_user')) + ; + + // expect the user checker to pass + $this->userChecker->expects($this->once()) + ->method('checkPreAuth') + ->with($this->user) + ; + + $passport = $this->authenticator->authenticate(new Request()); + + $this->assertInstanceOf(Passport::class, $passport); + $this->assertCount(2, $passport->getBadges()); + $this->assertTrue($passport->hasBadge(OAuthCredentials::class)); + $this->assertTrue($passport->hasBadge(UserBadge::class)); + $this->assertSame('test_user', $passport->getBadge(UserBadge::class)->getUserIdentifier()); + $this->assertSame('mock_token_string', $passport->getBadge(OAuthCredentials::class)->getTokenString()); + $this->assertSame(['ROLE_SCOPE_1', 'ROLE_SCOPE_2'], $passport->getBadge(OAuthCredentials::class)->getRoles($this->user)); + $this->assertTrue($passport->getBadge(OAuthCredentials::class)->isResolved()); + } + + public function testAuthenticateReturnsUnresolvedPassportWhenNullUser(): void + { + // expect the OAuth2 service to get the token from the request header, + // flagging the authorization header to be removed at the same time + $this->serverService->expects($this->once()) + ->method('getBearerToken') + ->with( + $this->isInstanceOf(Request::class), + $this->equalTo(true) + ) + ->will($this->returnValue('mock_token_string')) + ; + + // expect the OAuth2 service to verify the token, returning an access + // token, but without a related user + $accessToken = new AccessToken(); + $this->serverService->expects($this->once()) + ->method('verifyAccessToken') + ->with('mock_token_string') + ->will($this->returnValue($accessToken)) + ; + + // expect the null user value to not be processed + $this->userChecker->expects($this->never())->method('checkPreAuth'); + + $passport = $this->authenticator->authenticate(new Request()); + + // confirm that the returned passport won't pass validation + $this->assertFalse($passport->getBadge(OAuthCredentials::class)->isResolved()); + } + + public function testAuthenticateReturnsUnresolvedPassportWhenInvalidToken(): void + { + // expect the OAuth2 service to get the token from the request header, + // flagging the authorization header to be removed at the same time + $this->serverService->expects($this->once()) + ->method('getBearerToken') + ->with( + $this->isInstanceOf(Request::class), + $this->equalTo(true) + ) + ->will($this->returnValue('mock_token_string')) + ; + + // expect the OAuth2 service to not verify the token, throwing an exception + $this->serverService->expects($this->once()) + ->method('verifyAccessToken') + ->with('mock_token_string') + ->willThrowException(new OAuth2AuthenticateException( + (string) Response::HTTP_UNAUTHORIZED, + 'mock_token_type', + 'mock_realm', + 'invalid_grant', + 'The access token provided is invalid.', + null + )) + ; + + // expect the null user value to not be processed + $this->userChecker->expects($this->never())->method('checkPreAuth'); + + $passport = $this->authenticator->authenticate(new Request()); + + // confirm that the returned passport won't pass validation + $this->assertFalse($passport->getBadge(OAuthCredentials::class)->isResolved()); + } + + public function testAuthenticateTransformsAccountStatusException(): void + { + // expect the OAuth2 service to get the token from the request header, + // flagging the authorization header to be removed at the same time + $this->serverService->expects($this->once()) + ->method('getBearerToken') + ->with( + $this->isInstanceOf(Request::class), + $this->equalTo(true) + ) + ->will($this->returnValue('mock_token_string')) + ; + + // expect the OAuth2 service to verify the token, returning an access token + $accessToken = new AccessToken(); + $accessToken->setUser($this->user); + $accessToken->setScope('scope_1 scope_2'); + $this->serverService->expects($this->once()) + ->method('verifyAccessToken') + ->with('mock_token_string') + ->will($this->returnValue($accessToken)) + ; + + // expect the user checker to not pass + $this->userChecker->expects($this->once()) + ->method('checkPreAuth') + ->with($this->user) + ->willThrowException(new DisabledException('User account is disabled.')) + ; + + $passport = $this->authenticator->authenticate(new Request()); + + // confirm that the returned passport won't pass validation + $this->assertFalse($passport->getBadge(OAuthCredentials::class)->isResolved()); + } + + public function testCreateAuthenticatedTokenWithValidPassport(): void + { + // expect the user to be loaded by the provider + $this->userProvider->expects($this->once()) + ->method('loadUserByIdentifier') + ->with('test_user') + ->will($this->returnValue($this->user)) + ; + + // expect the user checker to pass + $this->userChecker->expects($this->once()) + ->method('checkPostAuth') + ->with($this->user) + ; + + // configure roles on the user to confirm they are combined with the + // access token scopes + $this->user->expects($this->once()) + ->method('getRoles') + ->will($this->returnValue(['ROLE_USER'])) + ; + + // configure the passport + $passport = new Passport( + new UserBadge('test_user'), + new OAuthCredentials('mock_token_string', 'scope_1 scope_2') + ); + + $token = $this->authenticator->createAuthenticatedToken($passport, 'api_firewall_name'); + + $this->assertTrue($token->isAuthenticated()); + $this->assertSame('mock_token_string', $token->getToken()); + $this->assertSame($this->user, $token->getUser()); + $this->assertSame(['ROLE_USER', 'ROLE_SCOPE_1', 'ROLE_SCOPE_2'], $token->getRoleNames()); + } + + public function testCreateAuthenticatedTokenWithUnexpectedPassportCredentials(): void + { + // expect the user to not be loaded by the provider + $this->userProvider->expects($this->never())->method('loadUserByIdentifier'); + + // configure the passport with non-oauth credentials + $passport = new Passport( + new UserBadge('test_user'), + new PasswordCredentials('mock_password') + ); + + // expect an authentication exception + $this->expectException(AuthenticationException::class); + $this->expectExceptionMessage('OAuth2 authentication failed'); + + $this->authenticator->createAuthenticatedToken($passport, 'api_firewall_name'); + } + + public function testCreateAuthenticatedTokenTransformsAccountStatusException(): void + { + // expect the user to be loaded by the provider + $this->userProvider->expects($this->once()) + ->method('loadUserByIdentifier') + ->with('test_user') + ->will($this->returnValue($this->user)) + ; + + // expect the user checker to not pass + $this->userChecker->expects($this->once()) + ->method('checkPostAuth') + ->with($this->user) + ->willThrowException(new CredentialsExpiredException('User credentials have expired.')) + ; + + // configure the passport + $passport = new Passport( + new UserBadge('test_user'), + new OAuthCredentials('mock_token_string', 'scope') + ); + + // expect an authentication exception + $this->expectException(AuthenticationException::class); + $this->expectExceptionMessage('OAuth2 authentication failed'); + + $this->authenticator->createAuthenticatedToken($passport, 'api_firewall_name'); + } + + public function testOnAuthenticationFailure(): void + { + // expect the OAuth server to get the realm + $this->serverService->expects($this->once()) + ->method('getVariable') + ->with('realm') + ->will($this->returnValue('mock_realm')) + ; + + $response = $this->authenticator->onAuthenticationFailure( + new Request(), + new AuthenticationException('Authentication failure message') + ); + + $this->assertSame(401, $response->getStatusCode()); + $this->assertSame('{"error":"access_denied","error_description":"Authentication failure message"}', $response->getContent()); + } +} diff --git a/Tests/Security/Authentication/Passport/OAuthCredentialsTest.php b/Tests/Security/Authentication/Passport/OAuthCredentialsTest.php new file mode 100644 index 00000000..87f27135 --- /dev/null +++ b/Tests/Security/Authentication/Passport/OAuthCredentialsTest.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace FOS\OAuthServerBundle\Tests\Security\Authentication\Passport; + +use FOS\OAuthServerBundle\Security\Authentication\Passport\OAuthCredentials; +use Symfony\Component\Security\Core\User\UserInterface; + +class OAuthCredentialsTest extends \PHPUnit\Framework\TestCase +{ + /** + * @var \PHPUnit\Framework\MockObject\MockObject|UserInterface + */ + protected $user; + + public function setUp(): void + { + $this->user = $this->getMockBuilder(UserInterface::class)->disableOriginalConstructor()->getMock(); + } + + /** + * @testWith ["scope_1 scope_2", ["ROLE_USER"], ["ROLE_USER", "ROLE_SCOPE_1", "ROLE_SCOPE_2"], "roles and scopes combined"] + * ["scope_1 duplicate", ["ROLE_USER", "ROLE_DUPLICATE"], ["ROLE_USER", "ROLE_DUPLICATE", "ROLE_SCOPE_1"], "only unique roles"] + * ["", ["ROLE_USER"], ["ROLE_USER"], "scopes can be empty"] + * ["scope", [], ["ROLE_SCOPE"], "user roles can be empty"] + * ["", [], [], "roles and scopes can be empty"] + */ + public function testGetRoles(string $scopes, array $userRoles, array $expectedRoles, string $testCase): void + { + $credentials = new OAuthCredentials('mock_token', $scopes); + + $this->user->expects($this->once()) + ->method('getRoles') + ->will($this->returnValue($userRoles)) + ; + + $this->assertSame($expectedRoles, $credentials->getRoles($this->user)); + } + + public function testMarkResolved(): void + { + $credentials = new OAuthCredentials('mock_token', 'scope_1 scope_2'); + + $this->user->expects($this->any()) + ->method('getRoles') + ->will($this->returnValue([])) + ; + + $this->assertFalse($credentials->isResolved()); + $this->assertSame('mock_token', $credentials->getTokenString()); + $this->assertSame(['ROLE_SCOPE_1', 'ROLE_SCOPE_2'], $credentials->getRoles($this->user)); + + $credentials->markResolved(); + + // marking credentials as resolved should not change any other state, + // as the transported data is still needed for creating the + // authenticated token when the AuthenticatorManager progresses in + // executing the OAuthAuthenticator + $this->assertTrue($credentials->isResolved()); + $this->assertSame('mock_token', $credentials->getTokenString()); + $this->assertSame(['ROLE_SCOPE_1', 'ROLE_SCOPE_2'], $credentials->getRoles($this->user)); + } +} diff --git a/Tests/Storage/OAuthStorageTest.php b/Tests/Storage/OAuthStorageTest.php index ca70e609..27559809 100644 --- a/Tests/Storage/OAuthStorageTest.php +++ b/Tests/Storage/OAuthStorageTest.php @@ -78,6 +78,12 @@ public function setUp(): void ; $this->userProvider = $this->getMockBuilder(UserProviderInterface::class) ->disableOriginalConstructor() + ->setMethods([ + 'loadUserByIdentifier', + 'loadUserByUsername', + 'refreshUser', + 'supportsClass', + ]) ->getMock() ; $this->encoderFactory = $this->getMockBuilder(EncoderFactoryInterface::class) @@ -363,7 +369,7 @@ public function testCheckUserCredentialsCatchesAuthenticationExceptions(): void $this->userProvider ->expects(self::once()) - ->method('loadUserByUsername') + ->method('loadUserByIdentifier') ->with('Joe') ->willThrowException(new AuthenticationException('No such user')) ; @@ -396,7 +402,7 @@ public function testCheckUserCredentialsReturnsTrueOnValidCredentials(): void ; $this->userProvider->expects($this->once()) - ->method('loadUserByUsername') + ->method('loadUserByIdentifier') ->with('Joe') ->will($this->returnValue($user)) ; @@ -435,7 +441,7 @@ public function testCheckUserCredentialsReturnsFalseOnInvalidCredentials(): void ; $this->userProvider->expects($this->once()) - ->method('loadUserByUsername') + ->method('loadUserByIdentifier') ->with('Joe') ->will($this->returnValue($user)) ; @@ -454,7 +460,7 @@ public function testCheckUserCredentialsReturnsFalseIfUserNotExist(): void $client = new Client(); $this->userProvider->expects($this->once()) - ->method('loadUserByUsername') + ->method('loadUserByIdentifier') ->with('Joe') ->willThrowException(new AuthenticationException('No such user')) ; diff --git a/composer.json b/composer.json index 7fe0c669..a6f2e39c 100644 --- a/composer.json +++ b/composer.json @@ -20,12 +20,13 @@ ], "homepage": "http://friendsofsymfony.github.com", "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", + "doctrine/annotations": "^1.13", "friendsofsymfony/oauth2-php": "~1.1", - "symfony/dependency-injection": "^4.4 || ^5.1", - "symfony/framework-bundle": "^4.4 || ^5.1", - "symfony/security-bundle": "^4.4 || ^5.1", - "symfony/twig-bundle": "^4.4 || ^5.1" + "symfony/dependency-injection": "^5.3", + "symfony/framework-bundle": "^5.3", + "symfony/security-bundle": "^5.3", + "symfony/twig-bundle": "^5.3" }, "require-dev": { "doctrine/doctrine-bundle": "^2.0", @@ -36,12 +37,13 @@ "phpstan/phpstan": "^0.12", "phpstan/phpstan-phpunit": "~0.9", "phpunit/phpunit": "^8.5.23 || ^9.0", - "symfony/console": "^4.4 || ^5.1", - "symfony/form": "^4.4 || ^5.1", - "symfony/http-kernel": "^4.4 || ^5.1", - "symfony/phpunit-bridge": "^4.4 || ^5.1", - "symfony/security-core": "^4.4 || ^5.1", - "symfony/yaml": "^4.4 || ^5.1" + "symfony/console": "^5.3", + "symfony/doctrine-messenger": "^5.3", + "symfony/form": "^5.3", + "symfony/http-kernel": "^5.3", + "symfony/phpunit-bridge": "^5.3", + "symfony/security-core": "^5.3", + "symfony/yaml": "^5.3" }, "conflict": { "twig/twig": "<1.40 || >=2.0,<2.9" diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d5a14d74..249020ad 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,32 +1,32 @@ parameters: ignoreErrors: - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Command\\\\CleanCommand\\:\\:configure\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Command\\\\CleanCommand\\:\\:configure\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Command/CleanCommand.php - - message: "#^Property FOS\\\\OAuthServerBundle\\\\Command\\\\CleanCommand\\:\\:\\$accessTokenManager has no typehint specified\\.$#" + message: "#^Property FOS\\\\OAuthServerBundle\\\\Command\\\\CleanCommand\\:\\:\\$accessTokenManager has no type(|hint) specified\\.$#" count: 1 path: Command/CleanCommand.php - - message: "#^Property FOS\\\\OAuthServerBundle\\\\Command\\\\CleanCommand\\:\\:\\$authCodeManager has no typehint specified\\.$#" + message: "#^Property FOS\\\\OAuthServerBundle\\\\Command\\\\CleanCommand\\:\\:\\$authCodeManager has no type(|hint) specified\\.$#" count: 1 path: Command/CleanCommand.php - - message: "#^Property FOS\\\\OAuthServerBundle\\\\Command\\\\CleanCommand\\:\\:\\$refreshTokenManager has no typehint specified\\.$#" + message: "#^Property FOS\\\\OAuthServerBundle\\\\Command\\\\CleanCommand\\:\\:\\$refreshTokenManager has no type(|hint) specified\\.$#" count: 1 path: Command/CleanCommand.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Command\\\\CreateClientCommand\\:\\:configure\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Command\\\\CreateClientCommand\\:\\:configure\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Command/CreateClientCommand.php - - message: "#^Property FOS\\\\OAuthServerBundle\\\\Command\\\\CreateClientCommand\\:\\:\\$clientManager has no typehint specified\\.$#" + message: "#^Property FOS\\\\OAuthServerBundle\\\\Command\\\\CreateClientCommand\\:\\:\\$clientManager has no type(|hint) specified\\.$#" count: 1 path: Command/CreateClientCommand.php @@ -36,12 +36,12 @@ parameters: path: Controller/AuthorizeController.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Controller\\\\AuthorizeController\\:\\:authorizeAction\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Controller\\\\AuthorizeController\\:\\:authorizeAction\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Controller/AuthorizeController.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Controller\\\\AuthorizeController\\:\\:getCurrentRequest\\(\\) never returns null so it can be removed from the return typehint\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Controller\\\\AuthorizeController\\:\\:getCurrentRequest\\(\\) never returns null so it can be removed from the return type(|hint)\\.$#" count: 1 path: Controller/AuthorizeController.php @@ -56,12 +56,12 @@ parameters: path: Controller/AuthorizeController.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Compiler\\\\GrantExtensionsCompilerPass\\:\\:process\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Compiler\\\\GrantExtensionsCompilerPass\\:\\:process\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/Compiler/GrantExtensionsCompilerPass.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Compiler\\\\RequestStackCompilerPass\\:\\:process\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Compiler\\\\RequestStackCompilerPass\\:\\:process\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/Compiler/RequestStackCompilerPass.php @@ -76,12 +76,12 @@ parameters: path: DependencyInjection/Configuration.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Configuration\\:\\:addAuthorizeSection\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Configuration\\:\\:addAuthorizeSection\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/Configuration.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Configuration\\:\\:addServiceSection\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Configuration\\:\\:addServiceSection\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/Configuration.php @@ -96,7 +96,7 @@ parameters: path: DependencyInjection/Configuration.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:computeArraySupportedScopes\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:computeArraySupportedScopes\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/FOSOAuthServerExtension.php @@ -106,7 +106,7 @@ parameters: path: DependencyInjection/FOSOAuthServerExtension.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:load\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:load\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/FOSOAuthServerExtension.php @@ -116,7 +116,7 @@ parameters: path: DependencyInjection/FOSOAuthServerExtension.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:loadAuthorize\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:loadAuthorize\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/FOSOAuthServerExtension.php @@ -126,7 +126,7 @@ parameters: path: DependencyInjection/FOSOAuthServerExtension.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:remapParameters\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:remapParameters\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/FOSOAuthServerExtension.php @@ -141,7 +141,7 @@ parameters: path: DependencyInjection/FOSOAuthServerExtension.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:remapParametersNamespaces\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\FOSOAuthServerExtension\\:\\:remapParametersNamespaces\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/FOSOAuthServerExtension.php @@ -156,27 +156,27 @@ parameters: path: DependencyInjection/FOSOAuthServerExtension.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:addConfiguration\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:addConfiguration\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: DependencyInjection/Security/Factory/OAuthFactory.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:create\\(\\) has parameter \\$config with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:create\\(\\) has parameter \\$config with no type(|hint) specified\\.$#" count: 1 path: DependencyInjection/Security/Factory/OAuthFactory.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:create\\(\\) has parameter \\$defaultEntryPoint with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:create\\(\\) has parameter \\$defaultEntryPoint with no type(|hint) specified\\.$#" count: 1 path: DependencyInjection/Security/Factory/OAuthFactory.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:create\\(\\) has parameter \\$id with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:create\\(\\) has parameter \\$id with no type(|hint) specified\\.$#" count: 1 path: DependencyInjection/Security/Factory/OAuthFactory.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:create\\(\\) has parameter \\$userProvider with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:create\\(\\) has parameter \\$userProvider with no type(|hint) specified\\.$#" count: 1 path: DependencyInjection/Security/Factory/OAuthFactory.php @@ -185,6 +185,11 @@ parameters: count: 1 path: DependencyInjection/Security/Factory/OAuthFactory.php + - + message: "#^Method FOS\\\\OAuthServerBundle\\\\DependencyInjection\\\\Security\\\\Factory\\\\OAuthFactory\\:\\:createAuthenticator\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" + count: 1 + path: DependencyInjection/Security/Factory/OAuthFactory.php + - message: "#^Call to method createQueryBuilder\\(\\) on an unknown class Doctrine\\\\ODM\\\\MongoDB\\\\DocumentRepository\\.$#" count: 1 @@ -196,12 +201,12 @@ parameters: path: Document/AuthCodeManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\AuthCodeManager\\:\\:__construct\\(\\) has parameter \\$class with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\AuthCodeManager\\:\\:__construct\\(\\) has parameter \\$class with no type(|hint) specified\\.$#" count: 1 path: Document/AuthCodeManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\AuthCodeManager\\:\\:deleteAuthCode\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\AuthCodeManager\\:\\:deleteAuthCode\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Document/AuthCodeManager.php @@ -211,7 +216,7 @@ parameters: path: Document/AuthCodeManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\AuthCodeManager\\:\\:updateAuthCode\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\AuthCodeManager\\:\\:updateAuthCode\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Document/AuthCodeManager.php @@ -236,12 +241,12 @@ parameters: path: Document/ClientManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\ClientManager\\:\\:__construct\\(\\) has parameter \\$class with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\ClientManager\\:\\:__construct\\(\\) has parameter \\$class with no type(|hint) specified\\.$#" count: 1 path: Document/ClientManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\ClientManager\\:\\:deleteClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\ClientManager\\:\\:deleteClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Document/ClientManager.php @@ -251,7 +256,7 @@ parameters: path: Document/ClientManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\ClientManager\\:\\:updateClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\ClientManager\\:\\:updateClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Document/ClientManager.php @@ -281,12 +286,12 @@ parameters: path: Document/TokenManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\TokenManager\\:\\:__construct\\(\\) has parameter \\$class with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\TokenManager\\:\\:__construct\\(\\) has parameter \\$class with no type(|hint) specified\\.$#" count: 1 path: Document/TokenManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\TokenManager\\:\\:deleteToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\TokenManager\\:\\:deleteToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Document/TokenManager.php @@ -296,7 +301,7 @@ parameters: path: Document/TokenManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\TokenManager\\:\\:updateToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Document\\\\TokenManager\\:\\:updateToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Document/TokenManager.php @@ -316,7 +321,7 @@ parameters: path: Document/TokenManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\AuthCodeManager\\:\\:deleteAuthCode\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\AuthCodeManager\\:\\:deleteAuthCode\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Entity/AuthCodeManager.php @@ -326,7 +331,7 @@ parameters: path: Entity/AuthCodeManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\AuthCodeManager\\:\\:updateAuthCode\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\AuthCodeManager\\:\\:updateAuthCode\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Entity/AuthCodeManager.php @@ -341,12 +346,12 @@ parameters: path: Entity/AuthCodeManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\ClientManager\\:\\:__construct\\(\\) has parameter \\$class with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\ClientManager\\:\\:__construct\\(\\) has parameter \\$class with no type(|hint) specified\\.$#" count: 1 path: Entity/ClientManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\ClientManager\\:\\:deleteClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\ClientManager\\:\\:deleteClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Entity/ClientManager.php @@ -356,7 +361,7 @@ parameters: path: Entity/ClientManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\ClientManager\\:\\:updateClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\ClientManager\\:\\:updateClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Entity/ClientManager.php @@ -376,12 +381,12 @@ parameters: path: Entity/ClientManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\TokenManager\\:\\:__construct\\(\\) has parameter \\$class with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\TokenManager\\:\\:__construct\\(\\) has parameter \\$class with no type(|hint) specified\\.$#" count: 1 path: Entity/TokenManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\TokenManager\\:\\:deleteToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\TokenManager\\:\\:deleteToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Entity/TokenManager.php @@ -391,7 +396,7 @@ parameters: path: Entity/TokenManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\TokenManager\\:\\:updateToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Entity\\\\TokenManager\\:\\:updateToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Entity/TokenManager.php @@ -411,42 +416,42 @@ parameters: path: Entity/TokenManager.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Event\\\\AbstractAuthorizationEvent\\:\\:setAuthorizedClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Event\\\\AbstractAuthorizationEvent\\:\\:setAuthorizedClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Event/AbstractAuthorizationEvent.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\FOSOAuthServerBundle\\:\\:build\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\FOSOAuthServerBundle\\:\\:build\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: FOSOAuthServerBundle.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:getCurrentRequest\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:getCurrentRequest\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Form/Handler/AuthorizeFormHandler.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:getScope\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:getScope\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Form/Handler/AuthorizeFormHandler.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:isAccepted\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:isAccepted\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Form/Handler/AuthorizeFormHandler.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:isRejected\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:isRejected\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Form/Handler/AuthorizeFormHandler.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:onSuccess\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:onSuccess\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Form/Handler/AuthorizeFormHandler.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:setContainer\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Handler\\\\AuthorizeFormHandler\\:\\:setContainer\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Form/Handler/AuthorizeFormHandler.php @@ -461,27 +466,27 @@ parameters: path: Form/Model/Authorize.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Type\\\\AuthorizeFormType\\:\\:buildForm\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Type\\\\AuthorizeFormType\\:\\:buildForm\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Form/Type/AuthorizeFormType.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Type\\\\AuthorizeFormType\\:\\:configureOptions\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Form\\\\Type\\\\AuthorizeFormType\\:\\:configureOptions\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Form/Type/AuthorizeFormType.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCode\\:\\:setRedirectUri\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCode\\:\\:setRedirectUri\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/AuthCode.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCodeInterface\\:\\:setRedirectUri\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCodeInterface\\:\\:setRedirectUri\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/AuthCodeInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCodeManagerInterface\\:\\:deleteAuthCode\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCodeManagerInterface\\:\\:deleteAuthCode\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/AuthCodeManagerInterface.php @@ -491,7 +496,7 @@ parameters: path: Model/AuthCodeManagerInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCodeManagerInterface\\:\\:updateAuthCode\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCodeManagerInterface\\:\\:updateAuthCode\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/AuthCodeManagerInterface.php @@ -501,7 +506,7 @@ parameters: path: Model/Client.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:getId\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:getId\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Client.php @@ -511,7 +516,7 @@ parameters: path: Model/Client.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:setAllowedGrantTypes\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:setAllowedGrantTypes\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Client.php @@ -521,12 +526,12 @@ parameters: path: Model/Client.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:setRandomId\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:setRandomId\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Client.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:setRedirectUris\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:setRedirectUris\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Client.php @@ -536,7 +541,7 @@ parameters: path: Model/Client.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:setSecret\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Client\\:\\:setSecret\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Client.php @@ -556,7 +561,7 @@ parameters: path: Model/ClientInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\:\\:setAllowedGrantTypes\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\:\\:setAllowedGrantTypes\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/ClientInterface.php @@ -566,12 +571,12 @@ parameters: path: Model/ClientInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\:\\:setRandomId\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\:\\:setRandomId\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/ClientInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\:\\:setRedirectUris\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\:\\:setRedirectUris\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/ClientInterface.php @@ -581,12 +586,12 @@ parameters: path: Model/ClientInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\:\\:setSecret\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\:\\:setSecret\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/ClientInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientManagerInterface\\:\\:deleteClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientManagerInterface\\:\\:deleteClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/ClientManagerInterface.php @@ -596,72 +601,72 @@ parameters: path: Model/ClientManagerInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientManagerInterface\\:\\:updateClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\ClientManagerInterface\\:\\:updateClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/ClientManagerInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:getClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:getClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Token.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:getId\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:getId\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Token.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Token.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setExpiresAt\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setExpiresAt\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Token.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setScope\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setScope\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Token.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Token.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setUser\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\Token\\:\\:setUser\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/Token.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setClient\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setClient\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/TokenInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setExpiresAt\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setExpiresAt\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/TokenInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setScope\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setScope\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/TokenInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/TokenInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setUser\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\:\\:setUser\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/TokenInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenManagerInterface\\:\\:deleteToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenManagerInterface\\:\\:deleteToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/TokenManagerInterface.php @@ -671,10 +676,25 @@ parameters: path: Model/TokenManagerInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenManagerInterface\\:\\:updateToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Model\\\\TokenManagerInterface\\:\\:updateToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Model/TokenManagerInterface.php + - + message: "#^Call to an undefined method OAuth2\\\\Model\\\\IOAuth2AccessToken\\:\\:getUser\\(\\)\\.$#" + count: 1 + path: Security/Authentication/Authenticator/OAuthAuthenticator.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Http\\\\Authenticator\\\\Passport\\\\Badge\\\\BadgeInterface\\:\\:get(UserIdentifier|Roles|TokenString)\\(\\)\\.$#" + count: 3 + path: Security/Authentication/Authenticator/OAuthAuthenticator.php + + - + message: "#^Method FOS\\\\OAuthServerBundle\\\\Security\\\\Authentication\\\\Passport\\\\OAuthCredentials\\:\\:getRoles\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: Security/Authentication/Passport/OAuthCredentials.php + - message: "#^Parameter \\#1 \\$httpCode of class OAuth2\\\\OAuth2AuthenticateException constructor expects string, int given\\.$#" count: 2 @@ -686,17 +706,17 @@ parameters: path: Security/Authentication/Provider/OAuthProvider.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Security\\\\Authentication\\\\Token\\\\OAuthToken\\:\\:getToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Security\\\\Authentication\\\\Token\\\\OAuthToken\\:\\:getToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Security/Authentication/Token/OAuthToken.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Security\\\\Authentication\\\\Token\\\\OAuthToken\\:\\:setToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Security\\\\Authentication\\\\Token\\\\OAuthToken\\:\\:setToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Security/Authentication/Token/OAuthToken.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Security\\\\Authentication\\\\Token\\\\OAuthToken\\:\\:setToken\\(\\) has parameter \\$token with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Security\\\\Authentication\\\\Token\\\\OAuthToken\\:\\:setToken\\(\\) has parameter \\$token with no type(|hint) specified\\.$#" count: 1 path: Security/Authentication/Token/OAuthToken.php @@ -706,7 +726,7 @@ parameters: path: Security/EntryPoint/OAuthEntryPoint.php - - message: "#^Property FOS\\\\OAuthServerBundle\\\\Security\\\\EntryPoint\\\\OAuthEntryPoint\\:\\:\\$serverService has no typehint specified\\.$#" + message: "#^Property FOS\\\\OAuthServerBundle\\\\Security\\\\EntryPoint\\\\OAuthEntryPoint\\:\\:\\$serverService has no type(|hint) specified\\.$#" count: 1 path: Security/EntryPoint/OAuthEntryPoint.php @@ -716,7 +736,7 @@ parameters: path: Security/Firewall/OAuthListener.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Security\\\\Firewall\\\\OAuthListener\\:\\:__invoke\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Security\\\\Firewall\\\\OAuthListener\\:\\:__invoke\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Security/Firewall/OAuthListener.php @@ -726,17 +746,17 @@ parameters: path: Security/Firewall/OAuthListener.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\GrantExtensionDispatcherInterface\\:\\:setGrantExtension\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\GrantExtensionDispatcherInterface\\:\\:setGrantExtension\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Storage/GrantExtensionDispatcherInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\GrantExtensionDispatcherInterface\\:\\:setGrantExtension\\(\\) has parameter \\$uri with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\GrantExtensionDispatcherInterface\\:\\:setGrantExtension\\(\\) has parameter \\$uri with no type(|hint) specified\\.$#" count: 1 path: Storage/GrantExtensionDispatcherInterface.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\GrantExtensionInterface\\:\\:checkGrantExtension\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\GrantExtensionInterface\\:\\:checkGrantExtension\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Storage/GrantExtensionInterface.php @@ -776,17 +796,17 @@ parameters: path: Storage/OAuthStorage.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:createAccessToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:createAccessToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Storage/OAuthStorage.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:createAuthCode\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:createAuthCode\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Storage/OAuthStorage.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:createRefreshToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:createRefreshToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Storage/OAuthStorage.php @@ -796,22 +816,22 @@ parameters: path: Storage/OAuthStorage.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:markAuthCodeAsUsed\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:markAuthCodeAsUsed\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Storage/OAuthStorage.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:setGrantExtension\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:setGrantExtension\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Storage/OAuthStorage.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:setGrantExtension\\(\\) has parameter \\$uri with no typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:setGrantExtension\\(\\) has parameter \\$uri with no type(|hint) specified\\.$#" count: 1 path: Storage/OAuthStorage.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:unsetRefreshToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Storage\\\\OAuthStorage\\:\\:unsetRefreshToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Storage/OAuthStorage.php @@ -825,6 +845,10 @@ parameters: count: 1 path: Storage/OAuthStorage.php + - + message: "#Test::test.*has parameter.*with no value type specified in iterable type array#" + path: Tests/ + - message: "#^Unreachable statement \\- code above always terminates\\.$#" count: 1 @@ -846,7 +870,7 @@ parameters: path: Tests/Controller/AuthorizeControllerTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with string and int will always evaluate to false\\.$#" + message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with (|non-empty-)string and int will always evaluate to false\\.$#" count: 1 path: Tests/Document/AuthCodeManagerTest.php @@ -861,7 +885,7 @@ parameters: path: Tests/Document/ClientManagerTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with string and int will always evaluate to false\\.$#" + message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with (|non-empty-)string and int will always evaluate to false\\.$#" count: 1 path: Tests/Document/TokenManagerTest.php @@ -871,17 +895,17 @@ parameters: path: Tests/Document/TokenManagerTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with string and FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCodeInterface\\|null will always evaluate to false\\.$#" + message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with (|non-empty-)string and FOS\\\\OAuthServerBundle\\\\Model\\\\AuthCodeInterface\\|null will always evaluate to false\\.$#" count: 1 path: Tests/Entity/AuthCodeManagerTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with string and int will always evaluate to false\\.$#" + message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with (|non-empty-)string and int will always evaluate to false\\.$#" count: 1 path: Tests/Entity/AuthCodeManagerTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with string and FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\|null will always evaluate to false\\.$#" + message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with (|non-empty-)string and FOS\\\\OAuthServerBundle\\\\Model\\\\ClientInterface\\|null will always evaluate to false\\.$#" count: 1 path: Tests/Entity/ClientManagerTest.php @@ -891,12 +915,12 @@ parameters: path: Tests/Entity/ClientManagerTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with string and FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\|null will always evaluate to false\\.$#" + message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with (|non-empty-)string and FOS\\\\OAuthServerBundle\\\\Model\\\\TokenInterface\\|null will always evaluate to false\\.$#" count: 1 path: Tests/Entity/TokenManagerTest.php - - message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with string and int will always evaluate to false\\.$#" + message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertSame\\(\\) with (|non-empty-)string and int will always evaluate to false\\.$#" count: 1 path: Tests/Entity/TokenManagerTest.php @@ -925,6 +949,16 @@ parameters: count: 1 path: Tests/Functional/TestBundle/Entity/User.php + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\TokenInterface\\:\\:getToken\\(\\)\\.$#" + count: 1 + path: Tests/Security/Authentication/Authenticator/OAuthAuthenticatorTest.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Http\\\\Authenticator\\\\Passport\\\\Badge\\\\BadgeInterface\\:\\:get(UserIdentifier|TokenString|Roles)\\(\\)\\.$#" + count: 3 + path: Tests/Security/Authentication/Authenticator/OAuthAuthenticatorTest.php + - message: "#^Unreachable statement \\- code above always terminates\\.$#" count: 1 @@ -961,7 +995,7 @@ parameters: path: Tests/Storage/OAuthStorageTest.php - - message: "#^Method FOS\\\\OAuthServerBundle\\\\Util\\\\Random\\:\\:generateToken\\(\\) has no return typehint specified\\.$#" + message: "#^Method FOS\\\\OAuthServerBundle\\\\Util\\\\Random\\:\\:generateToken\\(\\) has no return type(|hint) specified\\.$#" count: 1 path: Util/Random.php diff --git a/phpstan.neon b/phpstan.neon index 62ef14db..f0f8f749 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,8 +5,8 @@ parameters: level: 6 paths: - . - autoload_files: + bootstrapFiles: - vendor/autoload.php - excludes_analyse: + excludePaths: - vendor/