Update to PHP coding standard 2.4.0

This commit is contained in:
Alejandro Celaya
2024-11-03 11:38:31 +01:00
parent 93a277a94d
commit 3f1d61e01e
192 changed files with 465 additions and 432 deletions
@@ -30,11 +30,11 @@ class DomainRedirectsRequestTest extends TestCase
#[Test, DataProvider('provideValidData')]
public function isProperlyCastToNotFoundRedirects(
array $data,
?NotFoundRedirectConfigInterface $defaults,
NotFoundRedirectConfigInterface|null $defaults,
string $expectedAuthority,
?string $expectedBaseUrlRedirect,
?string $expectedRegular404Redirect,
?string $expectedInvalidShortUrlRedirect,
string|null $expectedBaseUrlRedirect,
string|null $expectedRegular404Redirect,
string|null $expectedInvalidShortUrlRedirect,
): void {
$request = DomainRedirectsRequest::fromRawData($data);
$notFound = $request->toNotFoundRedirects($defaults);
@@ -49,7 +49,7 @@ class MercureInfoActionTest extends TestCase
}
#[Test, DataProvider('provideDays')]
public function returnsExpectedInfoWhenEverythingIsOk(?int $days): void
public function returnsExpectedInfoWhenEverythingIsOk(int|null $days): void
{
$this->provider->expects($this->once())->method('buildSubscriptionToken')->willReturn('abc.123');
@@ -39,11 +39,11 @@ class ListShortUrlsActionTest extends TestCase
public function properListReturnsSuccessResponse(
array $query,
int $expectedPage,
?string $expectedSearchTerm,
string|null $expectedSearchTerm,
array $expectedTags,
?string $expectedOrderBy,
?string $startDate = null,
?string $endDate = null,
string|null $expectedOrderBy,
string|null $startDate = null,
string|null $endDate = null,
): void {
$apiKey = ApiKey::create();
$request = ServerRequestFactory::fromGlobals()->withQueryParams($query)
@@ -25,7 +25,7 @@ class DeleteTagsActionTest extends TestCase
}
#[Test, DataProvider('provideTags')]
public function processDelegatesIntoService(?array $tags): void
public function processDelegatesIntoService(array|null $tags): void
{
$request = (new ServerRequest())
->withQueryParams(['tags' => $tags])
@@ -82,7 +82,7 @@ class CrossDomainMiddlewareTest extends TestCase
#[Test, DataProvider('provideRouteResults')]
public function optionsRequestParsesRouteMatchToDetermineAllowedMethods(
?string $allowHeader,
string|null $allowHeader,
string $expectedAllowedMethods,
): void {
$originalResponse = new Response();
@@ -40,7 +40,7 @@ class CreateShortUrlContentNegotiationMiddlewareTest extends TestCase
}
#[Test, DataProvider('provideData')]
public function properResponseIsReturned(?string $accept, array $query, string $expectedContentType): void
public function properResponseIsReturned(string|null $accept, array $query, string $expectedContentType): void
{
$request = (new ServerRequest())->withQueryParams($query);
if ($accept !== null) {
@@ -35,7 +35,7 @@ class ApiKeyServiceTest extends TestCase
* @param RoleDefinition[] $roles
*/
#[Test, DataProvider('provideCreationDate')]
public function apiKeyIsProperlyCreated(?Chronos $date, ?string $name, array $roles): void
public function apiKeyIsProperlyCreated(Chronos|null $date, string|null $name, array $roles): void
{
$this->em->expects($this->once())->method('flush');
$this->em->expects($this->once())->method('persist')->with($this->isInstanceOf(ApiKey::class));
@@ -68,7 +68,7 @@ class ApiKeyServiceTest extends TestCase
}
#[Test, DataProvider('provideInvalidApiKeys')]
public function checkReturnsFalseForInvalidApiKeys(?ApiKey $invalidKey): void
public function checkReturnsFalseForInvalidApiKeys(ApiKey|null $invalidKey): void
{
$this->repo->expects($this->once())->method('findOneBy')->with(['key' => '12345'])->willReturn($invalidKey);
$this->em->method('getRepository')->with(ApiKey::class)->willReturn($this->repo);
@@ -154,7 +154,7 @@ class ApiKeyServiceTest extends TestCase
}
#[Test, DataProvider('provideInitialApiKeys')]
public function createInitialDelegatesToRepository(?ApiKey $apiKey): void
public function createInitialDelegatesToRepository(ApiKey|null $apiKey): void
{
$this->repo->expects($this->once())->method('createInitialApiKey')->with('the_key')->willReturn($apiKey);
$this->em->method('getRepository')->with(ApiKey::class)->willReturn($this->repo);