Skip to content

Commit

Permalink
Closes #4567
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 28, 2020
1 parent 049a5e8 commit fa6c3e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog-10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ All notable changes of the PHPUnit 10.0 release series are documented in this fi
* [#4397](https://github.com/sebastianbergmann/phpunit/issues/4397): Remove confusing parameter options for XML assertions
* [#4531](https://github.com/sebastianbergmann/phpunit/pull/4531): Remove `--loader` option as well as `testSuiteLoaderClass` and `testSuiteLoaderFile` XML configuration settings
* [#4536](https://github.com/sebastianbergmann/phpunit/issues/4536): Remove `assertFileNotIsWritable()`
* [#4567](https://github.com/sebastianbergmann/phpunit/issues/4567): Deprecate support for generators in `assertCount()` and `Count` constraint
* Removed the `PHPUnit\Runner\TestSuiteLoader` interface

[10.0.0]: https://github.com/sebastianbergmann/phpunit/compare/9.5...master
5 changes: 5 additions & 0 deletions src/Framework/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use function strpos;
use ArrayAccess;
use Countable;
use Generator;
use PHPUnit\Framework\Constraint\ArrayHasKey;
use PHPUnit\Framework\Constraint\Callback;
use PHPUnit\Framework\Constraint\ClassHasAttribute;
Expand Down Expand Up @@ -275,6 +276,10 @@ public static function assertCount(int $expectedCount, $haystack, string $messag
throw InvalidArgumentException::create(2, 'countable or iterable');
}

if ($haystack instanceof Generator) {
self::createWarning('Passing an argument of type Generator for the $haystack parameter is deprecated. Support for this will be removed in PHPUnit 11.');
}

static::assertThat(
$haystack,
new Count($expectedCount),
Expand Down

0 comments on commit fa6c3e4

Please sign in to comment.