mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Fixed PHPUnit deprecation warnings
This commit is contained in:
parent
7fef8f0ab6
commit
f9818efff4
@ -33,7 +33,7 @@ class BrewingStandTest extends TestCase{
|
||||
/**
|
||||
* @phpstan-return \Generator<int, array{list<BrewingStandSlot>}, void, void>
|
||||
*/
|
||||
public function slotsProvider() : \Generator{
|
||||
public static function slotsProvider() : \Generator{
|
||||
yield [array_values(BrewingStandSlot::getAll())];
|
||||
yield [[BrewingStandSlot::EAST()]];
|
||||
yield [[BrewingStandSlot::EAST(), BrewingStandSlot::NORTHWEST()]];
|
||||
|
@ -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']
|
||||
|
@ -69,7 +69,7 @@ class BlockStateUpgraderTest extends TestCase{
|
||||
public function testRenameId() : void{
|
||||
$this->getNewSchema()->renamedIds[self::TEST_BLOCK] = self::TEST_BLOCK_2;
|
||||
|
||||
$getStateData = fn() => $this->getEmptyPreimage();
|
||||
$getStateData = fn() => self::getEmptyPreimage();
|
||||
$upgradedStateData = $this->upgrade($getStateData(), $getStateData);
|
||||
|
||||
self::assertSame($upgradedStateData->getName(), self::TEST_BLOCK_2);
|
||||
@ -79,11 +79,11 @@ class BlockStateUpgraderTest extends TestCase{
|
||||
$schema->addedProperties[self::TEST_BLOCK][self::TEST_PROPERTY] = new IntTag(self::TEST_PROPERTY_VALUE_1);
|
||||
}
|
||||
|
||||
private function getEmptyPreimage() : BlockStateData{
|
||||
private static function getEmptyPreimage() : BlockStateData{
|
||||
return new BlockStateData(self::TEST_BLOCK, [], self::TEST_VERSION);
|
||||
}
|
||||
|
||||
private function getPreimageOneProperty(string $propertyName, int $value) : BlockStateData{
|
||||
private static function getPreimageOneProperty(string $propertyName, int $value) : BlockStateData{
|
||||
return new BlockStateData(
|
||||
self::TEST_BLOCK,
|
||||
[$propertyName => new IntTag($value)],
|
||||
@ -94,7 +94,7 @@ class BlockStateUpgraderTest extends TestCase{
|
||||
public function testAddNewProperty() : void{
|
||||
$this->prepareAddPropertySchema($this->getNewSchema());
|
||||
|
||||
$getStateData = fn() => $this->getEmptyPreimage();
|
||||
$getStateData = fn() => self::getEmptyPreimage();
|
||||
$upgradedStateData = $this->upgrade($getStateData(), $getStateData);
|
||||
|
||||
self::assertSame(self::TEST_PROPERTY_VALUE_1, $upgradedStateData->getState(self::TEST_PROPERTY)?->getValue());
|
||||
@ -103,7 +103,7 @@ class BlockStateUpgraderTest extends TestCase{
|
||||
public function testAddPropertyAlreadyExists() : void{
|
||||
$this->prepareAddPropertySchema($this->getNewSchema());
|
||||
|
||||
$getStateData = fn() => $this->getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_1 + 1);
|
||||
$getStateData = fn() => self::getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_1 + 1);
|
||||
$stateData = $getStateData();
|
||||
$upgradedStateData = $this->upgrade($stateData, $getStateData);
|
||||
|
||||
@ -118,9 +118,9 @@ class BlockStateUpgraderTest extends TestCase{
|
||||
/**
|
||||
* @phpstan-return \Generator<int, array{\Closure() : BlockStateData}, void, void>
|
||||
*/
|
||||
public function removePropertyProvider() : \Generator{
|
||||
yield [fn() => $this->getEmptyPreimage()];
|
||||
yield [fn() => $this->getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_1)];
|
||||
public static function removePropertyProvider() : \Generator{
|
||||
yield [fn() => self::getEmptyPreimage()];
|
||||
yield [fn() => self::getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_1)];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,10 +142,10 @@ class BlockStateUpgraderTest extends TestCase{
|
||||
/**
|
||||
* @phpstan-return \Generator<int, array{\Closure() : BlockStateData, ?int}, void, void>
|
||||
*/
|
||||
public function renamePropertyProvider() : \Generator{
|
||||
yield [fn() => $this->getEmptyPreimage(), null];
|
||||
yield [fn() => $this->getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_1), self::TEST_PROPERTY_VALUE_1];
|
||||
yield [fn() => $this->getPreimageOneProperty(self::TEST_PROPERTY_2, self::TEST_PROPERTY_VALUE_1), self::TEST_PROPERTY_VALUE_1];
|
||||
public static function renamePropertyProvider() : \Generator{
|
||||
yield [fn() => self::getEmptyPreimage(), null];
|
||||
yield [fn() => self::getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_1), self::TEST_PROPERTY_VALUE_1];
|
||||
yield [fn() => self::getPreimageOneProperty(self::TEST_PROPERTY_2, self::TEST_PROPERTY_VALUE_1), self::TEST_PROPERTY_VALUE_1];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -170,18 +170,18 @@ class BlockStateUpgraderTest extends TestCase{
|
||||
/**
|
||||
* @phpstan-return \Generator<int, array{\Closure() : BlockStateData, ?int}, void, void>
|
||||
*/
|
||||
public function remapPropertyValueProvider() : \Generator{
|
||||
public static function remapPropertyValueProvider() : \Generator{
|
||||
//no property to remap
|
||||
yield [fn() => $this->getEmptyPreimage(), null];
|
||||
yield [fn() => self::getEmptyPreimage(), null];
|
||||
|
||||
//value that will be remapped
|
||||
yield [fn() => $this->getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_1), self::TEST_PROPERTY_VALUE_2];
|
||||
yield [fn() => self::getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_1), self::TEST_PROPERTY_VALUE_2];
|
||||
|
||||
//value that is already at the target value
|
||||
yield [fn() => $this->getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_2), self::TEST_PROPERTY_VALUE_2];
|
||||
yield [fn() => self::getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_2), self::TEST_PROPERTY_VALUE_2];
|
||||
|
||||
//value that is not remapped and is different from target value (to detect unconditional overwrite bugs)
|
||||
yield [fn() => $this->getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_3), self::TEST_PROPERTY_VALUE_3];
|
||||
yield [fn() => self::getPreimageOneProperty(self::TEST_PROPERTY, self::TEST_PROPERTY_VALUE_3), self::TEST_PROPERTY_VALUE_3];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,7 +213,7 @@ class BlockStateUpgraderTest extends TestCase{
|
||||
/**
|
||||
* @phpstan-return \Generator<int, array{int, int, bool}, void, void>
|
||||
*/
|
||||
public function upgraderVersionCompatibilityProvider() : \Generator{
|
||||
public static function upgraderVersionCompatibilityProvider() : \Generator{
|
||||
yield [0x1_00_00_00, 0x1_00_00_00, true]; //Same version: must be altered - this may be a backwards-compatible change that Mojang didn't bother to bump for
|
||||
yield [0x1_00_01_00, 0x1_00_00_00, true]; //Schema newer than block: must be altered
|
||||
yield [0x1_00_00_00, 0x1_00_01_00, false]; //Block newer than schema: block must NOT be altered
|
||||
|
@ -49,7 +49,7 @@ class HandlerListManagerTest extends TestCase{
|
||||
* @return \Generator|mixed[][]
|
||||
* @phpstan-return \Generator<int, array{\ReflectionClass<Event>, 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<int, array{\ReflectionClass<Event>, \ReflectionClass<Event>|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];
|
||||
|
@ -32,7 +32,7 @@ class LegacyStringToItemParserTest extends TestCase{
|
||||
* @return mixed[][]
|
||||
* @phpstan-return list<array{string,Item}>
|
||||
*/
|
||||
public function itemFromStringProvider() : array{
|
||||
public static function itemFromStringProvider() : array{
|
||||
return [
|
||||
["dye:4", VanillaItems::LAPIS_LAZULI()],
|
||||
["351", VanillaItems::INK_SAC()],
|
||||
|
@ -32,7 +32,7 @@ class ApiVersionTest extends TestCase{
|
||||
* @return \Generator|mixed[][]
|
||||
* @phpstan-return \Generator<int, array{string, string, bool}, void, void>
|
||||
*/
|
||||
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<int, array{list<string>, list<string>}, 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"]];
|
||||
|
@ -30,7 +30,7 @@ final class CloningRegistryTraitTest extends TestCase{
|
||||
/**
|
||||
* @phpstan-return \Generator<int, array{\Closure() : \stdClass}, void, void>
|
||||
*/
|
||||
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(); }];
|
||||
|
@ -32,7 +32,7 @@ class ConfigTest extends TestCase{
|
||||
* @return \Generator|mixed[][]
|
||||
* @phpstan-return \Generator<int, array{string, mixed[]}, void, void>
|
||||
*/
|
||||
public function fixYamlIndexesProvider() : \Generator{
|
||||
public static function fixYamlIndexesProvider() : \Generator{
|
||||
yield ["x: 1\ny: 2\nz: 3\n", [
|
||||
"x" => 1,
|
||||
"y" => 2,
|
||||
|
@ -44,7 +44,7 @@ class UtilsTest extends TestCase{
|
||||
* @return string[][]
|
||||
* @phpstan-return list<array{string}>
|
||||
*/
|
||||
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<array{string}>
|
||||
*/
|
||||
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<array{class-string, class-string}>
|
||||
*/
|
||||
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<array{string, string}>
|
||||
*/
|
||||
public function validInstanceInvalidCombinationsProvider() : array{
|
||||
public static function validInstanceInvalidCombinationsProvider() : array{
|
||||
return [
|
||||
["iDontExist abc", TestInstantiableClass::class],
|
||||
[TestInstantiableClass::class, "iDon'tExist abc"],
|
||||
|
@ -74,7 +74,7 @@ class RegionLoaderTest extends TestCase{
|
||||
* @return \Generator|int[][]
|
||||
* @phpstan-return \Generator<int, array{int,int}, void, void>
|
||||
*/
|
||||
public function outOfBoundsCoordsProvider() : \Generator{
|
||||
public static function outOfBoundsCoordsProvider() : \Generator{
|
||||
yield [-1, -1];
|
||||
yield [32, 32];
|
||||
yield [-1, 32];
|
||||
|
@ -31,7 +31,7 @@ class RegionLocationTableEntryTest extends TestCase{
|
||||
/**
|
||||
* @phpstan-return \Generator<int, array{RegionLocationTableEntry, RegionLocationTableEntry, bool}, void, void>
|
||||
*/
|
||||
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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user