diff --git a/src/block/tile/TileFactory.php b/src/block/tile/TileFactory.php index 8f1d100d7..20752f39c 100644 --- a/src/block/tile/TileFactory.php +++ b/src/block/tile/TileFactory.php @@ -34,9 +34,15 @@ use function reset; final class TileFactory{ - /** @var string[] classes that extend Tile */ + /** + * @var string[] classes that extend Tile + * @phpstan-var array> + */ private static $knownTiles = []; - /** @var string[][] */ + /** + * @var string[][] + * @phpstan-var array, list> + */ private static $saveNames = []; /** @var string[] base class => overridden class */ private static $classMapping = []; @@ -90,6 +96,7 @@ final class TileFactory{ /** * @param string[] $saveNames + * @phpstan-param class-string $className */ public static function register(string $className, array $saveNames = []) : void{ Utils::testValidInstance($className, Tile::class); diff --git a/src/entity/EntityFactory.php b/src/entity/EntityFactory.php index 35c4798b7..69fdbb328 100644 --- a/src/entity/EntityFactory.php +++ b/src/entity/EntityFactory.php @@ -114,6 +114,7 @@ final class EntityFactory{ * @param string $className Class that extends Entity * @param string[] $saveNames An array of save names which this entity might be saved under. Defaults to the short name of the class itself if empty. * @param int|null $legacyMcpeSaveId + * @phpstan-param class-string $className * * NOTE: The first save name in the $saveNames array will be used when saving the entity to disk. The reflection * name of the class will be appended to the end and only used if no other save names are specified. diff --git a/src/plugin/PluginManager.php b/src/plugin/PluginManager.php index 5fc24bb99..863172303 100644 --- a/src/plugin/PluginManager.php +++ b/src/plugin/PluginManager.php @@ -73,7 +73,10 @@ class PluginManager{ /** @var Plugin[] */ protected $enabledPlugins = []; - /** @var PluginLoader[] */ + /** + * @var PluginLoader[] + * @phpstan-var array, PluginLoader> + */ protected $fileAssociations = []; /** @var string|null */ @@ -176,6 +179,7 @@ class PluginManager{ /** * @param string[]|null $newLoaders + * @phpstan-param list> $newLoaders * * @return Plugin[] */ diff --git a/src/world/WorldManager.php b/src/world/WorldManager.php index bdeedab46..a7ec2de1f 100644 --- a/src/world/WorldManager.php +++ b/src/world/WorldManager.php @@ -235,6 +235,7 @@ class WorldManager{ * Generates a new world if it does not exist * * @param string $generator Class name that extends pocketmine\world\generator\Generator + * @phpstan-param class-string $generator * * @throws \InvalidArgumentException */ diff --git a/src/world/format/io/WorldProviderManager.php b/src/world/format/io/WorldProviderManager.php index f2346847a..a4f936031 100644 --- a/src/world/format/io/WorldProviderManager.php +++ b/src/world/format/io/WorldProviderManager.php @@ -68,6 +68,9 @@ abstract class WorldProviderManager{ self::$default = $class; } + /** + * @phpstan-param class-string $class + */ public static function addProvider(string $class, string $name, bool $overwrite = false) : void{ Utils::testValidInstance($class, WorldProvider::class); @@ -105,6 +108,8 @@ abstract class WorldProviderManager{ /** * Returns a WorldProvider by name, or null if not found + * + * @phpstan-return class-string|null */ public static function getProviderByName(string $name) : ?string{ return self::$providers[trim(strtolower($name))] ?? null; diff --git a/src/world/generator/GeneratorManager.php b/src/world/generator/GeneratorManager.php index 315595d39..b55640750 100644 --- a/src/world/generator/GeneratorManager.php +++ b/src/world/generator/GeneratorManager.php @@ -51,6 +51,7 @@ final class GeneratorManager{ * @param string $class Fully qualified name of class that extends \pocketmine\world\generator\Generator * @param string $name Alias for this generator type that can be written in configs * @param bool $overwrite Whether to force overwriting any existing registered generator with the same name + * @phpstan-param class-string $class * * @throws \InvalidArgumentException */ @@ -78,7 +79,9 @@ final class GeneratorManager{ * * @param bool $throwOnMissing @deprecated this is for backwards compatibility only * - * @return string|Generator Name of class that extends Generator (not an actual Generator object) + * @return string Name of class that extends Generator + * @phpstan-return class-string + * * @throws \InvalidArgumentException if the generator type isn't registered */ public static function getGenerator(string $name, bool $throwOnMissing = false){ @@ -96,6 +99,7 @@ final class GeneratorManager{ * Returns the registered name of the given Generator class. * * @param string $class Fully qualified name of class that extends \pocketmine\world\generator\Generator + * @phpstan-param class-string $class * * @throws \InvalidArgumentException if the class type cannot be matched to a known alias */