From 92c45dd7e19afbaaaa3f849aa62bd9b2c569aa15 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 4 Jun 2023 14:00:26 +0100 Subject: [PATCH] Fixed PHPUnit deprecation warnings --- tests/phpunit/block/BrewingStandTest.php | 2 +- tests/phpunit/command/utils/CommandStringHelperTest.php | 2 +- tests/phpunit/event/HandlerListManagerTest.php | 4 ++-- tests/phpunit/item/LegacyStringToItemParserTest.php | 2 +- tests/phpunit/plugin/ApiVersionTest.php | 4 ++-- tests/phpunit/utils/CloningRegistryTraitTest.php | 2 +- tests/phpunit/utils/ConfigTest.php | 2 +- tests/phpunit/utils/UtilsTest.php | 8 ++++---- tests/phpunit/world/format/io/region/RegionLoaderTest.php | 2 +- .../format/io/region/RegionLocationTableEntryTest.php | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/phpunit/block/BrewingStandTest.php b/tests/phpunit/block/BrewingStandTest.php index c61a1db6d..b3363b98c 100644 --- a/tests/phpunit/block/BrewingStandTest.php +++ b/tests/phpunit/block/BrewingStandTest.php @@ -33,7 +33,7 @@ class BrewingStandTest extends TestCase{ /** * @phpstan-return \Generator}, void, void> */ - public function slotsProvider() : \Generator{ + public static function slotsProvider() : \Generator{ yield [array_values(BrewingStandSlot::getAll())]; yield [[BrewingStandSlot::EAST()]]; yield [[BrewingStandSlot::EAST(), BrewingStandSlot::NORTHWEST()]]; diff --git a/tests/phpunit/command/utils/CommandStringHelperTest.php b/tests/phpunit/command/utils/CommandStringHelperTest.php index 0b8502348..047dc7ceb 100644 --- a/tests/phpunit/command/utils/CommandStringHelperTest.php +++ b/tests/phpunit/command/utils/CommandStringHelperTest.php @@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase; class CommandStringHelperTest extends TestCase{ - public function parseQuoteAwareProvider() : \Generator{ + public static function parseQuoteAwareProvider() : \Generator{ yield [ 'give "steve jobs" apple', ['give', 'steve jobs', 'apple'] diff --git a/tests/phpunit/event/HandlerListManagerTest.php b/tests/phpunit/event/HandlerListManagerTest.php index 6d728151b..edff36639 100644 --- a/tests/phpunit/event/HandlerListManagerTest.php +++ b/tests/phpunit/event/HandlerListManagerTest.php @@ -49,7 +49,7 @@ class HandlerListManagerTest extends TestCase{ * @return \Generator|mixed[][] * @phpstan-return \Generator, bool, string}, void, void> */ - public function isValidClassProvider() : \Generator{ + public static function isValidClassProvider() : \Generator{ yield [new \ReflectionClass(Event::class), false, "event base should not be handleable"]; yield [new \ReflectionClass(TestConcreteEvent::class), true, ""]; yield [new \ReflectionClass(TestAbstractEvent::class), false, "abstract event cannot be handled"]; @@ -69,7 +69,7 @@ class HandlerListManagerTest extends TestCase{ * @return \Generator|\ReflectionClass[][] * @phpstan-return \Generator, \ReflectionClass|null}, void, void> */ - public function resolveParentClassProvider() : \Generator{ + public static function resolveParentClassProvider() : \Generator{ yield [new \ReflectionClass(TestConcreteExtendsAllowHandleEvent::class), new \ReflectionClass(TestAbstractAllowHandleEvent::class)]; yield [new \ReflectionClass(TestConcreteEvent::class), null]; yield [new \ReflectionClass(TestConcreteExtendsAbstractEvent::class), null]; diff --git a/tests/phpunit/item/LegacyStringToItemParserTest.php b/tests/phpunit/item/LegacyStringToItemParserTest.php index ef5127fec..4449f4f1b 100644 --- a/tests/phpunit/item/LegacyStringToItemParserTest.php +++ b/tests/phpunit/item/LegacyStringToItemParserTest.php @@ -31,7 +31,7 @@ class LegacyStringToItemParserTest extends TestCase{ * @return mixed[][] * @phpstan-return list */ - public function itemFromStringProvider() : array{ + public static function itemFromStringProvider() : array{ return [ ["dye:4", ItemIds::DYE, 4], ["351", ItemIds::DYE, 0], diff --git a/tests/phpunit/plugin/ApiVersionTest.php b/tests/phpunit/plugin/ApiVersionTest.php index c068f25ce..faa68200d 100644 --- a/tests/phpunit/plugin/ApiVersionTest.php +++ b/tests/phpunit/plugin/ApiVersionTest.php @@ -32,7 +32,7 @@ class ApiVersionTest extends TestCase{ * @return \Generator|mixed[][] * @phpstan-return \Generator */ - public function compatibleApiProvider() : \Generator{ + public static function compatibleApiProvider() : \Generator{ yield ["3.0.0", "3.0.0", true]; yield ["3.1.0", "3.0.0", true]; yield ["3.0.0", "3.1.0", false]; @@ -58,7 +58,7 @@ class ApiVersionTest extends TestCase{ * @return mixed[][][] * @phpstan-return \Generator, list}, void, void> */ - public function ambiguousVersionsProvider() : \Generator{ + public static function ambiguousVersionsProvider() : \Generator{ yield [["3.0.0"], []]; yield [["3.0.0", "3.0.1"], ["3.0.0", "3.0.1"]]; yield [["3.0.0", "3.1.0", "4.0.0"], ["3.0.0", "3.1.0"]]; diff --git a/tests/phpunit/utils/CloningRegistryTraitTest.php b/tests/phpunit/utils/CloningRegistryTraitTest.php index 2cf10bed1..7f8298ff9 100644 --- a/tests/phpunit/utils/CloningRegistryTraitTest.php +++ b/tests/phpunit/utils/CloningRegistryTraitTest.php @@ -30,7 +30,7 @@ final class CloningRegistryTraitTest extends TestCase{ /** * @phpstan-return \Generator */ - public function cloningRegistryMembersProvider() : \Generator{ + public static function cloningRegistryMembersProvider() : \Generator{ yield [function() : \stdClass{ return TestCloningRegistry::TEST1(); }]; yield [function() : \stdClass{ return TestCloningRegistry::TEST2(); }]; yield [function() : \stdClass{ return TestCloningRegistry::TEST3(); }]; diff --git a/tests/phpunit/utils/ConfigTest.php b/tests/phpunit/utils/ConfigTest.php index 76b1a4b71..55b4bc2d4 100644 --- a/tests/phpunit/utils/ConfigTest.php +++ b/tests/phpunit/utils/ConfigTest.php @@ -32,7 +32,7 @@ class ConfigTest extends TestCase{ * @return \Generator|mixed[][] * @phpstan-return \Generator */ - public function fixYamlIndexesProvider() : \Generator{ + public static function fixYamlIndexesProvider() : \Generator{ yield ["x: 1\ny: 2\nz: 3\n", [ "x" => 1, "y" => 2, diff --git a/tests/phpunit/utils/UtilsTest.php b/tests/phpunit/utils/UtilsTest.php index ab93d73c3..f061abac2 100644 --- a/tests/phpunit/utils/UtilsTest.php +++ b/tests/phpunit/utils/UtilsTest.php @@ -44,7 +44,7 @@ class UtilsTest extends TestCase{ * @return string[][] * @phpstan-return list */ - public function parseDocCommentNewlineProvider() : array{ + public static function parseDocCommentNewlineProvider() : array{ return [ ["\t/**\r\n\t * @param PlayerJoinEvent \$event\r\n\t * @priority HIGHEST\r\n\t * @notHandler\r\n\t */"], ["\t/**\n\t * @param PlayerJoinEvent \$event\n\t * @priority HIGHEST\n\t * @notHandler\n\t */"], @@ -68,7 +68,7 @@ class UtilsTest extends TestCase{ * @return string[][] * @phpstan-return list */ - public function parseDocCommentOneLineProvider() : array{ + public static function parseDocCommentOneLineProvider() : array{ return [ ["/** @ignoreCancelled true dummy */"], ["/**@ignoreCancelled true dummy*/"], @@ -105,7 +105,7 @@ class UtilsTest extends TestCase{ * @return string[][] * @return list */ - public function validInstanceProvider() : array{ + public static function validInstanceProvider() : array{ return [ //direct instance / implement / extend [TestInstantiableClass::class, TestInstantiableClass::class], @@ -133,7 +133,7 @@ class UtilsTest extends TestCase{ * @return string[][] * @return list */ - public function validInstanceInvalidCombinationsProvider() : array{ + public static function validInstanceInvalidCombinationsProvider() : array{ return [ ["iDontExist abc", TestInstantiableClass::class], [TestInstantiableClass::class, "iDon'tExist abc"], diff --git a/tests/phpunit/world/format/io/region/RegionLoaderTest.php b/tests/phpunit/world/format/io/region/RegionLoaderTest.php index e4db90072..ee96b6bc0 100644 --- a/tests/phpunit/world/format/io/region/RegionLoaderTest.php +++ b/tests/phpunit/world/format/io/region/RegionLoaderTest.php @@ -74,7 +74,7 @@ class RegionLoaderTest extends TestCase{ * @return \Generator|int[][] * @phpstan-return \Generator */ - public function outOfBoundsCoordsProvider() : \Generator{ + public static function outOfBoundsCoordsProvider() : \Generator{ yield [-1, -1]; yield [32, 32]; yield [-1, 32]; diff --git a/tests/phpunit/world/format/io/region/RegionLocationTableEntryTest.php b/tests/phpunit/world/format/io/region/RegionLocationTableEntryTest.php index 597af06d3..498e2767e 100644 --- a/tests/phpunit/world/format/io/region/RegionLocationTableEntryTest.php +++ b/tests/phpunit/world/format/io/region/RegionLocationTableEntryTest.php @@ -31,7 +31,7 @@ class RegionLocationTableEntryTest extends TestCase{ /** * @phpstan-return \Generator */ - public function overlapDataProvider() : \Generator{ + public static function overlapDataProvider() : \Generator{ yield [new RegionLocationTableEntry(2, 1, 0), new RegionLocationTableEntry(2, 1, 0), true]; yield [new RegionLocationTableEntry(2, 1, 0), new RegionLocationTableEntry(3, 1, 0), false]; yield [new RegionLocationTableEntry(2, 2, 0), new RegionLocationTableEntry(3, 2, 0), true];