From 0c8c2885827cfc62035f30bac38840ea60e7513b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Mon, 3 Jan 2022 19:26:46 +0100 Subject: [PATCH] Fix: Deprecate provide methods --- CHANGELOG.md | 2 ++ phpstan-baseline.neon | 36 ++++++++++++++++++++++++++++++++++++ psalm-baseline.xml | 26 ++++++++++++++++++++++++-- src/Helper.php | 9 +++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0cf6ac..a7d16cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Dropped support for PHP 7.2 ([#530]), by [@localheinz] - Dropped support for PHP 7.3 ([#540]), by [@localheinz] - Deprecated all assertions ([#548]), by [@localheinz] +- Deprecated provide methods ([#549]), by [@localheinz] For a full diff see [`1.5.0...main`][1.5.0...main]. @@ -194,6 +195,7 @@ For a full diff see [`0.7.0...0.8.0`][0.7.0...0.8.0]. [#530]: https://github.com/ergebnis/test-util/pull/530 [#540]: https://github.com/ergebnis/test-util/pull/540 [#548]: https://github.com/ergebnis/test-util/pull/548 +[#549]: https://github.com/ergebnis/test-util/pull/549 [@dependabot]: https://github.com/dependabot [@ergebnis]: https://github.com/ergebnis diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e1827b3..d09dce0 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -805,6 +805,15 @@ parameters: count: 1 path: src/DataProvider/StringProvider.php + - + message: + """ + #^Call to deprecated method provideDataForValues\\(\\) of class Ergebnis\\\\Test\\\\Util\\\\Test\\\\Unit\\\\DataProvider\\\\AbstractProviderTestCase\\: + use ergebnis/data\\-provider instead$# + """ + count: 1 + path: test/Unit/DataProvider/AbstractProviderTestCase.php + - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsArray\\(\\) with array and non\\-empty\\-string will always evaluate to true\\.$#" count: 1 @@ -1595,6 +1604,33 @@ parameters: count: 4 path: test/Unit/HelperTest.php + - + message: + """ + #^Call to deprecated method provideDataForValues\\(\\) of class Ergebnis\\\\Test\\\\Util\\\\Test\\\\Unit\\\\HelperTest\\: + use ergebnis/data\\-provider instead$# + """ + count: 2 + path: test/Unit/HelperTest.php + + - + message: + """ + #^Call to deprecated method provideDataForValuesWhere\\(\\) of class Ergebnis\\\\Test\\\\Util\\\\Test\\\\Unit\\\\HelperTest\\: + use ergebnis/data\\-provider instead$# + """ + count: 3 + path: test/Unit/HelperTest.php + + - + message: + """ + #^Call to deprecated method provideDataForValuesWhereNot\\(\\) of class Ergebnis\\\\Test\\\\Util\\\\Test\\\\Unit\\\\HelperTest\\: + use ergebnis/data\\-provider instead$# + """ + count: 3 + path: test/Unit/HelperTest.php + - message: "#^Generator expects key type string, int given\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index d6d486b..847fa96 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,6 +1,9 @@ + + self::provideDataForValues(self::values()) + \Generator<string, array{0: bool}> \Generator<string, array{0: bool}> @@ -11,6 +14,9 @@ + + self::provideDataForValues(self::values()) + \Generator<string, array{0: float}> \Generator<string, array{0: float}> @@ -22,6 +28,9 @@ + + self::provideDataForValues(self::values()) + \Generator<string, array{0: int}> \Generator<string, array{0: int}> @@ -33,21 +42,27 @@ + \Generator<string, array{0: null}> + \Generator<string, array{0: bool}> + \Generator<string, array{0: resource}> + + self::provideDataForValues(self::values()) + \Generator<string, array{0: string}> \Generator<string, array{0: string}> @@ -58,7 +73,7 @@ - + self::assertClassExists($className) self::assertClassExists($className) self::assertClassExists($className) @@ -72,6 +87,8 @@ self::assertInterfaceExists($parentInterfaceName) self::assertTraitExists($traitName) self::assertTraitExists($traitName) + self::provideDataForValues($filtered) + self::provideDataForValues($filtered) $excludeClassyName @@ -94,6 +111,9 @@ + + self::provideDataForValues($values) + $value @@ -203,7 +223,7 @@ $traitName $traitName - + self::assertClassExists($className) self::assertClassExists($className) self::assertClassIsAbstract($className) @@ -220,6 +240,8 @@ self::assertInterfaceExists($interfaceName) self::assertTraitExists($traitName) self::assertTraitExists($traitName) + self::provideDataForValues($values) + self::provideDataForValues($values) \Generator<string, array<string>> diff --git a/src/Helper.php b/src/Helper.php index e0cc03d..50c8439 100644 --- a/src/Helper.php +++ b/src/Helper.php @@ -492,6 +492,9 @@ final protected static function assertTraitSatisfiesSpecification(callable $spec } /** + * @deprecated use ergebnis/data-provider instead + * @see https://github.com/ergebnis/data-provider + * * @param array $values * * @throws Exception\EmptyValues @@ -512,6 +515,9 @@ final protected static function provideDataForValues(array $values): \Generator } /** + * @deprecated use ergebnis/data-provider instead + * @see https://github.com/ergebnis/data-provider + * * @param array $values * * @throws Exception\EmptyValues @@ -536,6 +542,9 @@ final protected static function provideDataForValuesWhere(array $values, \Closur } /** + * @deprecated use ergebnis/data-provider instead + * @see https://github.com/ergebnis/data-provider + * * @param array $values * * @throws Exception\EmptyValues