From 54b12e9ee5c7194597a21dc54f79f0bfc27e8375 Mon Sep 17 00:00:00 2001 From: Paul Mitchum Date: Thu, 12 Dec 2024 15:59:14 -0600 Subject: [PATCH] Deprecate some contracts (#16) --- composer.json | 5 +++-- phpcs.xml | 5 ++++- phpunit.xml | 6 ++++-- src/CountableInterface.php | 2 ++ src/HydratableInterface.php | 5 +++++ src/ParserInterface.php | 5 +++++ 6 files changed, 23 insertions(+), 5 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 eceeba6..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 @@ -11,7 +13,7 @@ - + diff --git a/src/CountableInterface.php b/src/CountableInterface.php index 358c85e..12825f4 100644 --- a/src/CountableInterface.php +++ b/src/CountableInterface.php @@ -2,6 +2,8 @@ namespace Contracts; +@trigger_error(__NAMESPACE__ . '\CountableInterface is deprecated. Use \Countable instead.', E_USER_DEPRECATED); + interface CountableInterface { public function count(): int; diff --git a/src/HydratableInterface.php b/src/HydratableInterface.php index 30b8f45..f9efc78 100644 --- a/src/HydratableInterface.php +++ b/src/HydratableInterface.php @@ -2,6 +2,11 @@ namespace Contracts; +@trigger_error( + __NAMESPACE__ . '\HydratableInterface is deprecated. Use \Procrastinator\HydratableInterface intead.', + E_USER_DEPRECATED +); + interface HydratableInterface extends \JsonSerializable { public static function hydrate(string $json, $instance = null); diff --git a/src/ParserInterface.php b/src/ParserInterface.php index f39cabd..ad225c2 100644 --- a/src/ParserInterface.php +++ b/src/ParserInterface.php @@ -3,6 +3,11 @@ namespace Contracts; +@trigger_error( + __NAMESPACE__ . '\ParserInterface is deprecated. Use \CsvParser\Parser\ParserInterface intead.', + E_USER_DEPRECATED +); + interface ParserInterface { public function feed(string $chunk);