diff --git a/src/Binary/Loader/FileSystemLoader.php b/src/Binary/Loader/FileSystemLoader.php index 053662828..98ef7845f 100644 --- a/src/Binary/Loader/FileSystemLoader.php +++ b/src/Binary/Loader/FileSystemLoader.php @@ -37,7 +37,7 @@ public function __construct( /** * {@inheritdoc} */ - public function find($path) + public function find($path): FileBinary { $path = $this->locator->locate($path); $mimeType = $this->mimeTypeGuesser->guessMimeType($path); diff --git a/src/Binary/Loader/FlysystemLoader.php b/src/Binary/Loader/FlysystemLoader.php index 4ea244f25..425f25683 100644 --- a/src/Binary/Loader/FlysystemLoader.php +++ b/src/Binary/Loader/FlysystemLoader.php @@ -33,7 +33,7 @@ public function __construct( /** * {@inheritdoc} */ - public function find($path) + public function find($path): Binary { if (false === $this->filesystem->has($path)) { throw new NotLoadableException(sprintf('Source image "%s" not found.', $path)); diff --git a/src/Binary/Loader/FlysystemV2Loader.php b/src/Binary/Loader/FlysystemV2Loader.php index ca8ac6f64..caa445ce3 100644 --- a/src/Binary/Loader/FlysystemV2Loader.php +++ b/src/Binary/Loader/FlysystemV2Loader.php @@ -34,7 +34,7 @@ public function __construct( /** * {@inheritdoc} */ - public function find($path) + public function find($path): Binary { try { $mimeType = $this->filesystem->mimeType($path); diff --git a/src/Binary/Loader/StreamLoader.php b/src/Binary/Loader/StreamLoader.php index f08e3abce..250b6a3b0 100644 --- a/src/Binary/Loader/StreamLoader.php +++ b/src/Binary/Loader/StreamLoader.php @@ -46,7 +46,7 @@ public function __construct(string $wrapperPrefix, $context = null) /** * {@inheritdoc} */ - public function find($path) + public function find($path): string { $name = $this->wrapperPrefix.$path; diff --git a/src/Events/CacheResolveEvent.php b/src/Events/CacheResolveEvent.php index dcec6ef32..b36a8460b 100644 --- a/src/Events/CacheResolveEvent.php +++ b/src/Events/CacheResolveEvent.php @@ -15,24 +15,12 @@ class CacheResolveEvent extends Event { - /** - * Resource path. - */ protected string $path; - /** - * Filter name. - */ protected string $filter; - /** - * Resource url. - */ protected ?string $url; - /** - * Init default event state. - */ public function __construct(string $path, string $filter, ?string $url = null) { $this->path = $path; @@ -40,50 +28,32 @@ public function __construct(string $path, string $filter, ?string $url = null) $this->url = $url; } - /** - * Sets resource path. - */ public function setPath(string $path): void { $this->path = $path; } - /** - * Returns resource path. - */ public function getPath(): string { return $this->path; } - /** - * Sets filter name. - */ public function setFilter(string $filter): void { $this->filter = $filter; } - /** - * Returns filter name. - */ public function getFilter(): string { return $this->filter; } - /** - * Sets resource url. - */ public function setUrl(?string $url): void { $this->url = $url; } - /** - * Returns resource url. - */ - public function getUrl(): ?string + public function getUrl(): string { return $this->url; } diff --git a/src/Imagine/Cache/CacheManager.php b/src/Imagine/Cache/CacheManager.php index 6ce54ed22..3d8cba5df 100644 --- a/src/Imagine/Cache/CacheManager.php +++ b/src/Imagine/Cache/CacheManager.php @@ -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); diff --git a/src/Imagine/Cache/Resolver/ProxyResolver.php b/src/Imagine/Cache/Resolver/ProxyResolver.php index 9ddfab048..30995591d 100644 --- a/src/Imagine/Cache/Resolver/ProxyResolver.php +++ b/src/Imagine/Cache/Resolver/ProxyResolver.php @@ -56,7 +56,7 @@ public function remove(array $paths, array $filters): void $this->resolver->remove($paths, $filters); } - protected function rewriteUrl(string $url): string + protected function rewriteUrl(string $url): ?string { if (empty($this->hosts)) { return $url; diff --git a/src/Imagine/Filter/FilterManager.php b/src/Imagine/Filter/FilterManager.php index fb8508e3c..30ba8d451 100644 --- a/src/Imagine/Filter/FilterManager.php +++ b/src/Imagine/Filter/FilterManager.php @@ -79,7 +79,7 @@ public function apply(BinaryInterface $binary, array $config): BinaryInterface return $this->applyPostProcessors($this->applyFilters($binary, $config), $config); } - public function applyFilters(BinaryInterface $binary, array $config): BinaryInterface + public function applyFilters(BinaryInterface $binary, array $config): Binary { if ($binary instanceof FileBinaryInterface) { $image = $this->imagine->open($binary->getPath()); @@ -126,7 +126,7 @@ public function applyPostProcessors(BinaryInterface $binary, array $config): Bin return $binary; } - private function exportConfiguredImageBinary(BinaryInterface $binary, ImageInterface $image, array $config): BinaryInterface + private function exportConfiguredImageBinary(BinaryInterface $binary, ImageInterface $image, array $config): Binary { $options = [ 'quality' => $config['quality'], diff --git a/src/Service/FilterService.php b/src/Service/FilterService.php index 9a0fb1935..7bd387dd8 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); @@ -107,7 +107,7 @@ public function getUrlOfFilteredImageWithRuntimeFilters( array $runtimeFilters = [], ?string $resolver = null, bool $webpSupported = false - ): string { + ): ?string { $runtimePath = $this->cacheManager->getRuntimePath($path, $runtimeFilters); $runtimeOptions = [ 'filters' => $runtimeFilters, @@ -147,7 +147,7 @@ private function resolveFilterPathContainer( string $filter, ?string $resolver = null, bool $webpSupported = false - ): string { + ): ?string { $path = $filterPathContainer->getTarget(); if ($this->webpGenerate && $webpSupported) {