mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Drop support for PHP 8.2
This commit is contained in:
@@ -30,9 +30,9 @@ use const Shlinkio\Shlink\DEFAULT_QR_CODE_COLOR;
|
||||
|
||||
final class QrCodeParams
|
||||
{
|
||||
private const MIN_SIZE = 50;
|
||||
private const MAX_SIZE = 1000;
|
||||
private const SUPPORTED_FORMATS = ['png', 'svg'];
|
||||
private const int MIN_SIZE = 50;
|
||||
private const int MAX_SIZE = 1000;
|
||||
private const array SUPPORTED_FORMATS = ['png', 'svg'];
|
||||
|
||||
private function __construct(
|
||||
public readonly int $size,
|
||||
|
||||
@@ -17,8 +17,8 @@ use function urlencode;
|
||||
|
||||
class NotFoundRedirectResolver implements NotFoundRedirectResolverInterface
|
||||
{
|
||||
private const DOMAIN_PLACEHOLDER = '{DOMAIN}';
|
||||
private const ORIGINAL_PATH_PLACEHOLDER = '{ORIGINAL_PATH}';
|
||||
private const string DOMAIN_PLACEHOLDER = '{DOMAIN}';
|
||||
private const string ORIGINAL_PATH_PLACEHOLDER = '{ORIGINAL_PATH}';
|
||||
|
||||
public function __construct(
|
||||
private readonly RedirectResponseHelperInterface $redirectResponseHelper,
|
||||
|
||||
@@ -8,7 +8,7 @@ use function array_map;
|
||||
|
||||
class BasePathPrefixer
|
||||
{
|
||||
private const ELEMENTS_WITH_PATH = ['routes', 'middleware_pipeline'];
|
||||
private const array ELEMENTS_WITH_PATH = ['routes', 'middleware_pipeline'];
|
||||
|
||||
public function __invoke(array $config): array
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ use function str_replace;
|
||||
|
||||
class MultiSegmentSlugProcessor
|
||||
{
|
||||
private const SINGLE_SEGMENT_PATTERN = '{shortCode}';
|
||||
private const MULTI_SEGMENT_PATTERN = '{shortCode:.+}';
|
||||
private const string SINGLE_SEGMENT_PATTERN = '{shortCode}';
|
||||
private const string MULTI_SEGMENT_PATTERN = '{shortCode:.+}';
|
||||
|
||||
public function __invoke(array $config): array
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ use Shlinkio\Shlink\Core\Config\NotFoundRedirects;
|
||||
|
||||
class Domain extends AbstractEntity implements JsonSerializable, NotFoundRedirectConfigInterface
|
||||
{
|
||||
public const DEFAULT_AUTHORITY = 'DEFAULT';
|
||||
public const string DEFAULT_AUTHORITY = 'DEFAULT';
|
||||
|
||||
private function __construct(
|
||||
public readonly string $authority,
|
||||
|
||||
@@ -11,10 +11,10 @@ use Shlinkio\Shlink\Common\Validation\InputFactory;
|
||||
/** @extends InputFilter<mixed> */
|
||||
class DomainRedirectsInputFilter extends InputFilter
|
||||
{
|
||||
public const DOMAIN = 'domain';
|
||||
public const BASE_URL_REDIRECT = 'baseUrlRedirect';
|
||||
public const REGULAR_404_REDIRECT = 'regular404Redirect';
|
||||
public const INVALID_SHORT_URL_REDIRECT = 'invalidShortUrlRedirect';
|
||||
public const string DOMAIN = 'domain';
|
||||
public const string BASE_URL_REDIRECT = 'baseUrlRedirect';
|
||||
public const string REGULAR_404_REDIRECT = 'regular404Redirect';
|
||||
public const string INVALID_SHORT_URL_REDIRECT = 'invalidShortUrlRedirect';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
|
||||
@@ -17,9 +17,9 @@ use function sprintf;
|
||||
|
||||
class NotFoundTemplateHandler implements RequestHandlerInterface
|
||||
{
|
||||
private const TEMPLATES_BASE_DIR = __DIR__ . '/../../templates';
|
||||
public const NOT_FOUND_TEMPLATE = '404.html';
|
||||
public const INVALID_SHORT_CODE_TEMPLATE = 'invalid-short-code.html';
|
||||
private const string TEMPLATES_BASE_DIR = __DIR__ . '/../../templates';
|
||||
public const string NOT_FOUND_TEMPLATE = '404.html';
|
||||
public const string INVALID_SHORT_CODE_TEMPLATE = 'invalid-short-code.html';
|
||||
|
||||
private Closure $readFile;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ class DeleteShortUrlException extends DomainException implements ProblemDetailsE
|
||||
{
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Cannot delete short URL';
|
||||
public const ERROR_CODE = 'invalid-short-url-deletion';
|
||||
private const string TITLE = 'Cannot delete short URL';
|
||||
public const string ERROR_CODE = 'invalid-short-url-deletion';
|
||||
|
||||
public static function fromVisitsThreshold(int $threshold, ShortUrlIdentifier $identifier): self
|
||||
{
|
||||
|
||||
@@ -15,8 +15,8 @@ class DomainNotFoundException extends DomainException implements ProblemDetailsE
|
||||
{
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Domain not found';
|
||||
public const ERROR_CODE = 'domain-not-found';
|
||||
private const string TITLE = 'Domain not found';
|
||||
public const string ERROR_CODE = 'domain-not-found';
|
||||
|
||||
private function __construct(string $message, array $additional)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ class ForbiddenTagOperationException extends DomainException implements ProblemD
|
||||
{
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Forbidden tag operation';
|
||||
public const ERROR_CODE = 'forbidden-tag-operation';
|
||||
private const string TITLE = 'Forbidden tag operation';
|
||||
public const string ERROR_CODE = 'forbidden-tag-operation';
|
||||
|
||||
public static function forDeletion(): self
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ class NonUniqueSlugException extends InvalidArgumentException implements Problem
|
||||
{
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Invalid custom slug';
|
||||
public const ERROR_CODE = 'non-unique-slug';
|
||||
private const string TITLE = 'Invalid custom slug';
|
||||
public const string ERROR_CODE = 'non-unique-slug';
|
||||
|
||||
public static function fromSlug(string $slug, string|null $domain = null): self
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ class ShortUrlNotFoundException extends DomainException implements ProblemDetail
|
||||
{
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Short URL not found';
|
||||
public const ERROR_CODE = 'short-url-not-found';
|
||||
private const string TITLE = 'Short URL not found';
|
||||
public const string ERROR_CODE = 'short-url-not-found';
|
||||
|
||||
public static function fromNotFound(ShortUrlIdentifier $identifier): self
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ class TagConflictException extends RuntimeException implements ProblemDetailsExc
|
||||
{
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Tag conflict';
|
||||
public const ERROR_CODE = 'tag-conflict';
|
||||
private const string TITLE = 'Tag conflict';
|
||||
public const string ERROR_CODE = 'tag-conflict';
|
||||
|
||||
public static function forExistingTag(Renaming $renaming): self
|
||||
{
|
||||
|
||||
@@ -15,8 +15,8 @@ class TagNotFoundException extends DomainException implements ProblemDetailsExce
|
||||
{
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Tag not found';
|
||||
public const ERROR_CODE = 'tag-not-found';
|
||||
private const string TITLE = 'Tag not found';
|
||||
public const string ERROR_CODE = 'tag-not-found';
|
||||
|
||||
public static function fromTag(string $tag): self
|
||||
{
|
||||
|
||||
@@ -21,8 +21,8 @@ class ValidationException extends InvalidArgumentException implements ProblemDet
|
||||
{
|
||||
use CommonProblemDetailsExceptionTrait;
|
||||
|
||||
private const TITLE = 'Invalid data';
|
||||
public const ERROR_CODE = 'invalid-data';
|
||||
private const string TITLE = 'Invalid data';
|
||||
public const string ERROR_CODE = 'invalid-data';
|
||||
|
||||
private array $invalidElements;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use Shlinkio\Shlink\Core\Exception\RuntimeException;
|
||||
|
||||
readonly class MatomoTrackerBuilder implements MatomoTrackerBuilderInterface
|
||||
{
|
||||
public const MATOMO_DEFAULT_TIMEOUT = 10; // Time in seconds
|
||||
public const int MATOMO_DEFAULT_TIMEOUT = 10; // Time in seconds
|
||||
|
||||
public function __construct(private MatomoOptions $options)
|
||||
{
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace Shlinkio\Shlink\Core\Model;
|
||||
|
||||
final readonly class Ordering
|
||||
{
|
||||
private const DESC_DIR = 'DESC';
|
||||
private const ASC_DIR = 'ASC';
|
||||
private const DEFAULT_DIR = self::ASC_DIR;
|
||||
private const string DESC_DIR = 'DESC';
|
||||
private const string ASC_DIR = 'ASC';
|
||||
private const string DEFAULT_DIR = self::ASC_DIR;
|
||||
|
||||
public function __construct(public string|null $field = null, public string $direction = self::DEFAULT_DIR)
|
||||
{
|
||||
|
||||
@@ -17,14 +17,14 @@ use function Shlinkio\Shlink\Core\enumValues;
|
||||
/** @extends InputFilter<mixed> */
|
||||
class RedirectRulesInputFilter extends InputFilter
|
||||
{
|
||||
public const REDIRECT_RULES = 'redirectRules';
|
||||
public const string REDIRECT_RULES = 'redirectRules';
|
||||
|
||||
public const RULE_LONG_URL = 'longUrl';
|
||||
public const RULE_CONDITIONS = 'conditions';
|
||||
public const string RULE_LONG_URL = 'longUrl';
|
||||
public const string RULE_CONDITIONS = 'conditions';
|
||||
|
||||
public const CONDITION_TYPE = 'type';
|
||||
public const CONDITION_MATCH_VALUE = 'matchValue';
|
||||
public const CONDITION_MATCH_KEY = 'matchKey';
|
||||
public const string CONDITION_TYPE = 'type';
|
||||
public const string CONDITION_MATCH_VALUE = 'matchValue';
|
||||
public const string CONDITION_MATCH_KEY = 'matchKey';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
|
||||
@@ -21,14 +21,14 @@ use function trim;
|
||||
|
||||
readonly class ShortUrlTitleResolutionHelper implements ShortUrlTitleResolutionHelperInterface
|
||||
{
|
||||
public const MAX_REDIRECTS = 15;
|
||||
public const CHROME_USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
|
||||
public const int MAX_REDIRECTS = 15;
|
||||
public const string CHROME_USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
|
||||
. 'Chrome/121.0.0.0 Safari/537.36';
|
||||
|
||||
// Matches the value inside a html title tag
|
||||
private const TITLE_TAG_VALUE = '/<title[^>]*>(.*?)<\/title>/i';
|
||||
private const string TITLE_TAG_VALUE = '/<title[^>]*>(.*?)<\/title>/i';
|
||||
// Matches the charset inside a Content-Type header
|
||||
private const CHARSET_VALUE = '/charset=([^;]+)/i';
|
||||
private const string CHARSET_VALUE = '/charset=([^;]+)/i';
|
||||
|
||||
public function __construct(
|
||||
private ClientInterface $httpClient,
|
||||
|
||||
@@ -14,7 +14,7 @@ use function rtrim;
|
||||
|
||||
class TrimTrailingSlashMiddleware implements MiddlewareInterface
|
||||
{
|
||||
private const SHORT_CODE_ATTR = 'shortCode';
|
||||
private const string SHORT_CODE_ATTR = 'shortCode';
|
||||
|
||||
public function __construct(private readonly UrlShortenerOptions $options)
|
||||
{
|
||||
|
||||
@@ -12,8 +12,8 @@ use function strpbrk;
|
||||
|
||||
class CustomSlugValidator extends AbstractValidator
|
||||
{
|
||||
private const NOT_STRING = 'NOT_STRING';
|
||||
private const CONTAINS_URL_CHARACTERS = 'CONTAINS_URL_CHARACTERS';
|
||||
private const string NOT_STRING = 'NOT_STRING';
|
||||
private const string CONTAINS_URL_CHARACTERS = 'CONTAINS_URL_CHARACTERS';
|
||||
|
||||
protected array $messageTemplates = [
|
||||
self::NOT_STRING => 'Provided value is not a string.',
|
||||
|
||||
@@ -24,22 +24,22 @@ use const Shlinkio\Shlink\MIN_SHORT_CODES_LENGTH;
|
||||
class ShortUrlInputFilter extends InputFilter
|
||||
{
|
||||
// Fields for creation only
|
||||
public const SHORT_CODE_LENGTH = 'shortCodeLength';
|
||||
public const CUSTOM_SLUG = 'customSlug';
|
||||
public const PATH_PREFIX = 'pathPrefix';
|
||||
public const FIND_IF_EXISTS = 'findIfExists';
|
||||
public const DOMAIN = 'domain';
|
||||
public const string SHORT_CODE_LENGTH = 'shortCodeLength';
|
||||
public const string CUSTOM_SLUG = 'customSlug';
|
||||
public const string PATH_PREFIX = 'pathPrefix';
|
||||
public const string FIND_IF_EXISTS = 'findIfExists';
|
||||
public const string DOMAIN = 'domain';
|
||||
|
||||
// Fields for creation and edition
|
||||
public const LONG_URL = 'longUrl';
|
||||
public const VALID_SINCE = 'validSince';
|
||||
public const VALID_UNTIL = 'validUntil';
|
||||
public const MAX_VISITS = 'maxVisits';
|
||||
public const TITLE = 'title';
|
||||
public const TAGS = 'tags';
|
||||
public const CRAWLABLE = 'crawlable';
|
||||
public const FORWARD_QUERY = 'forwardQuery';
|
||||
public const API_KEY = 'apiKey';
|
||||
public const string LONG_URL = 'longUrl';
|
||||
public const string VALID_SINCE = 'validSince';
|
||||
public const string VALID_UNTIL = 'validUntil';
|
||||
public const string MAX_VISITS = 'maxVisits';
|
||||
public const string TITLE = 'title';
|
||||
public const string TAGS = 'tags';
|
||||
public const string CRAWLABLE = 'crawlable';
|
||||
public const string FORWARD_QUERY = 'forwardQuery';
|
||||
public const string API_KEY = 'apiKey';
|
||||
|
||||
public static function forCreation(array $data, UrlShortenerOptions $options): self
|
||||
{
|
||||
|
||||
@@ -16,17 +16,17 @@ use function Shlinkio\Shlink\Core\enumValues;
|
||||
/** @extends InputFilter<mixed> */
|
||||
class ShortUrlsParamsInputFilter extends InputFilter
|
||||
{
|
||||
public const PAGE = 'page';
|
||||
public const SEARCH_TERM = 'searchTerm';
|
||||
public const TAGS = 'tags';
|
||||
public const START_DATE = 'startDate';
|
||||
public const END_DATE = 'endDate';
|
||||
public const ITEMS_PER_PAGE = 'itemsPerPage';
|
||||
public const TAGS_MODE = 'tagsMode';
|
||||
public const ORDER_BY = 'orderBy';
|
||||
public const EXCLUDE_MAX_VISITS_REACHED = 'excludeMaxVisitsReached';
|
||||
public const EXCLUDE_PAST_VALID_UNTIL = 'excludePastValidUntil';
|
||||
public const DOMAIN = 'domain';
|
||||
public const string PAGE = 'page';
|
||||
public const string SEARCH_TERM = 'searchTerm';
|
||||
public const string TAGS = 'tags';
|
||||
public const string START_DATE = 'startDate';
|
||||
public const string END_DATE = 'endDate';
|
||||
public const string ITEMS_PER_PAGE = 'itemsPerPage';
|
||||
public const string TAGS_MODE = 'tagsMode';
|
||||
public const string ORDER_BY = 'orderBy';
|
||||
public const string EXCLUDE_MAX_VISITS_REACHED = 'excludeMaxVisitsReached';
|
||||
public const string EXCLUDE_PAST_VALID_UNTIL = 'excludePastValidUntil';
|
||||
public const string DOMAIN = 'domain';
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
|
||||
@@ -17,11 +17,11 @@ use const Shlinkio\Shlink\REDIRECT_URL_REQUEST_ATTRIBUTE;
|
||||
|
||||
final readonly class Visitor
|
||||
{
|
||||
public const USER_AGENT_MAX_LENGTH = 512;
|
||||
public const REFERER_MAX_LENGTH = 1024;
|
||||
public const REMOTE_ADDRESS_MAX_LENGTH = 256;
|
||||
public const VISITED_URL_MAX_LENGTH = 2048;
|
||||
public const REDIRECT_URL_MAX_LENGTH = 2048;
|
||||
public const int USER_AGENT_MAX_LENGTH = 512;
|
||||
public const int REFERER_MAX_LENGTH = 1024;
|
||||
public const int REMOTE_ADDRESS_MAX_LENGTH = 256;
|
||||
public const int VISITED_URL_MAX_LENGTH = 2048;
|
||||
public const int REDIRECT_URL_MAX_LENGTH = 2048;
|
||||
|
||||
private function __construct(
|
||||
public string $userAgent,
|
||||
|
||||
@@ -9,7 +9,7 @@ use Shlinkio\Shlink\Core\Visit\Entity\Visit;
|
||||
|
||||
interface VisitIterationRepositoryInterface
|
||||
{
|
||||
public const DEFAULT_BLOCK_SIZE = 10000;
|
||||
public const int DEFAULT_BLOCK_SIZE = 10000;
|
||||
|
||||
/**
|
||||
* @return iterable<Visit>
|
||||
|
||||
Reference in New Issue
Block a user