diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 3c03a2e31d..d8da5a4e37 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -18,9 +18,9 @@ parameters: path: src/PocketMine.php - - message: "#^pocketmine\\\\inventory\\\\DoubleChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#" + message: "#^Cannot instantiate interface pocketmine\\\\level\\\\format\\\\io\\\\LevelProvider\\.$#" count: 1 - path: src/inventory/DoubleChestInventory.php + path: src/pocketmine/Server.php - message: "#^Used constant pocketmine\\\\RESOURCE_PATH not found\\.$#" @@ -55,4 +55,4 @@ parameters: message: "#^Call to an undefined method pocketmine\\\\command\\\\CommandSender\\:\\:teleport\\(\\)\\.$#" count: 1 path: src/command/defaults/TeleportCommand.php - comment: "not actually possible, but high cost to fix warning" +# comment: "not actually possible, but high cost to fix warning" diff --git a/src/Server.php b/src/Server.php index 4c3dfab55f..0cdb5ec8c2 100644 --- a/src/Server.php +++ b/src/Server.php @@ -1323,7 +1323,6 @@ class Server{ return $this->broadcast($message, self::BROADCAST_CHANNEL_USERS); } - /** @var CommandSender[] $recipients */ foreach($recipients as $recipient){ $recipient->sendMessage($message); } @@ -1351,7 +1350,6 @@ class Server{ public function broadcastTip(string $tip, ?array $recipients = null) : int{ $recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS); - /** @var Player[] $recipients */ foreach($recipients as $recipient){ $recipient->sendTip($tip); } @@ -1368,7 +1366,6 @@ class Server{ public function broadcastPopup(string $popup, ?array $recipients = null) : int{ $recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS); - /** @var Player[] $recipients */ foreach($recipients as $recipient){ $recipient->sendPopup($popup); } @@ -1389,7 +1386,6 @@ class Server{ public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, ?array $recipients = null) : int{ $recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS); - /** @var Player[] $recipients */ foreach($recipients as $recipient){ $recipient->sendTitle($title, $subtitle, $fadeIn, $stay, $fadeOut); } diff --git a/src/network/mcpe/protocol/AvailableCommandsPacket.php b/src/network/mcpe/protocol/AvailableCommandsPacket.php index 1855052624..69f162fbbf 100644 --- a/src/network/mcpe/protocol/AvailableCommandsPacket.php +++ b/src/network/mcpe/protocol/AvailableCommandsPacket.php @@ -369,12 +369,9 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{ if($commandData->aliases !== null){ $addEnumFn($commandData->aliases); } - + /** @var CommandParameter[] $overload */ foreach($commandData->overloads as $overload){ - /** - * @var CommandParameter[] $overload - * @var CommandParameter $parameter - */ + /** @var CommandParameter $parameter */ foreach($overload as $parameter){ if($parameter->enum !== null){ $addEnumFn($parameter->enum); diff --git a/src/plugin/PluginManager.php b/src/plugin/PluginManager.php index 0c109b4a3d..08b2ecfdf1 100644 --- a/src/plugin/PluginManager.php +++ b/src/plugin/PluginManager.php @@ -510,7 +510,7 @@ class PluginManager{ $eventClass = $parameters[0]->getClass(); }catch(\ReflectionException $e){ //class doesn't exist if(isset($tags["softDepend"]) && !isset($this->plugins[$tags["softDepend"]])){ - $this->server->getLogger()->debug("Not registering @softDepend listener " . Utils::getNiceClosureName($handlerClosure) . "(" . $parameters[0]->getType()->getName() . ") because plugin \"" . $tags["softDepend"] . "\" not found"); + $this->server->getLogger()->debug("Not registering @softDepend listener " . Utils::getNiceClosureName($handlerClosure) . "() because plugin \"" . $tags["softDepend"] . "\" not found"); continue; } diff --git a/tests/phpstan/configs/optional-com-dotnet.neon b/tests/phpstan/configs/optional-com-dotnet.neon index a666443450..fd46021361 100644 --- a/tests/phpstan/configs/optional-com-dotnet.neon +++ b/tests/phpstan/configs/optional-com-dotnet.neon @@ -3,19 +3,19 @@ parameters: - message: "#^Instantiated class COM not found\\.$#" count: 1 - path: src/network/upnp/UPnP.php + path: ../../../src/network/upnp/UPnP.php - message: "#^Access to property \\$StaticPortMappingCollection on an unknown class COM\\.$#" count: 2 - path: src/network/upnp/UPnP.php + path: ../../../src/network/upnp/UPnP.php - message: "#^Caught class com_exception not found\\.$#" count: 2 - path: src/network/upnp/UPnP.php + path: ../../../src/network/upnp/UPnP.php - message: "#^Call to method getMessage\\(\\) on an unknown class com_exception\\.$#" count: 1 - path: src/network/upnp/UPnP.php + path: ../../../src/network/upnp/UPnP.php diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index b281726585..0366bd6a56 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -1,12 +1,12 @@ parameters: ignoreErrors: - - message: "#^PHPDoc tag @param has invalid value \\(.+\\)\\: Unexpected token \"&\", expected TOKEN_VARIABLE at offset \\d+$#" - path: src + message: "#^PHPDoc tag @param has invalid value \\(.+\\)\\: Unexpected token \"&\", expected variable at offset \\d+$#" + path: ../../../src - message: "#^Default value of the parameter \\#\\d+ \\$[A-Za-z\\d_]+ \\(\\-?\\d+\\) of method .+\\(\\) is incompatible with type float\\.$#" - path: src + path: ../../../src - message: "#^Call to method count\\(\\) on an unknown class _HumbugBoxbfaeed0746fa\\\\Ds\\\\Deque\\.$#" diff --git a/tests/phpstan/configs/pthreads-bugs.neon b/tests/phpstan/configs/pthreads-bugs.neon index 987af95c05..a14d57d33c 100644 --- a/tests/phpstan/configs/pthreads-bugs.neon +++ b/tests/phpstan/configs/pthreads-bugs.neon @@ -2,5 +2,5 @@ parameters: ignoreErrors: - message: "#^Variable \\$GLOBALS in isset\\(\\) always exists and is not nullable\\.$#" - path: src/MemoryManager.php + path: ../../../src/MemoryManager.php diff --git a/tests/travis.sh b/tests/travis.sh index 14480e69bf..c171240d6d 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -21,7 +21,7 @@ if [ $? -ne 0 ]; then exit 1 fi -[ ! -f phpstan.phar ] && echo "Downloading PHPStan..." && curl -sSLO https://github.com/phpstan/phpstan/releases/download/0.11.19/phpstan.phar +[ ! -f phpstan.phar ] && echo "Downloading PHPStan..." && curl -sSLO https://github.com/phpstan/phpstan/releases/download/0.12.0/phpstan.phar "$PHP_BINARY" phpstan.phar analyze --no-progress --memory-limit=2G || exit 1 echo "PHPStan scan succeeded"