Skip to content

Commit

Permalink
fix issues reported by PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jan 1, 2025
1 parent f77a9bc commit a0ffe6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ parameters:
- '#Parameter \$event of method HWI\\Bundle\\OAuthBundle\\Controller\\Connect\\AbstractController::dispatch\(\) has invalid type Symfony\\Component\\EventDispatcher\\Event.#'
- '#Parameter \#2 \$array of function implode expects array<string>, array<int, array\|string\|null> given.#'
- '#PHPDoc type DOMNode of property HWI\\Bundle\\OAuthBundle\\OAuth\\Response\\SensioConnectUserResponse::\$data is not covariant with PHPDoc type array of overridden property HWI\\Bundle\\OAuthBundle\\OAuth\\Response\\AbstractUserResponse::\$data#'
- '#Call to function method_exists\(\) with Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticator#'
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ private function registerResourceOwnerTypeClassParameters(ContainerBuilder $cont
$resourceOwnerClass = $definition->getClass();

// Check whether a ResourceOwner class exists only if resource owner was set by its "options.type"
if (false === preg_match('~^%(?P<parameter>hwi_oauth.resource_owner.(?P<type>.+).class)%$~', $resourceOwnerClass, $match)) {
if (false === $result = preg_match('~^%(?P<parameter>hwi_oauth.resource_owner.(?P<type>.+).class)%$~', $resourceOwnerClass, $match)) {
return;
}

if (!($match['type'] ?? null)) {
if (0 === $result || !$match['type']) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Security/Http/Firewall/RefreshAccessTokenListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function refreshToken(OAuthToken $token): OAuthToken
return $this->authenticator->refreshToken($token);
}

if ($this->authenticator instanceof TraceableAuthenticator) {
if ($this->authenticator instanceof TraceableAuthenticator && method_exists($this->authenticator, 'getAuthenticator')) {
$authenticator = $this->authenticator->getAuthenticator();

if ($authenticator instanceof OAuthAuthenticator) {
Expand Down

0 comments on commit a0ffe6b

Please sign in to comment.