From db771790e89e70574d7a4a58b12a69d9d9aa8aa6 Mon Sep 17 00:00:00 2001 From: Stephan Vierkant Date: Tue, 7 Dec 2021 17:48:27 +0100 Subject: [PATCH] Added return types --- src/Binary/Loader/FileSystemLoader.php | 2 +- src/Binary/Loader/FlysystemLoader.php | 2 +- src/Binary/Loader/FlysystemV2Loader.php | 2 +- src/Binary/Loader/StreamLoader.php | 2 +- src/Events/CacheResolveEvent.php | 32 +------------------- src/Imagine/Cache/Resolver/ProxyResolver.php | 2 +- 6 files changed, 6 insertions(+), 36 deletions(-) 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/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;