mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Force types of RegistryTrait usages to shut PHPStan up
we need generic traits to solve this problem properly.
This commit is contained in:
parent
8e2b9b686b
commit
f93bc0739c
@ -685,7 +685,10 @@ final class VanillaBlocks{
|
||||
* @return Block[]
|
||||
*/
|
||||
public static function getAll() : array{
|
||||
return self::_registryGetAll();
|
||||
//phpstan doesn't support generic traits yet :(
|
||||
/** @var Block[] $result */
|
||||
$result = self::_registryGetAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected static function setup() : void{
|
||||
|
@ -112,7 +112,10 @@ final class VanillaEffects{
|
||||
* @return Effect[]
|
||||
*/
|
||||
public static function getAll() : array{
|
||||
return self::_registryGetAll();
|
||||
//phpstan doesn't support generic traits yet :(
|
||||
/** @var Effect[] $result */
|
||||
$result = self::_registryGetAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function fromString(string $name) : Effect{
|
||||
|
@ -312,7 +312,10 @@ final class VanillaItems{
|
||||
* @return Item[]
|
||||
*/
|
||||
public static function getAll() : array{
|
||||
return self::_registryGetAll();
|
||||
//phpstan doesn't support generic traits yet :(
|
||||
/** @var Item[] $result */
|
||||
$result = self::_registryGetAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected static function setup() : void{
|
||||
|
@ -51,7 +51,10 @@ trait EnumTrait{
|
||||
* @return self[]
|
||||
*/
|
||||
public static function getAll() : array{
|
||||
return self::_registryGetAll();
|
||||
//phpstan doesn't support generic traits yet :(
|
||||
/** @var self[] $result */
|
||||
$result = self::_registryGetAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,7 +64,10 @@ trait EnumTrait{
|
||||
* @throws \InvalidArgumentException if no member matches.
|
||||
*/
|
||||
public static function fromString(string $name) : self{
|
||||
return self::_registryFromString($name);
|
||||
//phpstan doesn't support generic traits yet :(
|
||||
/** @var self $result */
|
||||
$result = self::_registryFromString($name);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @var int|null */
|
||||
|
@ -420,11 +420,6 @@ parameters:
|
||||
count: 2
|
||||
path: ../../../src/block/Sugarcane.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\VanillaBlocks\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\block\\\\Block\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/VanillaBlocks.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getTileAt\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
@ -555,11 +550,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../src/entity/Skin.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\entity\\\\effect\\\\VanillaEffects\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\entity\\\\effect\\\\Effect\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/entity/effect/VanillaEffects.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$x of method pocketmine\\\\block\\\\Block\\:\\:position\\(\\) expects int, float\\|int given\\.$#"
|
||||
count: 1
|
||||
@ -630,11 +620,6 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../src/item/ItemFactory.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\item\\\\VanillaItems\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\item\\\\Item\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/item/VanillaItems.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$input1 of function array_map expects array, array\\|false given\\.$#"
|
||||
count: 1
|
||||
@ -795,126 +780,6 @@ parameters:
|
||||
count: 2
|
||||
path: ../../../src/scheduler/AsyncPool.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\DyeColor\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\block\\\\utils\\\\DyeColor\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/DyeColor.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\DyeColor\\:\\:fromString\\(\\) should return pocketmine\\\\block\\\\utils\\\\DyeColor but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/DyeColor.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\SkullType\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\block\\\\utils\\\\SkullType\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/SkullType.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\SkullType\\:\\:fromString\\(\\) should return pocketmine\\\\block\\\\utils\\\\SkullType but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/SkullType.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\SlabType\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\block\\\\utils\\\\SlabType\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/SlabType.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\SlabType\\:\\:fromString\\(\\) should return pocketmine\\\\block\\\\utils\\\\SlabType but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/SlabType.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\StairShape\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\block\\\\utils\\\\StairShape\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/StairShape.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\StairShape\\:\\:fromString\\(\\) should return pocketmine\\\\block\\\\utils\\\\StairShape but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/StairShape.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\TreeType\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\block\\\\utils\\\\TreeType\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/TreeType.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\block\\\\utils\\\\TreeType\\:\\:fromString\\(\\) should return pocketmine\\\\block\\\\utils\\\\TreeType but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/utils/TreeType.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\item\\\\ItemUseResult\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\item\\\\ItemUseResult\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/item/ItemUseResult.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\item\\\\ItemUseResult\\:\\:fromString\\(\\) should return pocketmine\\\\item\\\\ItemUseResult but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/item/ItemUseResult.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\item\\\\ToolTier\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\item\\\\ToolTier\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/item/ToolTier.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\item\\\\ToolTier\\:\\:fromString\\(\\) should return pocketmine\\\\item\\\\ToolTier but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/item/ToolTier.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\player\\\\GameMode\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\player\\\\GameMode\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/player/GameMode.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\player\\\\GameMode\\:\\:fromString\\(\\) should return pocketmine\\\\player\\\\GameMode but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/player/GameMode.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\player\\\\UsedChunkStatus\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\player\\\\UsedChunkStatus\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/player/UsedChunkStatus.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\player\\\\UsedChunkStatus\\:\\:fromString\\(\\) should return pocketmine\\\\player\\\\UsedChunkStatus but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/player/UsedChunkStatus.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\plugin\\\\PluginLoadOrder\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\plugin\\\\PluginLoadOrder\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/plugin/PluginLoadOrder.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\plugin\\\\PluginLoadOrder\\:\\:fromString\\(\\) should return pocketmine\\\\plugin\\\\PluginLoadOrder but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/plugin/PluginLoadOrder.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\utils\\\\TestEnum\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\utils\\\\TestEnum\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../phpunit/utils/TestEnum.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\utils\\\\TestEnum\\:\\:fromString\\(\\) should return pocketmine\\\\utils\\\\TestEnum but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../phpunit/utils/TestEnum.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\world\\\\sound\\\\NoteInstrument\\:\\:getAll\\(\\) should return array\\<pocketmine\\\\world\\\\sound\\\\NoteInstrument\\> but returns array\\<object\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/world/sound/NoteInstrument.php
|
||||
|
||||
-
|
||||
message: "#^Method pocketmine\\\\world\\\\sound\\\\NoteInstrument\\:\\:fromString\\(\\) should return pocketmine\\\\world\\\\sound\\\\NoteInstrument but returns object\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/world/sound/NoteInstrument.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$subject of function preg_match expects string, string\\|false given\\.$#"
|
||||
count: 1
|
||||
|
@ -39,11 +39,15 @@ final class TestCloningRegistry{
|
||||
* @return \stdClass[]
|
||||
*/
|
||||
public static function getAll() : array{
|
||||
return self::_registryGetAll();
|
||||
/** @var \stdClass[] $result */
|
||||
$result = self::_registryGetAll();
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function fromString(string $s) : \stdClass{
|
||||
return self::_registryFromString($s);
|
||||
/** @var \stdClass $result */
|
||||
$result = self::_registryFromString($s);
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected static function setup() : void{
|
||||
|
Loading…
x
Reference in New Issue
Block a user