Skip to content

Commit

Permalink
bump to phpstan level 3
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher committed Aug 2, 2021
1 parent 4b4ec05 commit fa368ed
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 15 deletions.
4 changes: 3 additions & 1 deletion OAuth/Response/LinkedinUserResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function getProfilePicture()
// https://docs.microsoft.com/en-us/linkedin/shared/references/v2/profile/profile-picture
$profilePicture = $this->getValueForPath('profilepicture');
if (
!isset($profilePicture['displayImage~'])
!is_array($profilePicture)
|| !isset($profilePicture['displayImage~'])
|| !isset($profilePicture['displayImage~']['elements'])
|| 0 == \count($profilePicture['displayImage~']['elements'])
) {
Expand Down Expand Up @@ -68,6 +69,7 @@ public function getProfilePicture()
*/
protected function getPreferredLocaleValue($path)
{
/** @var array $multiLocaleString */
$multiLocaleString = $this->getValueForPath($path);

$locale = '';
Expand Down
6 changes: 4 additions & 2 deletions OAuth/Response/SensioConnectUserResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ public function setData($data)
throw new AuthenticationException('Could not retrieve user info.');
}

$this->data = $user->item(0);
/** @var \DOMElement $userElement */
$userElement = $user->item(0);

$this->data = $userElement;
}

/**
Expand All @@ -143,7 +146,6 @@ protected function getNodeValue($query, \DOMElement $element, $nodeType = 'norma
$attribute = $node->attributes->getNamedItem('href');
$nodeValue = $attribute->value;
break;

case 'normal':
default:
$nodeValue = $node->nodeValue;
Expand Down
2 changes: 1 addition & 1 deletion OAuth/Response/UserResponseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function getTokenSecret();
/**
* Get the info when token will expire.
*
* @return string|null
* @return int|null
*/
public function getExpiresIn();

Expand Down
2 changes: 1 addition & 1 deletion Security/Core/Authentication/Token/AbstractOAuthToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function getCreatedAt()
}

/**
* @return int
* @return int|null
*/
public function getExpiresAt()
{
Expand Down
8 changes: 4 additions & 4 deletions Security/Http/Authenticator/OAuthAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,22 @@ final class OAuthAuthenticator implements AuthenticatorInterface
private $failureHandler;

/**
* @var mixed[]
* @var mixed[]|null
*/
private $rawToken;

/**
* @var string
* @var string|null
*/
private $resourceOwnerName;

/**
* @var string
* @var string|null
*/
private $refreshToken;

/**
* @var string
* @var int|null
*/
private $createdAt;

Expand Down
4 changes: 2 additions & 2 deletions Tests/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use HWI\Bundle\OAuthBundle\Security\Core\Exception\AccountNotLinkedException;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
Expand Down Expand Up @@ -45,7 +45,7 @@ class LoginControllerTest extends TestCase
private $router;

/**
* @var MockObject&AuthenticationUtils
* @var AuthenticationUtils
*/
private $authenticationUtils;

Expand Down
1 change: 0 additions & 1 deletion Tests/DependencyInjection/HWIOAuthExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ protected function setUp(): void

protected function tearDown(): void
{
$this->containerBuilder = null;
unset($this->containerBuilder);
}

Expand Down
4 changes: 3 additions & 1 deletion Tests/Fixtures/OAuthAwareException.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getExpiresIn()
}

/**
* @return OAuthToken
* {@inheritdoc}
*/
public function getRawToken()
{
Expand Down Expand Up @@ -88,6 +88,8 @@ public function setResourceOwnerName($resourceOwnerName)
}

/**
* @param OAuthToken $token
*
* {@inheritdoc}
*/
public function setToken(TokenInterface $token)
Expand Down
3 changes: 2 additions & 1 deletion Tests/OAuth/ResourceOwner/GenericOAuth2ResourceOwnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,11 @@ protected function getExpectedAuthorizationUrlWithState($stateParameter)
*
* @throws \ReflectionException
*
* @return ResourceOwnerInterface
* @return GenericOAuth2ResourceOwner
*/
protected function createResourceOwner(string $name, array $options = [], array $paths = [], ?StateInterface $state = null)
{
/** @var GenericOAuth2ResourceOwner $resourceOwner */
$resourceOwner = parent::createResourceOwner($name, $options, $paths);

$reflection = new \ReflectionClass(\get_class($resourceOwner));
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 2
level: 3
paths:
- .
excludePaths:
Expand Down

0 comments on commit fa368ed

Please sign in to comment.