diff --git a/Tests/DependencyInjection/FOSOAuthServerExtensionTest.php b/Tests/DependencyInjection/FOSOAuthServerExtensionTest.php index 4ffc09f7..9c33906e 100644 --- a/Tests/DependencyInjection/FOSOAuthServerExtensionTest.php +++ b/Tests/DependencyInjection/FOSOAuthServerExtensionTest.php @@ -23,6 +23,9 @@ class FOSOAuthServerExtensionTest extends \PHPUnit\Framework\TestCase { + /** + * @var ContainerBuilder + */ private $container; public function setUp() diff --git a/Tests/Form/Handler/AuthorizeFormHandlerTest.php b/Tests/Form/Handler/AuthorizeFormHandlerTest.php index dffb6161..f061b515 100644 --- a/Tests/Form/Handler/AuthorizeFormHandlerTest.php +++ b/Tests/Form/Handler/AuthorizeFormHandlerTest.php @@ -29,14 +29,25 @@ */ class AuthorizeFormHandlerTest extends \PHPUnit\Framework\TestCase { + /** + * @var FormInterface&\PHPUnit\Framework\MockObject\MockObject + */ protected $form; - + /** + * @var Request&\PHPUnit\Framework\MockObject\MockObject + */ protected $request; - + /** + * @var ParameterBag&\PHPUnit\Framework\MockObject\MockObject + */ protected $requestQuery; - + /** + * @var ParameterBag&\PHPUnit\Framework\MockObject\MockObject + */ protected $requestRequest; - + /** + * @var ContainerInterface&\PHPUnit\Framework\MockObject\MockObject + */ protected $container; /** diff --git a/Tests/Form/Type/AuthorizeFormTypeTest.php b/Tests/Form/Type/AuthorizeFormTypeTest.php index 2ff1e089..dc11d839 100644 --- a/Tests/Form/Type/AuthorizeFormTypeTest.php +++ b/Tests/Form/Type/AuthorizeFormTypeTest.php @@ -100,6 +100,9 @@ public function testGetBlockPrefix() $this->assertSame('fos_oauth_server_authorize', $this->instance->getBlockPrefix()); } + /** + * @return array + */ protected function getTypes() { return [ diff --git a/Tests/Functional/AppKernel.php b/Tests/Functional/AppKernel.php index e97ffc18..bca57e59 100644 --- a/Tests/Functional/AppKernel.php +++ b/Tests/Functional/AppKernel.php @@ -41,7 +41,7 @@ public function getCacheDir() return sys_get_temp_dir().'/FOSOAuthServerBundle/'; } - public function registerContainerConfiguration(LoaderInterface $loader) + public function registerContainerConfiguration(LoaderInterface $loader): void { $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); } diff --git a/Tests/Functional/BootTest.php b/Tests/Functional/BootTest.php index 331f88c0..4e3d56f1 100644 --- a/Tests/Functional/BootTest.php +++ b/Tests/Functional/BootTest.php @@ -33,6 +33,9 @@ public function testBoot($env) } } + /** + * @return array + */ public function getTestBootData() { return [ diff --git a/Tests/Functional/TestBundle/Entity/User.php b/Tests/Functional/TestBundle/Entity/User.php index 61363bec..f3b24b32 100644 --- a/Tests/Functional/TestBundle/Entity/User.php +++ b/Tests/Functional/TestBundle/Entity/User.php @@ -25,15 +25,19 @@ class User implements UserInterface * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * + * @var ?int */ protected $id; /** * @ORM\Column(type="string") + * + * @var ?string */ protected $password; - public function getId() + public function getId(): ?int { return $this->id; } @@ -43,18 +47,19 @@ public function getRoles() return ['ROLE_USER']; } - public function getPassword() + public function getPassword(): ?string { return $this->password; } - public function setPassword($password) + public function setPassword(?string $password): void { $this->password = $password; } public function getSalt() { + return null; } public function getUsername() @@ -62,7 +67,7 @@ public function getUsername() return $this->getId(); } - public function eraseCredentials() + public function eraseCredentials(): void { } } diff --git a/Tests/Functional/TestCase.php b/Tests/Functional/TestCase.php index a8e1612f..3061ee51 100644 --- a/Tests/Functional/TestCase.php +++ b/Tests/Functional/TestCase.php @@ -35,6 +35,9 @@ protected function tearDown(): void static::$kernel = null; } + /** + * @param array $options + */ protected static function createKernel(array $options = []) { $env = @$options['env'] ?: 'test'; diff --git a/Tests/Model/TokenTest.php b/Tests/Model/TokenTest.php index 053032c3..e010cbb1 100644 --- a/Tests/Model/TokenTest.php +++ b/Tests/Model/TokenTest.php @@ -38,6 +38,9 @@ public function testHasExpired($expiresAt, $expect) $this->assertSame($expect, $token->hasExpired()); } + /** + * @return array + */ public static function getTestHasExpiredData() { return [ diff --git a/Tests/Security/Authentification/Token/OAuthTokenTest.php b/Tests/Security/Authentification/Token/OAuthTokenTest.php index 31f41bdb..196d5969 100644 --- a/Tests/Security/Authentification/Token/OAuthTokenTest.php +++ b/Tests/Security/Authentification/Token/OAuthTokenTest.php @@ -38,7 +38,7 @@ public function testSetTokenWillSetToken() ; $this->assertNull($this->instance->setToken($token)); - $this->assertAttributeSame($token, 'token', $this->instance); + $this->assertSame($token, $this->instance->getToken()); } public function testGetTokenWillReturnToken() diff --git a/Tests/Security/Firewall/OAuthListenerTest.php b/Tests/Security/Firewall/OAuthListenerTest.php index 61f62c27..6961b5d2 100644 --- a/Tests/Security/Firewall/OAuthListenerTest.php +++ b/Tests/Security/Firewall/OAuthListenerTest.php @@ -23,12 +23,24 @@ class OAuthListenerTest extends TestCase { + /** + * @var OAuth2&\PHPUnit\Framework\MockObject\MockObject + */ protected $serverService; + /** + * @var AuthenticationManagerInterface&\PHPUnit\Framework\MockObject\MockObject + */ protected $authManager; + /** + * @var mixed&\PHPUnit\Framework\MockObject\MockObject + */ protected $securityContext; + /** + * @var RequestEvent&\PHPUnit\Framework\MockObject\MockObject + */ protected $event; public function setUp() diff --git a/Tests/Storage/OAuthStorageTest.php b/Tests/Storage/OAuthStorageTest.php index f628327b..b8e1c2de 100644 --- a/Tests/Storage/OAuthStorageTest.php +++ b/Tests/Storage/OAuthStorageTest.php @@ -29,18 +29,33 @@ class OAuthStorageTest extends \PHPUnit\Framework\TestCase { + /** + * @var ClientManagerInterface&\PHPUnit\Framework\MockObject\MockObject + */ protected $clientManager; - + /** + * @var AccessTokenManagerInterface&\PHPUnit\Framework\MockObject\MockObject + */ protected $accessTokenManager; - + /** + * @var RefreshTokenManagerInterface&\PHPUnit\Framework\MockObject\MockObject + */ protected $refreshTokenManager; - + /** + * @var AuthCodeManagerInterface&\PHPUnit\Framework\MockObject\MockObject + */ protected $authCodeManager; - + /** + * @var UserProviderInterface&\PHPUnit\Framework\MockObject\MockObject + */ protected $userProvider; - + /** + * @var EncoderFactoryInterface&\PHPUnit\Framework\MockObject\MockObject + */ protected $encoderFactory; - + /** + * @var OAuthStorage + */ protected $storage; public function setUp() @@ -605,8 +620,14 @@ public function testMarkAuthCodeAsUsedIfAuthCodeNotFound() class User implements UserInterface { + /** + * @var string|int + */ private $username; + /** + * @param string|int $username + */ public function __construct($username) { $this->username = $username; @@ -614,22 +635,28 @@ public function __construct($username) public function getRoles() { + return []; } public function getPassword() { + return null; } public function getSalt() { + return null; } + /** + * @return string|int + */ public function getUsername() { return $this->username; } - public function eraseCredentials() + public function eraseCredentials(): void { } }