diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index fec1088..efbe5d5 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -12,5 +12,6 @@ ->setRules([ '@PSR12' => true, 'concat_space' => ['spacing' => 'one'], + 'new_with_parentheses' => false, ]) ->setFinder($finder); diff --git a/src/CacheItemsTrait.php b/src/CacheItemsTrait.php index 1f99fcf..4cbaf17 100644 --- a/src/CacheItemsTrait.php +++ b/src/CacheItemsTrait.php @@ -21,8 +21,8 @@ */ trait CacheItemsTrait { - static string $CACHE_KEY_PREFIX = 'flysystem_item_'; - static string $CACHE_KEY_HASH_SALT = '563ce5132194441b'; + public static string $CACHE_KEY_PREFIX = 'flysystem_item_'; + public static string $CACHE_KEY_HASH_SALT = '563ce5132194441b'; protected function getCacheItem(string $path): CacheItemInterface { diff --git a/tests/CacheAdapter_Test.php b/tests/CacheAdapter_Test.php index 5a6e9c4..fc925fa 100644 --- a/tests/CacheAdapter_Test.php +++ b/tests/CacheAdapter_Test.php @@ -31,7 +31,7 @@ public function writing_and_reading_files_with_special_path(string $path): void /** * "Override" function from parent which is not static and thus incompatible with phpunit 10 * @todo Remove when https://github.com/thephpleague/flysystem-adapter-test-utilities/commit/bf4c950b176bbefcc49c443cdab1ffb62a9fef5c is tagged (version >= 3.16?) - * @return Generator + * @return Generator */ public static function filenameProvider2(): Generator { diff --git a/tests/CacheTestCase.php b/tests/CacheTestCase.php index 2968d77..0006624 100644 --- a/tests/CacheTestCase.php +++ b/tests/CacheTestCase.php @@ -57,7 +57,7 @@ public function setUp(): void } /** - * @param array $items + * @param array $items */ protected function setupCache(array $items): void { @@ -71,7 +71,7 @@ protected function setupCache(array $items): void } /** - * @param array $items + * @param array $items */ protected function setupFiles(array $items): void { @@ -81,7 +81,7 @@ protected function setupFiles(array $items): void } /** - * @param array $items + * @param array $items */ protected function assertCachedItems(array $items): void { diff --git a/tests/Copy_Test.php b/tests/Copy_Test.php index 75dcc78..9db1eb6 100644 --- a/tests/Copy_Test.php +++ b/tests/Copy_Test.php @@ -10,7 +10,7 @@ class Copy_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -27,7 +27,7 @@ public function copy_ok(string $source, FileAttributes|null $expectedSourceCache } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -36,7 +36,7 @@ public static function dataProvider(): iterable yield 'cache item is created' => ['non-cached-file', \null, new FileAttributes('destination')]; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_copy(): void diff --git a/tests/CreateDirectory_Test.php b/tests/CreateDirectory_Test.php index 863f650..bdc0236 100644 --- a/tests/CreateDirectory_Test.php +++ b/tests/CreateDirectory_Test.php @@ -7,7 +7,7 @@ class CreateDirectory_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -21,7 +21,7 @@ public function directory_is_cached_after_creating(string $path): void } /** - * + * * @return iterable> */ public static function dataProvider(): iterable diff --git a/tests/DeleteDirectory_Test.php b/tests/DeleteDirectory_Test.php index a3e4104..b8d6042 100644 --- a/tests/DeleteDirectory_Test.php +++ b/tests/DeleteDirectory_Test.php @@ -6,7 +6,7 @@ class DeleteDirectory_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -20,7 +20,7 @@ public function directory_is_not_cached_deleting(string $path): void } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -41,7 +41,7 @@ public function nested_files_are_purged_from_cache(): void ]); } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_delete(): void diff --git a/tests/Delete_Test.php b/tests/Delete_Test.php index 0fa41f8..0ba1b1e 100644 --- a/tests/Delete_Test.php +++ b/tests/Delete_Test.php @@ -6,7 +6,7 @@ class Delete_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -20,7 +20,7 @@ public function file_is_not_cached_deleting(string $path): void } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -29,7 +29,7 @@ public static function dataProvider(): iterable yield 'non cached file stays uncached' => ['non-cached-file']; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_delete(): void diff --git a/tests/DirectoryExists_Test.php b/tests/DirectoryExists_Test.php index 0ba5887..2e2e590 100644 --- a/tests/DirectoryExists_Test.php +++ b/tests/DirectoryExists_Test.php @@ -6,7 +6,7 @@ class DirectoryExists_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -18,7 +18,7 @@ public function directory_exists_ok(string $path, bool $expectedResult): void } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -30,7 +30,7 @@ public static function dataProvider(): iterable yield 'file is not a directory' => ['fully-cached-file', false]; } - /** + /** * @test */ public function directory_is_cached_after_checking_filesystem(): void diff --git a/tests/GetChecksum_Test.php b/tests/GetChecksum_Test.php index 7fdaa0b..eebdaad 100644 --- a/tests/GetChecksum_Test.php +++ b/tests/GetChecksum_Test.php @@ -23,7 +23,7 @@ public function setUp(): void ]); } - /** + /** * @test * @dataProvider dataProvider */ @@ -35,7 +35,7 @@ public function get_checksum(string $path, string $expectedChecksum): void } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -45,7 +45,7 @@ public static function dataProvider(): iterable yield 'file is not cached' => ['non-cached-file', md5('0123456789')]; } - /** + /** * @test * @dataProvider aws_dataProvider */ @@ -62,7 +62,7 @@ public function with_mock_aws_adapter(string $path, string $expectedChecksum): v } /** - * + * * @return iterable> */ public static function aws_dataProvider(): iterable @@ -84,7 +84,7 @@ public function error(string $path): void } /** - * + * * @return iterable> */ public static function errorDataProvider(): iterable @@ -94,7 +94,7 @@ public static function errorDataProvider(): iterable yield 'Path is directory (non-cached)' => ['non-cached-directory']; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_get(): void diff --git a/tests/GetFileSize_Test.php b/tests/GetFileSize_Test.php index e608cb9..aa4aaec 100644 --- a/tests/GetFileSize_Test.php +++ b/tests/GetFileSize_Test.php @@ -6,7 +6,7 @@ class GetFileSize_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -18,7 +18,7 @@ public function get_fileSize(string $path, int $expectedFileSize): void } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -41,7 +41,7 @@ public function error(string $path): void } /** - * + * * @return iterable> */ public static function errorDataProvider(): iterable @@ -51,7 +51,7 @@ public static function errorDataProvider(): iterable yield 'Path is directory (non-cached)' => ['non-cached-directory']; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_get(): void diff --git a/tests/GetLastModified_Test.php b/tests/GetLastModified_Test.php index 4506d85..b73e2ee 100644 --- a/tests/GetLastModified_Test.php +++ b/tests/GetLastModified_Test.php @@ -6,7 +6,7 @@ class GetLastModified_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -18,7 +18,7 @@ public function get_lastModified(string $path): void } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -38,7 +38,7 @@ public function error(string $path): void } /** - * + * * @return iterable> */ public static function errorDataProvider(): iterable @@ -48,7 +48,7 @@ public static function errorDataProvider(): iterable yield 'Path is directory (non-cached)' => ['non-cached-directory']; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_get(): void diff --git a/tests/GetMimetype_Test.php b/tests/GetMimetype_Test.php index 7ac1f1e..49cdded 100644 --- a/tests/GetMimetype_Test.php +++ b/tests/GetMimetype_Test.php @@ -10,7 +10,7 @@ class GetMimetype_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -22,7 +22,7 @@ public function get_mimetype(string $path, StorageAttributes $expectedResult): v } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -32,7 +32,7 @@ public static function dataProvider(): iterable yield 'file is not cached but exists in the filesystem' => ['non-cached-file.txt', new FileAttributes('non-cached-file.txt', mimeType: 'text/plain')]; } - /** + /** * @test */ public function file_is_cached_after_checking_filesystem(): void @@ -57,7 +57,7 @@ public function error(string $path): void } /** - * + * * @return iterable> */ public static function errorDataProvider(): iterable @@ -67,7 +67,7 @@ public static function errorDataProvider(): iterable yield 'Path is directory (non-cached)' => ['non-cached-directory']; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_get(): void diff --git a/tests/GetVisibility_Test.php b/tests/GetVisibility_Test.php index 68e56b1..d272ed3 100644 --- a/tests/GetVisibility_Test.php +++ b/tests/GetVisibility_Test.php @@ -9,7 +9,7 @@ class GetVisibility_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -21,7 +21,7 @@ public function get_visibility(string $path, StorageAttributes $expectedResult): } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -31,7 +31,7 @@ public static function dataProvider(): iterable yield 'file is not cached but exists in the filesystem' => ['non-cached-file', new FileAttributes('non-cached-file', visibility: Visibility::PUBLIC)]; } - /** + /** * @test */ public function file_is_cached_after_checking_filesystem(): void @@ -56,7 +56,7 @@ public function error(string $path): void } /** - * + * * @return iterable> */ public static function errorDataProvider(): iterable @@ -66,7 +66,7 @@ public static function errorDataProvider(): iterable yield 'Path is directory (non-cached)' => ['non-cached-directory']; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_get(): void diff --git a/tests/ListContents_Test.php b/tests/ListContents_Test.php index 8b1a0dc..f068f66 100644 --- a/tests/ListContents_Test.php +++ b/tests/ListContents_Test.php @@ -7,7 +7,7 @@ class ListContents_Test extends CacheTestCase { - /** + /** * @test */ public function content_list_is_cached(): void diff --git a/tests/Move_Test.php b/tests/Move_Test.php index 220e713..33d76ca 100644 --- a/tests/Move_Test.php +++ b/tests/Move_Test.php @@ -9,7 +9,7 @@ class Move_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -26,7 +26,7 @@ public function move_ok(string $source, FileAttributes $expectedDestinationCache } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -35,7 +35,7 @@ public static function dataProvider(): iterable yield 'cache item is created' => ['non-cached-file', new FileAttributes('destination')]; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_move(): void diff --git a/tests/Read_Test.php b/tests/Read_Test.php index 9969f9d..7b2b55f 100644 --- a/tests/Read_Test.php +++ b/tests/Read_Test.php @@ -8,7 +8,7 @@ class Read_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -21,7 +21,7 @@ public function file_is_cached_after_reading(string $path, int|null $expectedSiz ]); } - /** + /** * @test * @dataProvider dataProvider */ @@ -35,7 +35,7 @@ public function file_is_cached_after_reading_stream(string $path, int|null $expe } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -45,7 +45,7 @@ public static function dataProvider(): iterable yield 'cached file attributes are unchanged after reading' => ['fully-cached-file', 10, Visibility::PUBLIC]; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_read(): void @@ -61,7 +61,7 @@ public function cache_is_purged_after_unsuccessful_read(): void } } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_readStream(): void diff --git a/tests/SetVisibility_Test.php b/tests/SetVisibility_Test.php index 0c9e120..54a4778 100644 --- a/tests/SetVisibility_Test.php +++ b/tests/SetVisibility_Test.php @@ -9,7 +9,7 @@ class SetVisibility_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -23,7 +23,7 @@ public function set_visibility_ok(string $path, string $visibility, StorageAttri } /** - * + * * @return iterable> */ public static function dataProvider(): iterable @@ -36,7 +36,7 @@ public static function dataProvider(): iterable // yield 'cached directory, set private' => ['cached-directory', Visibility::PRIVATE, new DirectoryAttributes('fully-cached-file', visibility: Visibility::PRIVATE)]; } - /** + /** * @test */ public function cache_is_purged_after_unsuccessful_set(): void diff --git a/tests/Write_Test.php b/tests/Write_Test.php index 47def45..506d3db 100644 --- a/tests/Write_Test.php +++ b/tests/Write_Test.php @@ -8,7 +8,7 @@ class Write_Test extends CacheTestCase { - /** + /** * @test * @dataProvider dataProvider */ @@ -21,7 +21,7 @@ public function file_is_cached_after_writing(string $path): void ]); } - /** + /** * @test * @dataProvider dataProvider */ @@ -37,7 +37,7 @@ public function file_is_cached_after_writing_stream(string $path): void } /** - * + * * @return iterable> */ public static function dataProvider(): iterable