Skip to content

Commit a0ffe6b

Browse files
committed
fix issues reported by PHPStan
1 parent f77a9bc commit a0ffe6b

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Diff for: phpstan.neon

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ parameters:
1919
- '#Parameter \$event of method HWI\\Bundle\\OAuthBundle\\Controller\\Connect\\AbstractController::dispatch\(\) has invalid type Symfony\\Component\\EventDispatcher\\Event.#'
2020
- '#Parameter \#2 \$array of function implode expects array<string>, array<int, array\|string\|null> given.#'
2121
- '#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#'
22+
- '#Call to function method_exists\(\) with Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticator#'

Diff for: src/DependencyInjection/CompilerPass/ResourceOwnerCompilerPass.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ private function registerResourceOwnerTypeClassParameters(ContainerBuilder $cont
6767
$resourceOwnerClass = $definition->getClass();
6868

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

74-
if (!($match['type'] ?? null)) {
74+
if (0 === $result || !$match['type']) {
7575
continue;
7676
}
7777

Diff for: src/Security/Http/Firewall/RefreshAccessTokenListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function refreshToken(OAuthToken $token): OAuthToken
4040
return $this->authenticator->refreshToken($token);
4141
}
4242

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

4646
if ($authenticator instanceof OAuthAuthenticator) {

0 commit comments

Comments
 (0)