From ef7c0128f30737c1c35399c7f69a94274a52ab2e Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Mon, 21 Mar 2022 15:17:13 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Removeable.php | 5 +++++ tests/Feature/ImageTest.php | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Removeable.php b/src/Removeable.php index 681a8b7..dab4824 100644 --- a/src/Removeable.php +++ b/src/Removeable.php @@ -21,9 +21,11 @@ public function rm($image, $removeIndex = null): bool if (!$removeIndex) { if (is_string($image)) { $this->unlinkImagePath($image); + return $this->wasRecentlyRemoved; } elseif (is_string($image['index'])) { $this->unlinkImagePath($image['index']); + return $this->wasRecentlyRemoved; } elseif (is_array($image['index'])) { $this->unsetImagePaths(array_values($image['index'])); @@ -36,6 +38,7 @@ public function rm($image, $removeIndex = null): bool if (is_string($image[$removeIndex])) { $this->unlinkImagePath($image[$removeIndex]); + return $this->wasRecentlyRemoved; } elseif (is_array($image[$removeIndex])) { $this->unsetImagePaths(array_values($image[$removeIndex])); @@ -54,6 +57,7 @@ public function rm($image, $removeIndex = null): bool * remove the given image paths. * * @param array $paths + * * @return void */ private function unsetImagePaths(array $paths): void @@ -76,6 +80,7 @@ private function unsetImagePaths(array $paths): void * remove the given image path. * * @param string $path + * * @return void */ private function unlinkImagePath(string $path): void diff --git a/tests/Feature/ImageTest.php b/tests/Feature/ImageTest.php index 1107342..ef7a5c8 100644 --- a/tests/Feature/ImageTest.php +++ b/tests/Feature/ImageTest.php @@ -1241,7 +1241,7 @@ public function test_rm_wont_throw_exception_when_path_is_unlocatable() ->setExclusiveDirectory('post') ->autoResize() ->save(); - + Image::rm($image); $this->assertTrue(Image::wasRecentlyRemoved()); Image::rm($image); @@ -1289,7 +1289,7 @@ public function test_rm_wont_throw_exception_when_path_is_unlocatable() ->save(false, function ($image) { return $image->imagePath; }); - + Image::disk('storage')->rm($image); $this->assertTrue(Image::wasRecentlyRemoved()); Image::disk('storage')->rm($image);