Merge remote-tracking branch 'origin/stable'

# Conflicts:
#	resources/vanilla
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/tile/Tile.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/l7-baseline.neon
This commit is contained in:
Dylan K. Taylor 2020-11-12 22:10:47 +00:00
commit 8e0cba56b8
4 changed files with 28 additions and 43 deletions

41
composer.lock generated
View File

@ -999,36 +999,31 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "doctrine/instantiator", "name": "doctrine/instantiator",
"version": "1.3.1", "version": "1.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/instantiator.git", "url": "https://github.com/doctrine/instantiator.git",
"reference": "f350df0268e904597e3bd9c4685c53e0e333feea" "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b",
"reference": "f350df0268e904597e3bd9c4685c53e0e333feea", "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1 || ^8.0" "php": "^7.1 || ^8.0"
}, },
"require-dev": { "require-dev": {
"doctrine/coding-standard": "^6.0", "doctrine/coding-standard": "^8.0",
"ext-pdo": "*", "ext-pdo": "*",
"ext-phar": "*", "ext-phar": "*",
"phpbench/phpbench": "^0.13", "phpbench/phpbench": "^0.13 || 1.0.0-alpha2",
"phpstan/phpstan-phpunit": "^0.11", "phpstan/phpstan": "^0.12",
"phpstan/phpstan-shim": "^0.11", "phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.0" "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
}, },
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
@ -1042,7 +1037,7 @@
{ {
"name": "Marco Pivetta", "name": "Marco Pivetta",
"email": "ocramius@gmail.com", "email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/" "homepage": "https://ocramius.github.io/"
} }
], ],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
@ -1053,7 +1048,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/doctrine/instantiator/issues", "issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/1.3.x" "source": "https://github.com/doctrine/instantiator/tree/1.4.0"
}, },
"funding": [ "funding": [
{ {
@ -1069,7 +1064,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-05-29T17:27:14+00:00" "time": "2020-11-10T18:47:58+00:00"
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
@ -2016,16 +2011,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.4.2", "version": "9.4.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "3866b2eeeed21b1b099c4bc0b7a1690ac6fd5baa" "reference": "9fa359ff5ddaa5eb2be2bedb08a6a5787a5807ab"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3866b2eeeed21b1b099c4bc0b7a1690ac6fd5baa", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9fa359ff5ddaa5eb2be2bedb08a6a5787a5807ab",
"reference": "3866b2eeeed21b1b099c4bc0b7a1690ac6fd5baa", "reference": "9fa359ff5ddaa5eb2be2bedb08a6a5787a5807ab",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2103,7 +2098,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.4.2" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.4.3"
}, },
"funding": [ "funding": [
{ {
@ -2115,7 +2110,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-10-19T09:23:29+00:00" "time": "2020-11-10T12:53:30+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",

View File

@ -42,8 +42,8 @@ final class TileFactory{
*/ */
private $knownTiles = []; private $knownTiles = [];
/** /**
* @var string[][] * @var string[]
* @phpstan-var array<class-string<Tile>, list<string>> * @phpstan-var array<class-string<Tile>, string>
*/ */
private $saveNames = []; private $saveNames = [];
@ -108,7 +108,7 @@ final class TileFactory{
$this->knownTiles[$name] = $className; $this->knownTiles[$name] = $className;
} }
$this->saveNames[$className] = $saveNames; $this->saveNames[$className] = reset($saveNames);
} }
/** /**
@ -136,7 +136,7 @@ final class TileFactory{
*/ */
public function getSaveId(string $class) : string{ public function getSaveId(string $class) : string{
if(isset($this->saveNames[$class])){ if(isset($this->saveNames[$class])){
return reset($this->saveNames[$class]); return $this->saveNames[$class];
} }
throw new \InvalidArgumentException("Tile $class is not registered"); throw new \InvalidArgumentException("Tile $class is not registered");
} }

View File

@ -66,8 +66,8 @@ final class EntityFactory{
*/ */
private $creationFuncs = []; private $creationFuncs = [];
/** /**
* @var string[][] * @var string[]
* @phpstan-var array<class-string<Entity>, list<string>> * @phpstan-var array<class-string<Entity>, string>
*/ */
private $saveNames = []; private $saveNames = [];
@ -201,7 +201,7 @@ final class EntityFactory{
$this->creationFuncs[$legacyMcpeSaveId] = $creationFunc; $this->creationFuncs[$legacyMcpeSaveId] = $creationFunc;
} }
$this->saveNames[$className] = $saveNames; $this->saveNames[$className] = reset($saveNames);
} }
/** /**
@ -229,7 +229,7 @@ final class EntityFactory{
public function injectSaveId(string $class, CompoundTag $saveData) : void{ public function injectSaveId(string $class, CompoundTag $saveData) : void{
if(isset($this->saveNames[$class])){ if(isset($this->saveNames[$class])){
$saveData->setTag("id", new StringTag(reset($this->saveNames[$class]))); $saveData->setTag("id", new StringTag($this->saveNames[$class]));
}else{ }else{
throw new \InvalidArgumentException("Entity $class is not registered"); throw new \InvalidArgumentException("Entity $class is not registered");
} }
@ -240,7 +240,7 @@ final class EntityFactory{
*/ */
public function getSaveId(string $class) : string{ public function getSaveId(string $class) : string{
if(isset($this->saveNames[$class])){ if(isset($this->saveNames[$class])){
return reset($this->saveNames[$class]); return $this->saveNames[$class];
} }
throw new \InvalidArgumentException("Entity $class is not registered"); throw new \InvalidArgumentException("Entity $class is not registered");
} }

View File

@ -461,7 +461,7 @@ parameters:
path: ../../../src/block/tile/Spawnable.php path: ../../../src/block/tile/Spawnable.php
- -
message: "#^Method pocketmine\\\\block\\\\tile\\\\TileFactory\\:\\:getSaveId\\(\\) should return string but returns string\\|false\\.$#" message: "#^Array \\(array\\<class\\-string\\<pocketmine\\\\block\\\\tile\\\\Tile\\>, string\\>\\) does not accept string\\|false\\.$#"
count: 1 count: 1
path: ../../../src/block/tile/TileFactory.php path: ../../../src/block/tile/TileFactory.php
@ -530,16 +530,6 @@ parameters:
count: 1 count: 1
path: ../../../src/data/bedrock/LegacyToStringBidirectionalIdMap.php path: ../../../src/data/bedrock/LegacyToStringBidirectionalIdMap.php
-
message: "#^Parameter \\#1 \\$value of class pocketmine\\\\nbt\\\\tag\\\\StringTag constructor expects string, string\\|false given\\.$#"
count: 1
path: ../../../src/entity/EntityFactory.php
-
message: "#^Method pocketmine\\\\entity\\\\EntityFactory\\:\\:getSaveId\\(\\) should return string but returns string\\|false\\.$#"
count: 1
path: ../../../src/entity/EntityFactory.php
- -
message: "#^Parameter \\#1 \\$index of method pocketmine\\\\inventory\\\\BaseInventory\\:\\:setItem\\(\\) expects int, int\\|string given\\.$#" message: "#^Parameter \\#1 \\$index of method pocketmine\\\\inventory\\\\BaseInventory\\:\\:setItem\\(\\) expects int, int\\|string given\\.$#"
count: 1 count: 1