Merge branch 'next-major' into modern-world-support

This commit is contained in:
Dylan K. Taylor
2022-05-20 11:21:35 +01:00
173 changed files with 911 additions and 1294 deletions

View File

@@ -28,13 +28,12 @@ namespace pocketmine\world\format\io;
*/
class ReadOnlyWorldProviderManagerEntry extends WorldProviderManagerEntry{
/** @phpstan-var FromPath */
private \Closure $fromPath;
/** @phpstan-param FromPath $fromPath */
public function __construct(\Closure $isValid, \Closure $fromPath){
public function __construct(
\Closure $isValid,
private \Closure $fromPath
){
parent::__construct($isValid);
$this->fromPath = $fromPath;
}
public function fromPath(string $path) : WorldProvider{ return ($this->fromPath)($path); }

View File

@@ -31,13 +31,10 @@ use pocketmine\world\format\io\exception\UnsupportedWorldFormatException;
*/
abstract class WorldProviderManagerEntry{
/** @phpstan-var IsValid */
protected \Closure $isValid;
/** @phpstan-param IsValid $isValid */
protected function __construct(\Closure $isValid){
$this->isValid = $isValid;
}
protected function __construct(
protected \Closure $isValid
){}
/**
* Tells if the path is a valid world.

View File

@@ -30,19 +30,17 @@ use pocketmine\world\WorldCreationOptions;
* @phpstan-type Generate \Closure(string $path, string $name, WorldCreationOptions $options) : void
*/
final class WritableWorldProviderManagerEntry extends WorldProviderManagerEntry{
/** @phpstan-var FromPath */
private \Closure $fromPath;
/** @phpstan-var Generate */
private \Closure $generate;
/**
* @phpstan-param FromPath $fromPath
* @phpstan-param Generate $generate
*/
public function __construct(\Closure $isValid, \Closure $fromPath, \Closure $generate){
public function __construct(
\Closure $isValid,
private \Closure $fromPath,
private \Closure $generate
){
parent::__construct($isValid);
$this->fromPath = $fromPath;
$this->generate = $generate;
}
public function fromPath(string $path) : WritableWorldProvider{