Skip to content

Commit aabe72a

Browse files
authored
Rector/ECS (#792)
Refactor constructor signatures and assertions in various classes for improved clarity
1 parent cb78e7a commit aabe72a

25 files changed

+445
-538
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
"symfony/monolog-bundle": "^3.8",
122122
"symfony/twig-bundle": "^6.4|^7.0",
123123
"symfony/var-dumper": "^6.4|^7.0",
124+
"symfony/var-exporter": "^6.4|^7.0",
124125
"symfony/yaml": "^6.4|^7.0",
125126
"symplify/easy-coding-standard": "^12.0",
126127
"web-token/jwt-library": "^4.0"

phpstan-baseline.neon

Lines changed: 406 additions & 493 deletions
Large diffs are not rendered by default.

src/symfony/src/DependencyInjection/WebauthnExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function load(array $configs, ContainerBuilder $container): void
124124
}
125125
}
126126

127-
public function getConfiguration(array $config, ContainerBuilder $container): ?ConfigurationInterface
127+
public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface
128128
{
129129
return new Configuration($this->alias);
130130
}

src/symfony/src/Security/Http/Authenticator/WebauthnAuthenticator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function setLogger(LoggerInterface $logger): void
6868
$this->logger = $logger;
6969
}
7070

71-
public function supports(Request $request): ?bool
71+
public function supports(Request $request): bool
7272
{
7373
if ($request->getMethod() !== Request::METHOD_POST) {
7474
return false;
@@ -144,7 +144,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
144144
return $this->successHandler->onAuthenticationSuccess($request, $token);
145145
}
146146

147-
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
147+
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response
148148
{
149149
$this->logger->info('Webauthn authentication request failed.', [
150150
'request' => $request,

src/symfony/src/WebauthnBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
final class WebauthnBundle extends Bundle
2828
{
29-
public function getContainerExtension(): ?ExtensionInterface
29+
public function getContainerExtension(): ExtensionInterface
3030
{
3131
return new WebauthnExtension('webauthn');
3232
}

src/webauthn/src/AttestationStatement/TPMAttestationStatementSupport.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ final class TPMAttestationStatementSupport implements AttestationStatementSuppor
4141

4242
private readonly ClockInterface $clock;
4343

44-
public function __construct(
45-
null|ClockInterface $clock = null
46-
) {
44+
public function __construct(null|ClockInterface $clock = null)
45+
{
4746
$this->clock = $clock ?? new NativeClock();
4847
$this->dispatcher = new NullEventDispatcher();
4948
}

src/webauthn/src/CeremonyStep/CeremonyStepManagerFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function requestCeremony(): CeremonyStepManager
161161
$this->allowedOrigins === null ? new CheckOrigin(
162162
$this->securedRelyingPartyId ?? []
163163
) : new CheckAllowedOrigins($this->allowedOrigins, $this->allowSubdomains),
164-
new CheckTopOrigin(null),
164+
new CheckTopOrigin(),
165165
new CheckRelyingPartyIdIdHash(),
166166
new CheckUserWasPresent(),
167167
new CheckUserVerification(),

src/webauthn/src/CeremonyStep/CheckClientDataCollectorType.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
{
1717
private ClientDataCollectorManager $clientDataCollectorManager;
1818

19-
public function __construct(
20-
null|ClientDataCollectorManager $clientDataCollectorManager = null,
21-
) {
19+
public function __construct(null|ClientDataCollectorManager $clientDataCollectorManager = null)
20+
{
2221
$this->clientDataCollectorManager = $clientDataCollectorManager ?? new ClientDataCollectorManager([
2322
new WebauthnAuthenticationCollector(),
2423
]);

src/webauthn/src/CeremonyStep/CheckSignature.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@
2626
{
2727
private Manager $algorithmManager;
2828

29-
public function __construct(
30-
null|Manager $algorithmManager = null,
31-
) {
29+
public function __construct(null|Manager $algorithmManager = null)
30+
{
3231
$this->algorithmManager = $algorithmManager ?? Manager::create()->add(ES256::create(), RS256::create());
3332
}
3433

src/webauthn/src/MetadataService/Service/JsonMetadataService.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ final class JsonMetadataService implements MetadataService, CanDispatchEvents
3030
/**
3131
* @param string[] $statements
3232
*/
33-
public function __construct(
34-
array $statements,
35-
?SerializerInterface $serializer = null,
36-
) {
33+
public function __construct(array $statements, ?SerializerInterface $serializer = null)
34+
{
3735
$this->dispatcher = new NullEventDispatcher();
3836
$this->serializer = $serializer ?? (new WebauthnSerializerFactory(
3937
AttestationStatementSupportManager::create()

0 commit comments

Comments
 (0)