From 37164aef068fadfca11b6cbe5c9c88d57e510487 Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 4 Dec 2024 22:10:03 +0000 Subject: [PATCH] Deprecate legacy compression related adapters and filter Signed-off-by: George Steel --- psalm-baseline.xml | 225 ++++++++++++++++++ src/Compress.php | 3 + src/Compress/AbstractCompressionAlgorithm.php | 4 + src/Compress/Bz2.php | 4 + .../CompressionAlgorithmInterface.php | 4 + src/Compress/Gz.php | 4 + src/Compress/Tar.php | 4 + src/Compress/Zip.php | 4 + src/Decompress.php | 3 + 9 files changed, 255 insertions(+) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index d77cc748..1677e983 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -167,6 +167,16 @@ + + + + + + + ]]> + |null|AdapterTypeOrInstance]]> + + @@ -191,6 +201,9 @@ + + + @@ -202,6 +215,13 @@ + + + + + + + @@ -230,6 +250,13 @@ + + + + + + + @@ -272,6 +299,9 @@ + + + @@ -281,6 +311,13 @@ + + + + + + + @@ -319,6 +356,9 @@ + + + @@ -340,6 +380,13 @@ + + + + + + + @@ -388,6 +435,13 @@ + + + + + + + @@ -475,6 +529,9 @@ + + + @@ -591,6 +648,10 @@ + + compression)]]> + compression)]]> + @@ -688,6 +749,10 @@ compression]]> compression]]> + + compression)]]> + compression)]]> + @@ -1075,6 +1140,16 @@ + + + + + + + + + + @@ -1683,6 +1758,20 @@ + + + + + + + + + + + + + 8])]]> + @@ -1696,6 +1785,20 @@ + + + + + + + + + + + + 8])]]> + 'deflate'])]]> + @@ -1725,7 +1828,118 @@ + + + $this->tmp . '/compressed.tar', + 'target' => $this->tmp . '/_compress', + ] + )]]> + $this->tmp . '/compressed.tar', + 'target' => $this->tmp . '/zipextracted.txt', + ] + )]]> + $this->tmp . '/compressed.tar', + 'target' => $this->tmp . '/zipextracted.txt', + ] + )]]> + + + + + + $this->tmp . '/compressed.tar', + 'target' => $this->tmp . '/zipextracted.txt', + ])]]> + $target, + ])]]> + + + + + $this->tmp . '/compressed.zip', + 'target' => $this->tmp . '/_compress', + ] + )]]> + $this->tmp . '/compressed.zip', + 'target' => $this->tmp . '/_compress', + ] + )]]> + $this->tmp . '/compressed.zip', + 'target' => $this->tmp . '/_compress', + ] + )]]> + $this->tmp . '/compressed.zip', + 'target' => $this->tmp . '/_compress', + ] + )]]> + $this->tmp . '/compressed.zip', + 'target' => $this->tmp . '/zipextracted.txt', + ] + )]]> + $this->tmp . '/compressed.zip', + 'target' => $this->tmp . '/zipextracted.txt', + ] + )]]> + $this->tmp . '/compressed.zip', + 'target' => $this->tmp, + ] + )]]> + $this->tmp . '/_compress', + ] + )]]> + + + + + + + + + + + + + + + + + + + + + + $filterType, + 'options' => [ + 'archive' => 'test.txt', + ], + ])]]> + @@ -1759,6 +1973,17 @@ + + + + + + + + + + + diff --git a/src/Compress.php b/src/Compress.php index 501870e5..381d0fa6 100644 --- a/src/Compress.php +++ b/src/Compress.php @@ -20,6 +20,9 @@ /** * Compresses a given string * + * @deprecated Since 2.40.0. This filter will be removed in 3.0 and replaced with `CompressString` and + * `CompressToArchive` + * * @psalm-type AdapterType = 'Bz2'|'Gz'|'Lzf'|'Rar'|'Snappy'|'Tar'|'Zip' * @psalm-type AdapterTypeOrInstance = Compress\CompressionAlgorithmInterface|AdapterType * @psalm-type Options = array{ diff --git a/src/Compress/AbstractCompressionAlgorithm.php b/src/Compress/AbstractCompressionAlgorithm.php index 17fc58d2..36b9dcf9 100644 --- a/src/Compress/AbstractCompressionAlgorithm.php +++ b/src/Compress/AbstractCompressionAlgorithm.php @@ -13,6 +13,10 @@ /** * Abstract compression adapter * + * @deprecated Since 2.40.0 Compression adapters will be split into multiple interfaces to clearly separate the + * capability of the underlying compression or archive format. For example, tar cannot compress strings and + * GZ cannot be used to create multi-file archives. + * * @template TOptions of array */ abstract class AbstractCompressionAlgorithm implements CompressionAlgorithmInterface diff --git a/src/Compress/Bz2.php b/src/Compress/Bz2.php index f3d6e215..4355451c 100644 --- a/src/Compress/Bz2.php +++ b/src/Compress/Bz2.php @@ -20,6 +20,10 @@ /** * Compression adapter for Bz2 * + * @deprecated Since 2.40.0 Compression adapters will be split into multiple interfaces to clearly separate the + * capability of the underlying compression or archive format. For example, tar cannot compress strings and + * GZ cannot be used to create multi-file archives. + * * @psalm-type Options = array{ * blocksize?: int, * archive?: string|null, diff --git a/src/Compress/CompressionAlgorithmInterface.php b/src/Compress/CompressionAlgorithmInterface.php index 57a421e1..0b7fa724 100644 --- a/src/Compress/CompressionAlgorithmInterface.php +++ b/src/Compress/CompressionAlgorithmInterface.php @@ -6,6 +6,10 @@ /** * Compression interface + * + * @deprecated Since 2.40.0 Compression adapters will be split into multiple interfaces to clearly separate the + * capability of the underlying compression or archive format. For example, tar cannot compress strings and + * GZ cannot be used to create multi-file archives. */ interface CompressionAlgorithmInterface { diff --git a/src/Compress/Gz.php b/src/Compress/Gz.php index 74b7def8..b089608c 100644 --- a/src/Compress/Gz.php +++ b/src/Compress/Gz.php @@ -30,6 +30,10 @@ /** * Compression adapter for Gzip (ZLib) * + * @deprecated Since 2.40.0 Compression adapters will be split into multiple interfaces to clearly separate the + * capability of the underlying compression or archive format. For example, tar cannot compress strings and + * GZ cannot be used to create multi-file archives. + * * @psalm-type Options = array{ * level?: int, * mode?: string, diff --git a/src/Compress/Tar.php b/src/Compress/Tar.php index bbd7078f..85b498a4 100644 --- a/src/Compress/Tar.php +++ b/src/Compress/Tar.php @@ -24,6 +24,10 @@ /** * Compression adapter for Tar * + * @deprecated Since 2.40.0 Compression adapters will be split into multiple interfaces to clearly separate the + * capability of the underlying compression or archive format. For example, tar cannot compress strings and + * GZ cannot be used to create multi-file archives. + * * @psalm-type Options = array{ * archive?: string|null, * target?: string, diff --git a/src/Compress/Zip.php b/src/Compress/Zip.php index aa574392..984000d9 100644 --- a/src/Compress/Zip.php +++ b/src/Compress/Zip.php @@ -27,6 +27,10 @@ /** * Compression adapter for zip * + * @deprecated Since 2.40.0 Compression adapters will be split into multiple interfaces to clearly separate the + * capability of the underlying compression or archive format. For example, tar cannot compress strings and + * GZ cannot be used to create multi-file archives. + * * @psalm-type Options = array{ * archive?: string|null, * password?: string|null, diff --git a/src/Decompress.php b/src/Decompress.php index ab3f5511..db0d176f 100644 --- a/src/Decompress.php +++ b/src/Decompress.php @@ -9,6 +9,9 @@ /** * Decompresses a given string * + * @deprecated Since 2.40.0. This filter will be removed in 3.0 and replaced with `DecompressString` and + * `DecompressArchive` + * * @final */ class Decompress extends Compress