From ce8d5dc36bb49846faef26cac123c82f6908cf0d Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Mon, 26 Feb 2024 15:40:26 +0100 Subject: [PATCH] fix most recent cs fixer rule changes --- .../Factory/Loader/AbstractLoaderFactory.php | 2 +- .../Factory/Resolver/AbstractResolverFactory.php | 2 +- src/Events/CacheResolveEvent.php | 2 +- src/Factory/Config/Filter/Argument/PointFactory.php | 2 +- src/Imagine/Cache/CacheManager.php | 12 ++++++------ src/Imagine/Data/DataManager.php | 4 ++-- .../Filter/PostProcessor/JpegOptimPostProcessor.php | 2 +- .../Filter/PostProcessor/MozJpegPostProcessor.php | 2 +- .../Filter/PostProcessor/OptiPngPostProcessor.php | 2 +- src/Model/Binary.php | 2 +- src/Model/FileBinary.php | 2 +- src/Service/FilterService.php | 4 ++-- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/DependencyInjection/Factory/Loader/AbstractLoaderFactory.php b/src/DependencyInjection/Factory/Loader/AbstractLoaderFactory.php index 3cf0f188c..515a0111b 100644 --- a/src/DependencyInjection/Factory/Loader/AbstractLoaderFactory.php +++ b/src/DependencyInjection/Factory/Loader/AbstractLoaderFactory.php @@ -19,7 +19,7 @@ abstract class AbstractLoaderFactory implements LoaderFactoryInterface { protected static string $namePrefix = 'liip_imagine.binary.loader'; - final protected function getChildLoaderDefinition(string $name = null): ChildDefinition + final protected function getChildLoaderDefinition(?string $name = null): ChildDefinition { return new ChildDefinition(sprintf('%s.prototype.%s', static::$namePrefix, $name ?: $this->getName())); } diff --git a/src/DependencyInjection/Factory/Resolver/AbstractResolverFactory.php b/src/DependencyInjection/Factory/Resolver/AbstractResolverFactory.php index c3de07770..bb11d114e 100644 --- a/src/DependencyInjection/Factory/Resolver/AbstractResolverFactory.php +++ b/src/DependencyInjection/Factory/Resolver/AbstractResolverFactory.php @@ -17,7 +17,7 @@ abstract class AbstractResolverFactory implements ResolverFactoryInterface { protected static string $namePrefix = 'liip_imagine.cache.resolver'; - final protected function getChildResolverDefinition(string $name = null): ChildDefinition + final protected function getChildResolverDefinition(?string $name = null): ChildDefinition { return new ChildDefinition(sprintf('%s.prototype.%s', static::$namePrefix, $name ?: $this->getName())); } diff --git a/src/Events/CacheResolveEvent.php b/src/Events/CacheResolveEvent.php index 46b9a82de..dcec6ef32 100644 --- a/src/Events/CacheResolveEvent.php +++ b/src/Events/CacheResolveEvent.php @@ -33,7 +33,7 @@ class CacheResolveEvent extends Event /** * Init default event state. */ - public function __construct(string $path, string $filter, string $url = null) + public function __construct(string $path, string $filter, ?string $url = null) { $this->path = $path; $this->filter = $filter; diff --git a/src/Factory/Config/Filter/Argument/PointFactory.php b/src/Factory/Config/Filter/Argument/PointFactory.php index e412bcc73..d4938c173 100644 --- a/src/Factory/Config/Filter/Argument/PointFactory.php +++ b/src/Factory/Config/Filter/Argument/PointFactory.php @@ -21,7 +21,7 @@ */ final class PointFactory { - public function create(int $x = null, int $y = null): Point + public function create(?int $x = null, ?int $y = null): Point { return new Point($x, $y); } diff --git a/src/Imagine/Cache/CacheManager.php b/src/Imagine/Cache/CacheManager.php index 4a1da10a0..67256c8b9 100644 --- a/src/Imagine/Cache/CacheManager.php +++ b/src/Imagine/Cache/CacheManager.php @@ -48,7 +48,7 @@ public function __construct( RouterInterface $router, SignerInterface $signer, EventDispatcherInterface $dispatcher, - string $defaultResolver = null, + ?string $defaultResolver = null, bool $webpGenerate = false ) { $this->filterConfig = $filterConfig; @@ -77,7 +77,7 @@ public function addResolver(string $filter, ResolverInterface $resolver): void * * @param string $path The path where the resolved file is expected */ - public function getBrowserPath(string $path, string $filter, array $runtimeConfig = [], string $resolver = null, int $referenceType = UrlGeneratorInterface::ABSOLUTE_URL): string + public function getBrowserPath(string $path, string $filter, array $runtimeConfig = [], ?string $resolver = null, int $referenceType = UrlGeneratorInterface::ABSOLUTE_URL): string { if (!empty($runtimeConfig)) { $rcPath = $this->getRuntimePath($path, $runtimeConfig); @@ -109,7 +109,7 @@ public function getRuntimePath(string $path, array $runtimeConfig): string * @param string $filter The name of the imagine filter in effect * @param int $referenceType The type of reference to be generated (one of the UrlGenerator constants) */ - public function generateUrl(string $path, string $filter, array $runtimeConfig = [], string $resolver = null, int $referenceType = UrlGeneratorInterface::ABSOLUTE_URL): string + public function generateUrl(string $path, string $filter, array $runtimeConfig = [], ?string $resolver = null, int $referenceType = UrlGeneratorInterface::ABSOLUTE_URL): string { $params = [ 'path' => ltrim($path, '/'), @@ -135,7 +135,7 @@ public function generateUrl(string $path, string $filter, array $runtimeConfig = /** * Checks whether the path is already stored within the respective Resolver. */ - public function isStored(string $path, string $filter, string $resolver = null): bool + public function isStored(string $path, string $filter, ?string $resolver = null): bool { return $this->getResolver($filter, $resolver)->isStored($path, $filter); } @@ -147,7 +147,7 @@ public function isStored(string $path, string $filter, string $resolver = null): * * @return string The url of resolved image */ - public function resolve(string $path, string $filter, string $resolver = null): string + public function resolve(string $path, string $filter, ?string $resolver = null): string { if (false !== mb_strpos($path, '/../') || 0 === mb_strpos($path, '../')) { throw new NotFoundHttpException(sprintf("Source image was searched with '%s' outside of the defined root path", $path)); @@ -167,7 +167,7 @@ public function resolve(string $path, string $filter, string $resolver = null): /** * @see ResolverInterface::store */ - public function store(BinaryInterface $binary, string $path, string $filter, string $resolver = null): void + public function store(BinaryInterface $binary, string $path, string $filter, ?string $resolver = null): void { $this->getResolver($filter, $resolver)->store($binary, $path, $filter); } diff --git a/src/Imagine/Data/DataManager.php b/src/Imagine/Data/DataManager.php index 39bbd80fc..064b228c8 100644 --- a/src/Imagine/Data/DataManager.php +++ b/src/Imagine/Data/DataManager.php @@ -40,8 +40,8 @@ public function __construct( MimeTypeGuesserInterface $mimeTypeGuesser, MimeTypesInterface $extensionGuesser, FilterConfiguration $filterConfig, - string $defaultLoader = null, - string $globalDefaultImage = null + ?string $defaultLoader = null, + ?string $globalDefaultImage = null ) { $this->mimeTypeGuesser = $mimeTypeGuesser; $this->filterConfig = $filterConfig; diff --git a/src/Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php b/src/Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php index dd8a9ff2b..117f804b9 100644 --- a/src/Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php +++ b/src/Imagine/Filter/PostProcessor/JpegOptimPostProcessor.php @@ -40,7 +40,7 @@ class JpegOptimPostProcessor extends AbstractPostProcessor * @param bool $progressive Force output to be progressive * @param string|null $temporaryRootPath Directory where temporary file will be written */ - public function __construct(string $executablePath = '/usr/bin/jpegoptim', bool $strip = true, int $quality = null, bool $progressive = true, string $temporaryRootPath = null) + public function __construct(string $executablePath = '/usr/bin/jpegoptim', bool $strip = true, ?int $quality = null, bool $progressive = true, ?string $temporaryRootPath = null) { parent::__construct($executablePath, $temporaryRootPath); diff --git a/src/Imagine/Filter/PostProcessor/MozJpegPostProcessor.php b/src/Imagine/Filter/PostProcessor/MozJpegPostProcessor.php index a7f8b225b..ccf7149fe 100644 --- a/src/Imagine/Filter/PostProcessor/MozJpegPostProcessor.php +++ b/src/Imagine/Filter/PostProcessor/MozJpegPostProcessor.php @@ -34,7 +34,7 @@ class MozJpegPostProcessor extends AbstractPostProcessor * @param string $executablePath Path to the mozjpeg cjpeg binary * @param int|null $quality Quality factor */ - public function __construct(string $executablePath = '/opt/mozjpeg/bin/cjpeg', int $quality = null) + public function __construct(string $executablePath = '/opt/mozjpeg/bin/cjpeg', ?int $quality = null) { parent::__construct($executablePath); diff --git a/src/Imagine/Filter/PostProcessor/OptiPngPostProcessor.php b/src/Imagine/Filter/PostProcessor/OptiPngPostProcessor.php index bf3b23c0c..2cf93bac4 100644 --- a/src/Imagine/Filter/PostProcessor/OptiPngPostProcessor.php +++ b/src/Imagine/Filter/PostProcessor/OptiPngPostProcessor.php @@ -34,7 +34,7 @@ class OptiPngPostProcessor extends AbstractPostProcessor * @param bool $strip Strip metadata objects * @param string|null $temporaryRootPath Directory where temporary file will be written */ - public function __construct(string $executablePath = '/usr/bin/optipng', int $level = 7, bool $strip = true, string $temporaryRootPath = null) + public function __construct(string $executablePath = '/usr/bin/optipng', int $level = 7, bool $strip = true, ?string $temporaryRootPath = null) { parent::__construct($executablePath, $temporaryRootPath); diff --git a/src/Model/Binary.php b/src/Model/Binary.php index 9cb600659..582d92dcf 100644 --- a/src/Model/Binary.php +++ b/src/Model/Binary.php @@ -21,7 +21,7 @@ class Binary implements BinaryInterface protected ?string $format; - public function __construct(string $content, ?string $mimeType, string $format = null) + public function __construct(string $content, ?string $mimeType, ?string $format = null) { $this->content = $content; $this->mimeType = $mimeType; diff --git a/src/Model/FileBinary.php b/src/Model/FileBinary.php index dc84b946b..3a2e0d71b 100644 --- a/src/Model/FileBinary.php +++ b/src/Model/FileBinary.php @@ -21,7 +21,7 @@ class FileBinary implements FileBinaryInterface protected ?string $format; - public function __construct(string $path, ?string $mimeType, string $format = null) + public function __construct(string $path, ?string $mimeType, ?string $format = null) { $this->path = $path; $this->mimeType = $mimeType; diff --git a/src/Service/FilterService.php b/src/Service/FilterService.php index ee11eca40..9a0fb1935 100644 --- a/src/Service/FilterService.php +++ b/src/Service/FilterService.php @@ -92,7 +92,7 @@ public function warmUpCache( return $warmedUp; } - public function getUrlOfFilteredImage(string $path, string $filter, string $resolver = null, bool $webpSupported = false): string + public function getUrlOfFilteredImage(string $path, string $filter, ?string $resolver = null, bool $webpSupported = false): string { foreach ($this->buildFilterPathContainers($path) as $filterPathContainer) { $this->warmUpCacheFilterPathContainer($filterPathContainer, $filter, $resolver); @@ -105,7 +105,7 @@ public function getUrlOfFilteredImageWithRuntimeFilters( string $path, string $filter, array $runtimeFilters = [], - string $resolver = null, + ?string $resolver = null, bool $webpSupported = false ): string { $runtimePath = $this->cacheManager->getRuntimePath($path, $runtimeFilters);