Update to PHP coding standard 2.4.0

This commit is contained in:
Alejandro Celaya
2024-10-28 22:27:30 +01:00
parent 93a277a94d
commit 3f1d61e01e
192 changed files with 465 additions and 432 deletions

View File

@@ -6,7 +6,7 @@ namespace Shlinkio\Shlink\Core\Config;
final class EmptyNotFoundRedirectConfig implements NotFoundRedirectConfigInterface
{
public function invalidShortUrlRedirect(): ?string
public function invalidShortUrlRedirect(): string|null
{
return null;
}
@@ -16,7 +16,7 @@ final class EmptyNotFoundRedirectConfig implements NotFoundRedirectConfigInterfa
return false;
}
public function regular404Redirect(): ?string
public function regular404Redirect(): string|null
{
return null;
}
@@ -26,7 +26,7 @@ final class EmptyNotFoundRedirectConfig implements NotFoundRedirectConfigInterfa
return false;
}
public function baseUrlRedirect(): ?string
public function baseUrlRedirect(): string|null
{
return null;
}

View File

@@ -6,15 +6,15 @@ namespace Shlinkio\Shlink\Core\Config;
interface NotFoundRedirectConfigInterface
{
public function invalidShortUrlRedirect(): ?string;
public function invalidShortUrlRedirect(): string|null;
public function hasInvalidShortUrlRedirect(): bool;
public function regular404Redirect(): ?string;
public function regular404Redirect(): string|null;
public function hasRegular404Redirect(): bool;
public function baseUrlRedirect(): ?string;
public function baseUrlRedirect(): string|null;
public function hasBaseUrlRedirect(): bool;
}

View File

@@ -30,7 +30,7 @@ class NotFoundRedirectResolver implements NotFoundRedirectResolverInterface
NotFoundType $notFoundType,
NotFoundRedirectConfigInterface $config,
UriInterface $currentUri,
): ?ResponseInterface {
): ResponseInterface|null {
$urlToRedirectTo = match (true) {
$notFoundType->isBaseUrl() && $config->hasBaseUrlRedirect() => $config->baseUrlRedirect(),
$notFoundType->isRegularNotFound() && $config->hasRegular404Redirect() => $config->regular404Redirect(),

View File

@@ -14,5 +14,5 @@ interface NotFoundRedirectResolverInterface
NotFoundType $notFoundType,
NotFoundRedirectConfigInterface $config,
UriInterface $currentUri,
): ?ResponseInterface;
): ResponseInterface|null;
}

View File

@@ -9,16 +9,16 @@ use JsonSerializable;
final class NotFoundRedirects implements JsonSerializable
{
private function __construct(
public readonly ?string $baseUrlRedirect,
public readonly ?string $regular404Redirect,
public readonly ?string $invalidShortUrlRedirect,
public readonly string|null $baseUrlRedirect,
public readonly string|null $regular404Redirect,
public readonly string|null $invalidShortUrlRedirect,
) {
}
public static function withRedirects(
?string $baseUrlRedirect,
?string $regular404Redirect = null,
?string $invalidShortUrlRedirect = null,
string|null $baseUrlRedirect,
string|null $regular404Redirect = null,
string|null $invalidShortUrlRedirect = null,
): self {
return new self($baseUrlRedirect, $regular404Redirect, $invalidShortUrlRedirect);
}

View File

@@ -10,9 +10,9 @@ use Shlinkio\Shlink\Core\Config\NotFoundRedirectConfigInterface;
final readonly class NotFoundRedirectOptions implements NotFoundRedirectConfigInterface
{
public function __construct(
public ?string $invalidShortUrl = null,
public ?string $regular404 = null,
public ?string $baseUrl = null,
public string|null $invalidShortUrl = null,
public string|null $regular404 = null,
public string|null $baseUrl = null,
) {
}
@@ -25,7 +25,7 @@ final readonly class NotFoundRedirectOptions implements NotFoundRedirectConfigIn
);
}
public function invalidShortUrlRedirect(): ?string
public function invalidShortUrlRedirect(): string|null
{
return $this->invalidShortUrl;
}
@@ -35,7 +35,7 @@ final readonly class NotFoundRedirectOptions implements NotFoundRedirectConfigIn
return $this->invalidShortUrl !== null;
}
public function regular404Redirect(): ?string
public function regular404Redirect(): string|null
{
return $this->regular404;
}
@@ -45,7 +45,7 @@ final readonly class NotFoundRedirectOptions implements NotFoundRedirectConfigIn
return $this->regular404 !== null;
}
public function baseUrlRedirect(): ?string
public function baseUrlRedirect(): string|null
{
return $this->baseUrl;
}

View File

@@ -26,7 +26,7 @@ final readonly class QrCodeOptions
public bool $enabledForDisabledShortUrls = DEFAULT_QR_CODE_ENABLED_FOR_DISABLED_SHORT_URLS,
public string $color = DEFAULT_QR_CODE_COLOR,
public string $bgColor = DEFAULT_QR_CODE_BG_COLOR,
public ?string $logoUrl = null,
public string|null $logoUrl = null,
) {
}

View File

@@ -22,7 +22,7 @@ final readonly class TrackingOptions
public bool $trackOrphanVisits = true,
// A query param that, if provided, will disable tracking of one particular visit. Always takes precedence over
// other options
public ?string $disableTrackParam = null,
public string|null $disableTrackParam = null,
// If true, visits will not be tracked at all
public bool $disableTracking = false,
// If true, visits will be tracked, but neither the IP address, nor the location will be resolved