Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

Fix: Deprecate provide methods #549

Merged
merged 1 commit into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].

Expand Down Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
26 changes: 24 additions & 2 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.17.0@6f4707aa41c9174353a6434bba3fc8840f981d9c">
<file src="src/DataProvider/BoolProvider.php">
<DeprecatedMethod occurrences="3">
<code>self::provideDataForValues(self::values())</code>
</DeprecatedMethod>
<MoreSpecificReturnType occurrences="3">
<code>\Generator&lt;string, array{0: bool}&gt;</code>
<code>\Generator&lt;string, array{0: bool}&gt;</code>
Expand All @@ -11,6 +14,9 @@
</RedundantIdentityWithTrue>
</file>
<file src="src/DataProvider/FloatProvider.php">
<DeprecatedMethod occurrences="7">
<code>self::provideDataForValues(self::values())</code>
</DeprecatedMethod>
<MoreSpecificReturnType occurrences="7">
<code>\Generator&lt;string, array{0: float}&gt;</code>
<code>\Generator&lt;string, array{0: float}&gt;</code>
Expand All @@ -22,6 +28,9 @@
</MoreSpecificReturnType>
</file>
<file src="src/DataProvider/IntProvider.php">
<DeprecatedMethod occurrences="7">
<code>self::provideDataForValues(self::values())</code>
</DeprecatedMethod>
<MoreSpecificReturnType occurrences="7">
<code>\Generator&lt;string, array{0: int}&gt;</code>
<code>\Generator&lt;string, array{0: int}&gt;</code>
Expand All @@ -33,21 +42,27 @@
</MoreSpecificReturnType>
</file>
<file src="src/DataProvider/NullProvider.php">
<DeprecatedMethod occurrences="1"/>
<MoreSpecificReturnType occurrences="1">
<code>\Generator&lt;string, array{0: null}&gt;</code>
</MoreSpecificReturnType>
</file>
<file src="src/DataProvider/ObjectProvider.php">
<DeprecatedMethod occurrences="1"/>
<MoreSpecificReturnType occurrences="1">
<code>\Generator&lt;string, array{0: bool}&gt;</code>
</MoreSpecificReturnType>
</file>
<file src="src/DataProvider/ResourceProvider.php">
<DeprecatedMethod occurrences="1"/>
<MoreSpecificReturnType occurrences="1">
<code>\Generator&lt;string, array{0: resource}&gt;</code>
</MoreSpecificReturnType>
</file>
<file src="src/DataProvider/StringProvider.php">
<DeprecatedMethod occurrences="6">
<code>self::provideDataForValues(self::values())</code>
</DeprecatedMethod>
<MoreSpecificReturnType occurrences="6">
<code>\Generator&lt;string, array{0: string}&gt;</code>
<code>\Generator&lt;string, array{0: string}&gt;</code>
Expand All @@ -58,7 +73,7 @@
</MoreSpecificReturnType>
</file>
<file src="src/Helper.php">
<DeprecatedMethod occurrences="14">
<DeprecatedMethod occurrences="16">
<code>self::assertClassExists($className)</code>
<code>self::assertClassExists($className)</code>
<code>self::assertClassExists($className)</code>
Expand All @@ -72,6 +87,8 @@
<code>self::assertInterfaceExists($parentInterfaceName)</code>
<code>self::assertTraitExists($traitName)</code>
<code>self::assertTraitExists($traitName)</code>
<code>self::provideDataForValues($filtered)</code>
<code>self::provideDataForValues($filtered)</code>
</DeprecatedMethod>
<MissingClosureParamType occurrences="2">
<code>$excludeClassyName</code>
Expand All @@ -94,6 +111,9 @@
</UnnecessaryVarAnnotation>
</file>
<file src="test/Unit/DataProvider/AbstractProviderTestCase.php">
<DeprecatedMethod occurrences="1">
<code>self::provideDataForValues($values)</code>
</DeprecatedMethod>
<MixedAssignment occurrences="1">
<code>$value</code>
</MixedAssignment>
Expand Down Expand Up @@ -203,7 +223,7 @@
<code>$traitName</code>
<code>$traitName</code>
</ArgumentTypeCoercion>
<DeprecatedMethod occurrences="65">
<DeprecatedMethod occurrences="73">
<code>self::assertClassExists($className)</code>
<code>self::assertClassExists($className)</code>
<code>self::assertClassIsAbstract($className)</code>
Expand All @@ -220,6 +240,8 @@
<code>self::assertInterfaceExists($interfaceName)</code>
<code>self::assertTraitExists($traitName)</code>
<code>self::assertTraitExists($traitName)</code>
<code>self::provideDataForValues($values)</code>
<code>self::provideDataForValues($values)</code>
</DeprecatedMethod>
<InvalidReturnType occurrences="1">
<code>\Generator&lt;string, array&lt;string&gt;&gt;</code>
Expand Down
9 changes: 9 additions & 0 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, mixed> $values
*
* @throws Exception\EmptyValues
Expand All @@ -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<string, mixed> $values
*
* @throws Exception\EmptyValues
Expand All @@ -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<string, mixed> $values
*
* @throws Exception\EmptyValues
Expand Down