From 2af80e6cbecc5fa19abc7f557854263955bbfa85 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 10 Aug 2021 17:34:30 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/compat.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/phpunit/tests/compat.php b/tests/phpunit/tests/compat.php index b9a6872bff..ab75d6256b 100644 --- a/tests/phpunit/tests/compat.php +++ b/tests/phpunit/tests/compat.php @@ -318,6 +318,7 @@ class ArrayIteratorFake extends ArrayIterator { } class CountableFake implements Countable { + #[ReturnTypeWillChange] public function count() { return 16; }