mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Updated to coding-standard library v1.2.2
This commit is contained in:
@@ -33,7 +33,7 @@ abstract class AbstractTrackingAction implements MiddlewareInterface
|
||||
UrlShortenerInterface $urlShortener,
|
||||
VisitsTrackerInterface $visitTracker,
|
||||
AppOptions $appOptions,
|
||||
LoggerInterface $logger = null
|
||||
?LoggerInterface $logger = null
|
||||
) {
|
||||
$this->urlShortener = $urlShortener;
|
||||
$this->visitTracker = $visitTracker;
|
||||
|
||||
@@ -32,7 +32,7 @@ class PreviewAction implements MiddlewareInterface
|
||||
public function __construct(
|
||||
PreviewGeneratorInterface $previewGenerator,
|
||||
UrlShortenerInterface $urlShortener,
|
||||
LoggerInterface $logger = null
|
||||
?LoggerInterface $logger = null
|
||||
) {
|
||||
$this->previewGenerator = $previewGenerator;
|
||||
$this->urlShortener = $urlShortener;
|
||||
|
||||
@@ -36,7 +36,7 @@ class QrCodeAction implements MiddlewareInterface
|
||||
public function __construct(
|
||||
RouterInterface $router,
|
||||
UrlShortenerInterface $urlShortener,
|
||||
LoggerInterface $logger = null
|
||||
?LoggerInterface $logger = null
|
||||
) {
|
||||
$this->router = $router;
|
||||
$this->urlShortener = $urlShortener;
|
||||
|
||||
@@ -25,7 +25,7 @@ class RedirectAction extends AbstractTrackingAction
|
||||
VisitsTrackerInterface $visitTracker,
|
||||
Options\AppOptions $appOptions,
|
||||
Options\NotFoundShortUrlOptions $notFoundOptions,
|
||||
LoggerInterface $logger = null
|
||||
?LoggerInterface $logger = null
|
||||
) {
|
||||
parent::__construct($urlShortener, $visitTracker, $appOptions, $logger);
|
||||
$this->notFoundOptions = $notFoundOptions;
|
||||
|
||||
@@ -30,7 +30,7 @@ class ShortUrl extends AbstractEntity
|
||||
/** @var integer|null */
|
||||
private $maxVisits;
|
||||
|
||||
public function __construct(string $longUrl, ShortUrlMeta $meta = null)
|
||||
public function __construct(string $longUrl, ?ShortUrlMeta $meta = null)
|
||||
{
|
||||
$meta = $meta ?? ShortUrlMeta::createEmpty();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class DeleteShortUrlException extends RuntimeException
|
||||
/** @var int */
|
||||
private $visitsThreshold;
|
||||
|
||||
public function __construct(int $visitsThreshold, string $message = '', int $code = 0, Throwable $previous = null)
|
||||
public function __construct(int $visitsThreshold, string $message = '', int $code = 0, ?Throwable $previous = null)
|
||||
{
|
||||
$this->visitsThreshold = $visitsThreshold;
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
@@ -9,7 +9,7 @@ use function sprintf;
|
||||
|
||||
class InvalidUrlException extends RuntimeException
|
||||
{
|
||||
public static function fromUrl(string $url, Throwable $previous = null): self
|
||||
public static function fromUrl(string $url, ?Throwable $previous = null): self
|
||||
{
|
||||
$code = $previous !== null ? $previous->getCode() : -1;
|
||||
return new static(sprintf('Provided URL "%s" is not an existing and valid URL', $url), $code, $previous);
|
||||
|
||||
@@ -6,12 +6,12 @@ namespace Shlinkio\Shlink\Core\Exception;
|
||||
use Throwable;
|
||||
use Zend\InputFilter\InputFilterInterface;
|
||||
|
||||
use const PHP_EOL;
|
||||
|
||||
use function is_array;
|
||||
use function print_r;
|
||||
use function sprintf;
|
||||
|
||||
use const PHP_EOL;
|
||||
|
||||
class ValidationException extends RuntimeException
|
||||
{
|
||||
/** @var array */
|
||||
@@ -21,7 +21,7 @@ class ValidationException extends RuntimeException
|
||||
string $message = '',
|
||||
array $invalidElements = [],
|
||||
int $code = 0,
|
||||
Throwable $previous = null
|
||||
?Throwable $previous = null
|
||||
) {
|
||||
$this->invalidElements = $invalidElements;
|
||||
parent::__construct($message, $code, $previous);
|
||||
@@ -32,7 +32,7 @@ class ValidationException extends RuntimeException
|
||||
* @param \Throwable|null $prev
|
||||
* @return ValidationException
|
||||
*/
|
||||
public static function fromInputFilter(InputFilterInterface $inputFilter, Throwable $prev = null): self
|
||||
public static function fromInputFilter(InputFilterInterface $inputFilter, ?Throwable $prev = null): self
|
||||
{
|
||||
return static::fromArray($inputFilter->getMessages(), $prev);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class ValidationException extends RuntimeException
|
||||
* @param \Throwable|null $prev
|
||||
* @return ValidationException
|
||||
*/
|
||||
private static function fromArray(array $invalidData, Throwable $prev = null): self
|
||||
private static function fromArray(array $invalidData, ?Throwable $prev = null): self
|
||||
{
|
||||
return new self(
|
||||
sprintf(
|
||||
|
||||
@@ -22,9 +22,9 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI
|
||||
* @return ShortUrl[]
|
||||
*/
|
||||
public function findList(
|
||||
int $limit = null,
|
||||
int $offset = null,
|
||||
string $searchTerm = null,
|
||||
?int $limit = null,
|
||||
?int $offset = null,
|
||||
?string $searchTerm = null,
|
||||
array $tags = [],
|
||||
$orderBy = null
|
||||
): array {
|
||||
@@ -76,7 +76,7 @@ class ShortUrlRepository extends EntityRepository implements ShortUrlRepositoryI
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
public function countList(string $searchTerm = null, array $tags = []): int
|
||||
public function countList(?string $searchTerm = null, array $tags = []): int
|
||||
{
|
||||
$qb = $this->createListQueryBuilder($searchTerm, $tags);
|
||||
$qb->select('COUNT(DISTINCT s)');
|
||||
|
||||
@@ -31,7 +31,7 @@ class ShortUrlService implements ShortUrlServiceInterface
|
||||
* @param array|string|null $orderBy
|
||||
* @return ShortUrl[]|Paginator
|
||||
*/
|
||||
public function listShortUrls(int $page = 1, string $searchQuery = null, array $tags = [], $orderBy = null)
|
||||
public function listShortUrls(int $page = 1, ?string $searchQuery = null, array $tags = [], $orderBy = null)
|
||||
{
|
||||
/** @var ShortUrlRepository $repo */
|
||||
$repo = $this->em->getRepository(ShortUrl::class);
|
||||
|
||||
@@ -15,7 +15,7 @@ interface ShortUrlServiceInterface
|
||||
* @param array|string|null $orderBy
|
||||
* @return ShortUrl[]|Paginator
|
||||
*/
|
||||
public function listShortUrls(int $page = 1, string $searchQuery = null, array $tags = [], $orderBy = null);
|
||||
public function listShortUrls(int $page = 1, ?string $searchQuery = null, array $tags = [], $orderBy = null);
|
||||
|
||||
/**
|
||||
* @param string[] $tags
|
||||
|
||||
Reference in New Issue
Block a user