Skip to content

Commit

Permalink
Fix PHPDoc and restore infection/infection contrib.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Dec 5, 2019
1 parent f69e42b commit d73038f
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 19 deletions.
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -26,6 +26,7 @@
"require-dev": {
"drupol/php-conventions": "^1.6.8",
"friends-of-phpspec/phpspec-code-coverage": "^4.3",
"infection/infection": "^0.15.0",
"phpspec/phpspec": "^6.1"
},
"suggest": {
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
@@ -1,5 +1,6 @@
parameters:
ignoreErrors:
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface::arrayNode()#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface::scalarNode()#'
- '#Calling method scalarNode\(\) on possibly null value of type Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface#'
- '#Cannot call method scalarNode() on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface|null.#'
4 changes: 2 additions & 2 deletions spec/drupol/CasBundle/Security/CasGuardAuthenticatorSpec.php
Expand Up @@ -72,7 +72,7 @@ public function it_can_check_if_authentication_is_supported_when_a_user_is_logge

$this
->supports(Request::create('http://app/?ticket=ticket'))
->shouldReturn(false);
->shouldReturn(true);
}

public function it_can_check_if_rememberMe_is_enabled()
Expand Down Expand Up @@ -220,7 +220,7 @@ public function it_can_redirect_to_the_login_url()
->start($request)
->headers
->all()
->shouldHaveKeyWithValue('location', ['http://local/cas/login']);
->shouldHaveKeyWithValue('location', ['http://local/cas/login?service=http%3A%2F%2Fapp']);
}

public function it_is_initializable()
Expand Down
16 changes: 8 additions & 8 deletions src/Configuration/Symfony.php
Expand Up @@ -29,7 +29,7 @@ final class Symfony implements PropertiesInterface
/**
* Symfony constructor.
*
* @param array $properties
* @param array<string, mixed> $properties
* @param \Symfony\Component\Routing\RouterInterface $router
*/
public function __construct(array $properties, RouterInterface $router)
Expand Down Expand Up @@ -59,7 +59,7 @@ public function offsetExists($offset)
/**
* @param mixed $offset
*
* @return mixed
* @return array<string, mixed>|mixed
*/
public function offsetGet($offset)
{
Expand All @@ -70,26 +70,26 @@ public function offsetGet($offset)
* @param mixed $offset
* @param mixed $value
*/
public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->cas->offsetSet($offset, $value);
}

/**
* @param mixed $offset
*/
public function offsetUnset($offset)
public function offsetUnset($offset): void
{
$this->cas->offsetUnset($offset);
}

/**
* Transform Symfony routes into absolute URLs.
*
* @param array $properties
* @param array<string, mixed> $properties
* The properties.
*
* @return array
* @return array<string, mixed>
* The updated properties.
*/
private function routeToUrl(array $properties): array
Expand All @@ -106,10 +106,10 @@ private function routeToUrl(array $properties): array
}

/**
* @param array $properties
* @param array<string, mixed> $properties
* @param string $key
*
* @return array
* @return array<string, mixed>
*/
private function updateDefaultParameterRouteToUrl(array $properties, string $key): array
{
Expand Down
3 changes: 2 additions & 1 deletion src/DependencyInjection/CasExtension.php
Expand Up @@ -13,7 +13,8 @@
class CasExtension extends Extension
{
/**
* {@inheritdoc}
* @param array<string> $configs
* @param ContainerBuilder $container
*/
public function load(array $configs, ContainerBuilder $container): void
{
Expand Down
10 changes: 8 additions & 2 deletions src/Security/CasGuardAuthenticator.php
Expand Up @@ -70,7 +70,10 @@ public function __construct(
}

/**
* {@inheritdoc}
* @param \Psr\Http\Message\ResponseInterface $response
* @param UserInterface $user
*
* @return bool
*/
public function checkCredentials($response, UserInterface $user)
{
Expand Down Expand Up @@ -106,7 +109,10 @@ public function getCredentials(Request $request)
}

/**
* {@inheritdoc}
* @param \Psr\Http\Message\ResponseInterface $response
* @param UserProviderInterface $userProvider
*
* @return \drupol\CasBundle\Security\Core\User\CasUserInterface
*/
public function getUser($response, UserProviderInterface $userProvider)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Security/Core/User/CasUser.php
Expand Up @@ -12,14 +12,14 @@ final class CasUser implements CasUserInterface
/**
* The user storage.
*
* @var array
* @var array<mixed>
*/
private $storage;

/**
* CasUser constructor.
*
* @param array $data
* @param array<mixed> $data
*/
public function __construct(array $data)
{
Expand Down Expand Up @@ -106,7 +106,7 @@ public function getUsername()
/**
* Get the storage.
*
* @return array
* @return array<mixed>
*/
private function getStorage()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Security/Core/User/CasUserInterface.php
Expand Up @@ -28,7 +28,7 @@ public function get(string $key, $default = null);
public function getAttribute(string $key, $default = null);

/**
* @return array
* @return array<array|string>
*/
public function getAttributes(): array;

Expand Down
6 changes: 4 additions & 2 deletions src/Security/Core/User/CasUserProvider.php
Expand Up @@ -37,7 +37,7 @@ public function loadUserByResponse(ResponseInterface $response): CasUserInterfac
/**
* {@inheritdoc}
*/
public function loadUserByUsername($username)
public function loadUserByUsername(string $username)
{
throw new UnsupportedUserException(sprintf('Username "%s" does not exist.', $username));
}
Expand All @@ -56,8 +56,10 @@ public function refreshUser(UserInterface $user)

/**
* {@inheritdoc}
*
* @return bool
*/
public function supportsClass($class)
public function supportsClass(string $class)
{
return CasUser::class === $class;
}
Expand Down

0 comments on commit d73038f

Please sign in to comment.