Skip to content

Commit

Permalink
Deprecate some contracts (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-m authored Dec 12, 2024
1 parent 0a8aa78 commit 54b12e9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
}
],
"require": {
"php": ">=7.4 <9.0"
"php": ">=7.4 <9.0",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.6",
Expand All @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
<file>test</file>
<file>rector.php</file>

<rule ref="PSR1"/>
<rule ref="PSR1">
<!-- PSR1 does not like that we trigger deprecation errors. -->
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
</rule>
<rule ref="PSR2"/>

</ruleset>
6 changes: 4 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" verbose="false">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
verbose="false"
colors="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
Expand All @@ -11,7 +13,7 @@
</listeners>
<php>
<!-- Don't fail for external dependencies. -->
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
</php>
<testsuites>
<testsuite name="all">
Expand Down
2 changes: 2 additions & 0 deletions src/CountableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Contracts;

@trigger_error(__NAMESPACE__ . '\CountableInterface is deprecated. Use \Countable instead.', E_USER_DEPRECATED);

interface CountableInterface
{
public function count(): int;
Expand Down
5 changes: 5 additions & 0 deletions src/HydratableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/ParserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 54b12e9

Please sign in to comment.