Skip to content

Commit 2af80e6

Browse files
Code Modernization: Silence the deprecation warning for missing return type in phpunit/tests/compat.php.
This fixes the "Deprecated: Return type of `CountableFake::count()` should be compatible with `Countable::count(): int`" warning on PHP 8.1. PHP native interfaces now have declared return types and methods in classes implementing these interfaces need to either have the return type declared (in a covariant compatible manner with the PHP native interface method declaration), or need to silence the deprecation warning using the `#[ReturnTypeWillChange]` attribute. Follow-up to [51517], [51529], [51530], [51531], [51532]. Props jrf. See #53635. git-svn-id: https://develop.svn.wordpress.org/trunk@51594 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 016cce0 commit 2af80e6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/phpunit/tests/compat.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ class ArrayIteratorFake extends ArrayIterator {
318318
}
319319

320320
class CountableFake implements Countable {
321+
#[ReturnTypeWillChange]
321322
public function count() {
322323
return 16;
323324
}

0 commit comments

Comments
 (0)