diff --git a/composer.json b/composer.json index 9251a64b6..fbf9f1fd6 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpstan/phpstan": "1.8.11", + "phpstan/phpstan": "1.9.1", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 4814b9193..b3cd775be 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0a402cad3151b4efa4f5da8034293b6d", + "content-hash": "e2b0a5b76ace05c6d6bd760d1f96ebe5", "packages": [ { "name": "adhocore/json-comment", @@ -1510,16 +1510,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.11", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "46e223dd68a620da18855c23046ddb00940b4014" + "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46e223dd68a620da18855c23046ddb00940b4014", - "reference": "46e223dd68a620da18855c23046ddb00940b4014", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", + "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", "shasum": "" }, "require": { @@ -1549,7 +1549,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.11" + "source": "https://github.com/phpstan/phpstan/tree/1.9.1" }, "funding": [ { @@ -1565,7 +1565,7 @@ "type": "tidelift" } ], - "time": "2022-10-24T15:45:13+00:00" + "time": "2022-11-04T13:35:59+00:00" }, { "name": "phpstan/phpstan-phpunit", diff --git a/src/command/defaults/HelpCommand.php b/src/command/defaults/HelpCommand.php index 3dc581838..3173a1ee2 100644 --- a/src/command/defaults/HelpCommand.php +++ b/src/command/defaults/HelpCommand.php @@ -76,7 +76,6 @@ class HelpCommand extends VanillaCommand{ $pageHeight = $sender->getScreenLineHeight(); if($commandName === ""){ - /** @var Command[][] $commands */ $commands = []; foreach($sender->getServer()->getCommandMap()->getCommands() as $command){ if($command->testPermissionSilent($sender)){ diff --git a/src/plugin/PluginGraylist.php b/src/plugin/PluginGraylist.php index ef719b72b..84aa3f792 100644 --- a/src/plugin/PluginGraylist.php +++ b/src/plugin/PluginGraylist.php @@ -70,8 +70,7 @@ class PluginGraylist{ } $isWhitelist = match($array["mode"]){ "whitelist" => true, - "blacklist" => false, - default => throw new \InvalidArgumentException("\"mode\" must be either \"whitelist\" or \"blacklist\"") + "blacklist" => false }; $plugins = []; if(isset($array["plugins"])){ diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 35d6595ca..3e8e420b7 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -313,7 +313,7 @@ final class Utils{ } }elseif(($cpuPresent = @file_get_contents("/sys/devices/system/cpu/present")) !== false){ if(preg_match("/^([0-9]+)\\-([0-9]+)$/", trim($cpuPresent), $matches) > 0){ - $processors = (int) ($matches[2] - $matches[1]); + $processors = ((int) $matches[2]) - ((int) $matches[1]); } } break; diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index e50532cfd..c84371b11 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -15,6 +15,11 @@ parameters: count: 1 path: ../../../src/entity/projectile/Projectile.php + - + message: "#^Empty array passed to foreach\\.$#" + count: 1 + path: ../../../src/network/mcpe/cache/ChunkCache.php + - message: "#^Match arm comparison between 4 and 4 is always true\\.$#" count: 1