From 1dfb7cd36f64476607c3ceb7911c2b297a8409f2 Mon Sep 17 00:00:00 2001 From: Paul Mitchum Date: Sat, 4 May 2024 11:39:03 -0600 Subject: [PATCH 1/7] deprecates most interfaces --- rector.php | 6 +----- src/BulkRetrieverInterface.php | 2 ++ src/BulkStorerInterface.php | 2 ++ src/ConditionerInterface.php | 2 ++ src/CountableInterface.php | 2 ++ src/FactoryInterface.php | 2 ++ src/HydratableInterface.php | 2 ++ src/IdGeneratorInterface.php | 2 ++ src/LimiterInterface.php | 2 ++ src/OffsetterInterface.php | 2 ++ src/ParserInterface.php | 2 ++ src/RemoverInterface.php | 2 ++ src/SorterInterface.php | 2 ++ 13 files changed, 25 insertions(+), 5 deletions(-) diff --git a/rector.php b/rector.php index 310105f..44b7129 100644 --- a/rector.php +++ b/rector.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Core\ValueObject\PhpVersion; use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector; use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector; use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector; @@ -20,11 +19,8 @@ __DIR__ . '/test', ]); - // Our base version of PHP. - $rectorConfig->phpVersion(PhpVersion::PHP_74); - $rectorConfig->sets([ - SetList::PHP_82, + SetList::PHP_74, // Please no dead code or unneeded variables. SetList::DEAD_CODE, // Try to figure out type hints. diff --git a/src/BulkRetrieverInterface.php b/src/BulkRetrieverInterface.php index 8b3277b..5115eb4 100644 --- a/src/BulkRetrieverInterface.php +++ b/src/BulkRetrieverInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\BulkRetrieverInterface is deprecated.', E_USER_DEPRECATED); + interface BulkRetrieverInterface { diff --git a/src/BulkStorerInterface.php b/src/BulkStorerInterface.php index 7d09aa7..4165534 100644 --- a/src/BulkStorerInterface.php +++ b/src/BulkStorerInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\BulkStorerInterface is deprecated.', E_USER_DEPRECATED); + interface BulkStorerInterface { diff --git a/src/ConditionerInterface.php b/src/ConditionerInterface.php index bc04667..5aeb9bb 100644 --- a/src/ConditionerInterface.php +++ b/src/ConditionerInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\ConditionerInterface is deprecated.', E_USER_DEPRECATED); + interface ConditionerInterface { public function conditionByIsEqualTo(string $property, string $value); diff --git a/src/CountableInterface.php b/src/CountableInterface.php index 0ac9a55..3326d10 100644 --- a/src/CountableInterface.php +++ b/src/CountableInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\CountableInterface is deprecated.', E_USER_DEPRECATED); + use phpDocumentor\Reflection\Types\Integer; interface CountableInterface diff --git a/src/FactoryInterface.php b/src/FactoryInterface.php index 4de8f0a..001985d 100644 --- a/src/FactoryInterface.php +++ b/src/FactoryInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\FactoryInterface is deprecated.', E_USER_DEPRECATED); + interface FactoryInterface { /** diff --git a/src/HydratableInterface.php b/src/HydratableInterface.php index 30b8f45..eb3ec6c 100644 --- a/src/HydratableInterface.php +++ b/src/HydratableInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\HydratableInterface is deprecated.', E_USER_DEPRECATED); + interface HydratableInterface extends \JsonSerializable { public static function hydrate(string $json, $instance = null); diff --git a/src/IdGeneratorInterface.php b/src/IdGeneratorInterface.php index 69bf0c8..bbdcbcb 100644 --- a/src/IdGeneratorInterface.php +++ b/src/IdGeneratorInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\IdGeneratorInterface is deprecated.', E_USER_DEPRECATED); + interface IdGeneratorInterface { public function generate(); diff --git a/src/LimiterInterface.php b/src/LimiterInterface.php index 2df0abb..9ea6daa 100644 --- a/src/LimiterInterface.php +++ b/src/LimiterInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\LimiterInterface is deprecated.', E_USER_DEPRECATED); + interface LimiterInterface { public function limitTo(int $number_of_items); diff --git a/src/OffsetterInterface.php b/src/OffsetterInterface.php index ba26383..bd32acb 100644 --- a/src/OffsetterInterface.php +++ b/src/OffsetterInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\OffsetterInterface is deprecated.', E_USER_DEPRECATED); + interface OffsetterInterface { public function offsetBy(int $offset); diff --git a/src/ParserInterface.php b/src/ParserInterface.php index f39cabd..8edd7eb 100644 --- a/src/ParserInterface.php +++ b/src/ParserInterface.php @@ -3,6 +3,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\ParserInterface is deprecated.', E_USER_DEPRECATED); + interface ParserInterface { public function feed(string $chunk); diff --git a/src/RemoverInterface.php b/src/RemoverInterface.php index aa3bc0f..19225f0 100644 --- a/src/RemoverInterface.php +++ b/src/RemoverInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__CLASS__ . '\RemoverInterface is deprecated.', E_USER_DEPRECATED); + interface RemoverInterface { /** diff --git a/src/SorterInterface.php b/src/SorterInterface.php index 6f13aee..7121e43 100644 --- a/src/SorterInterface.php +++ b/src/SorterInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__NAMESPACE__ . '\SorterInterface is deprecated.', E_USER_DEPRECATED); + interface SorterInterface { public function sortByAscending(string $property); From f9ab7a13885bb161db206461b87abe7d3942cc24 Mon Sep 17 00:00:00 2001 From: Paul Mitchum Date: Sat, 4 May 2024 11:56:17 -0600 Subject: [PATCH 2/7] de-deprecating BulkRetrieverInterface --- src/BulkRetrieverInterface.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/BulkRetrieverInterface.php b/src/BulkRetrieverInterface.php index 5115eb4..8b3277b 100644 --- a/src/BulkRetrieverInterface.php +++ b/src/BulkRetrieverInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\BulkRetrieverInterface is deprecated.', E_USER_DEPRECATED); - interface BulkRetrieverInterface { From c95d5561fa0276f91654e060c11aef4b7912ba4d Mon Sep 17 00:00:00 2001 From: Paul Mitchum Date: Tue, 7 May 2024 09:09:05 -0700 Subject: [PATCH 3/7] namespaces --- phpunit.xml | 2 +- src/BulkRetrieverInterface.php | 2 ++ src/BulkStorerInterface.php | 2 +- src/ConditionerInterface.php | 2 +- src/CountableInterface.php | 2 +- src/FactoryInterface.php | 2 +- src/HydratableInterface.php | 2 +- src/IdGeneratorInterface.php | 2 +- src/LimiterInterface.php | 2 +- src/OffsetterInterface.php | 2 +- src/ParserInterface.php | 2 +- src/RemoverInterface.php | 2 +- 12 files changed, 13 insertions(+), 11 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index eceeba6..2bb87bd 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -11,7 +11,7 @@ - + diff --git a/src/BulkRetrieverInterface.php b/src/BulkRetrieverInterface.php index 8b3277b..0ab6372 100644 --- a/src/BulkRetrieverInterface.php +++ b/src/BulkRetrieverInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__NAMESPACE__ . '\BulkRetrieverInterface is deprecated.', E_USER_DEPRECATED); + interface BulkRetrieverInterface { diff --git a/src/BulkStorerInterface.php b/src/BulkStorerInterface.php index 4165534..ba8d9ff 100644 --- a/src/BulkStorerInterface.php +++ b/src/BulkStorerInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\BulkStorerInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\BulkStorerInterface is deprecated.', E_USER_DEPRECATED); interface BulkStorerInterface { diff --git a/src/ConditionerInterface.php b/src/ConditionerInterface.php index 5aeb9bb..85cfabc 100644 --- a/src/ConditionerInterface.php +++ b/src/ConditionerInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\ConditionerInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\ConditionerInterface is deprecated.', E_USER_DEPRECATED); interface ConditionerInterface { diff --git a/src/CountableInterface.php b/src/CountableInterface.php index 3326d10..3869dbc 100644 --- a/src/CountableInterface.php +++ b/src/CountableInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\CountableInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\CountableInterface is deprecated.', E_USER_DEPRECATED); use phpDocumentor\Reflection\Types\Integer; diff --git a/src/FactoryInterface.php b/src/FactoryInterface.php index 001985d..100788e 100644 --- a/src/FactoryInterface.php +++ b/src/FactoryInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\FactoryInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\FactoryInterface is deprecated.', E_USER_DEPRECATED); interface FactoryInterface { diff --git a/src/HydratableInterface.php b/src/HydratableInterface.php index eb3ec6c..fcb5d0c 100644 --- a/src/HydratableInterface.php +++ b/src/HydratableInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\HydratableInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\HydratableInterface is deprecated.', E_USER_DEPRECATED); interface HydratableInterface extends \JsonSerializable { diff --git a/src/IdGeneratorInterface.php b/src/IdGeneratorInterface.php index bbdcbcb..02613ad 100644 --- a/src/IdGeneratorInterface.php +++ b/src/IdGeneratorInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\IdGeneratorInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\IdGeneratorInterface is deprecated.', E_USER_DEPRECATED); interface IdGeneratorInterface { diff --git a/src/LimiterInterface.php b/src/LimiterInterface.php index 9ea6daa..f426a6a 100644 --- a/src/LimiterInterface.php +++ b/src/LimiterInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\LimiterInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\LimiterInterface is deprecated.', E_USER_DEPRECATED); interface LimiterInterface { diff --git a/src/OffsetterInterface.php b/src/OffsetterInterface.php index bd32acb..20ee192 100644 --- a/src/OffsetterInterface.php +++ b/src/OffsetterInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\OffsetterInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\OffsetterInterface is deprecated.', E_USER_DEPRECATED); interface OffsetterInterface { diff --git a/src/ParserInterface.php b/src/ParserInterface.php index 8edd7eb..64403e1 100644 --- a/src/ParserInterface.php +++ b/src/ParserInterface.php @@ -3,7 +3,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\ParserInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\ParserInterface is deprecated.', E_USER_DEPRECATED); interface ParserInterface { diff --git a/src/RemoverInterface.php b/src/RemoverInterface.php index 19225f0..cbbe97b 100644 --- a/src/RemoverInterface.php +++ b/src/RemoverInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__CLASS__ . '\RemoverInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\RemoverInterface is deprecated.', E_USER_DEPRECATED); interface RemoverInterface { From 8e210f595144d16cce66fbbb5babc1d6e44ce389 Mon Sep 17 00:00:00 2001 From: Paul Mitchum Date: Tue, 7 May 2024 10:08:47 -0700 Subject: [PATCH 4/7] un-deprecate BulkRetrieverInterface --- src/BulkRetrieverInterface.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/BulkRetrieverInterface.php b/src/BulkRetrieverInterface.php index 0ab6372..8b3277b 100644 --- a/src/BulkRetrieverInterface.php +++ b/src/BulkRetrieverInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\BulkRetrieverInterface is deprecated.', E_USER_DEPRECATED); - interface BulkRetrieverInterface { From 5253874f952011195f7dc7f27c124d1b2d224792 Mon Sep 17 00:00:00 2001 From: Paul Mitchum Date: Mon, 13 May 2024 10:58:50 -0700 Subject: [PATCH 5/7] un-deprecate some of the interfaces --- src/BulkStorerInterface.php | 2 -- src/ConditionerInterface.php | 2 -- src/FactoryInterface.php | 2 -- src/IdGeneratorInterface.php | 2 -- src/LimiterInterface.php | 2 -- src/OffsetterInterface.php | 2 -- src/RemoverInterface.php | 2 -- src/SorterInterface.php | 2 -- 8 files changed, 16 deletions(-) diff --git a/src/BulkStorerInterface.php b/src/BulkStorerInterface.php index ba8d9ff..7d09aa7 100644 --- a/src/BulkStorerInterface.php +++ b/src/BulkStorerInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\BulkStorerInterface is deprecated.', E_USER_DEPRECATED); - interface BulkStorerInterface { diff --git a/src/ConditionerInterface.php b/src/ConditionerInterface.php index 85cfabc..bc04667 100644 --- a/src/ConditionerInterface.php +++ b/src/ConditionerInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\ConditionerInterface is deprecated.', E_USER_DEPRECATED); - interface ConditionerInterface { public function conditionByIsEqualTo(string $property, string $value); diff --git a/src/FactoryInterface.php b/src/FactoryInterface.php index 100788e..4de8f0a 100644 --- a/src/FactoryInterface.php +++ b/src/FactoryInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\FactoryInterface is deprecated.', E_USER_DEPRECATED); - interface FactoryInterface { /** diff --git a/src/IdGeneratorInterface.php b/src/IdGeneratorInterface.php index 02613ad..69bf0c8 100644 --- a/src/IdGeneratorInterface.php +++ b/src/IdGeneratorInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\IdGeneratorInterface is deprecated.', E_USER_DEPRECATED); - interface IdGeneratorInterface { public function generate(); diff --git a/src/LimiterInterface.php b/src/LimiterInterface.php index f426a6a..2df0abb 100644 --- a/src/LimiterInterface.php +++ b/src/LimiterInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\LimiterInterface is deprecated.', E_USER_DEPRECATED); - interface LimiterInterface { public function limitTo(int $number_of_items); diff --git a/src/OffsetterInterface.php b/src/OffsetterInterface.php index 20ee192..ba26383 100644 --- a/src/OffsetterInterface.php +++ b/src/OffsetterInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\OffsetterInterface is deprecated.', E_USER_DEPRECATED); - interface OffsetterInterface { public function offsetBy(int $offset); diff --git a/src/RemoverInterface.php b/src/RemoverInterface.php index cbbe97b..aa3bc0f 100644 --- a/src/RemoverInterface.php +++ b/src/RemoverInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\RemoverInterface is deprecated.', E_USER_DEPRECATED); - interface RemoverInterface { /** diff --git a/src/SorterInterface.php b/src/SorterInterface.php index 7121e43..6f13aee 100644 --- a/src/SorterInterface.php +++ b/src/SorterInterface.php @@ -2,8 +2,6 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\SorterInterface is deprecated.', E_USER_DEPRECATED); - interface SorterInterface { public function sortByAscending(string $property); From ce24ea9be28b86a473d1534807a1300758cc51af Mon Sep 17 00:00:00 2001 From: Paul Mitchum Date: Mon, 13 May 2024 12:23:53 -0700 Subject: [PATCH 6/7] better deprecation message --- src/CountableInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CountableInterface.php b/src/CountableInterface.php index 3869dbc..460e91c 100644 --- a/src/CountableInterface.php +++ b/src/CountableInterface.php @@ -2,7 +2,7 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\CountableInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error(__NAMESPACE__ . '\CountableInterface is deprecated. Use \Countable instead.', E_USER_DEPRECATED); use phpDocumentor\Reflection\Types\Integer; From e02e02aebe6856b18afe3d5995dbec501f75b620 Mon Sep 17 00:00:00 2001 From: Paul Mitchum Date: Tue, 18 Jun 2024 09:24:20 -0700 Subject: [PATCH 7/7] tidying, updating deprecation messages --- composer.json | 5 +++-- phpcs.xml | 5 ++++- phpunit.xml | 4 +++- src/CountableInterface.php | 2 -- src/HydratableInterface.php | 5 ++++- src/ParserInterface.php | 5 ++++- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 66f087b..1464712 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,8 @@ } ], "require": { - "php": ">=7.4 <9.0" + "php": ">=7.4 <9.0", + "ext-json": "*" }, "require-dev": { "phpunit/phpunit": "^9.6", @@ -33,7 +34,7 @@ }, "scripts": { "phpcbf": "./vendor/bin/phpcbf", - "phpcs": "./vendor/bin/phpcs", + "phpcs": "./vendor/bin/phpcs -s", "rector": "./vendor/bin/rector process", "rector-dry-run": "./vendor/bin/rector process --dry-run", "test": "./vendor/bin/phpunit --testsuite all" diff --git a/phpcs.xml b/phpcs.xml index 45200cd..9061a78 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -8,7 +8,10 @@ test rector.php - + + + + diff --git a/phpunit.xml b/phpunit.xml index 2bb87bd..5bd7600 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,8 @@ + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd" + verbose="false" + colors="true"> src diff --git a/src/CountableInterface.php b/src/CountableInterface.php index 460e91c..12825f4 100644 --- a/src/CountableInterface.php +++ b/src/CountableInterface.php @@ -4,8 +4,6 @@ @trigger_error(__NAMESPACE__ . '\CountableInterface is deprecated. Use \Countable instead.', E_USER_DEPRECATED); -use phpDocumentor\Reflection\Types\Integer; - interface CountableInterface { public function count(): int; diff --git a/src/HydratableInterface.php b/src/HydratableInterface.php index fcb5d0c..f9efc78 100644 --- a/src/HydratableInterface.php +++ b/src/HydratableInterface.php @@ -2,7 +2,10 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\HydratableInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error( + __NAMESPACE__ . '\HydratableInterface is deprecated. Use \Procrastinator\HydratableInterface intead.', + E_USER_DEPRECATED +); interface HydratableInterface extends \JsonSerializable { diff --git a/src/ParserInterface.php b/src/ParserInterface.php index 64403e1..ad225c2 100644 --- a/src/ParserInterface.php +++ b/src/ParserInterface.php @@ -3,7 +3,10 @@ namespace Contracts; -@trigger_error(__NAMESPACE__ . '\ParserInterface is deprecated.', E_USER_DEPRECATED); +@trigger_error( + __NAMESPACE__ . '\ParserInterface is deprecated. Use \CsvParser\Parser\ParserInterface intead.', + E_USER_DEPRECATED +); interface ParserInterface {