Increased phpstan level to 8

This commit is contained in:
Alejandro Celaya
2021-07-20 12:51:07 +02:00
parent 2eeb762cd9
commit 95770ac104
8 changed files with 27 additions and 20 deletions

View File

@@ -19,7 +19,7 @@ final class ShortUrlsParams
private array $tags;
private ShortUrlsOrdering $orderBy;
private ?DateRange $dateRange;
private ?int $itemsPerPage = null;
private int $itemsPerPage;
private function __construct()
{

View File

@@ -29,13 +29,16 @@ final class Visitor
$this->userAgent = $this->cropToLength($userAgent, self::USER_AGENT_MAX_LENGTH);
$this->referer = $this->cropToLength($referer, self::REFERER_MAX_LENGTH);
$this->visitedUrl = $this->cropToLength($visitedUrl, self::VISITED_URL_MAX_LENGTH);
$this->remoteAddress = $this->cropToLength($remoteAddress, self::REMOTE_ADDRESS_MAX_LENGTH);
$this->remoteAddress = $remoteAddress === null ? null : $this->cropToLength(
$remoteAddress,
self::REMOTE_ADDRESS_MAX_LENGTH,
);
$this->potentialBot = isCrawler($userAgent);
}
private function cropToLength(?string $value, int $length): ?string
private function cropToLength(string $value, int $length): string
{
return $value === null ? null : substr($value, 0, $length);
return substr($value, 0, $length);
}
public static function fromRequest(ServerRequestInterface $request): self

View File

@@ -13,7 +13,7 @@ final class VisitsParams
private const FIRST_PAGE = 1;
private const ALL_ITEMS = -1;
private ?DateRange $dateRange;
private DateRange $dateRange;
private int $itemsPerPage;
public function __construct(