diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b82eb1e5..26497dc07 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,10 +38,10 @@ jobs: matrix: include: - php: 8.0.7 - config: phpstan.php8.neon + config: phpstan.neon.dist image: ubuntu-20.04 - php: 7.4.20 - config: phpstan.neon.dist + config: phpstan.php7.neon image: ubuntu-20.04 steps: diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 84a7d0141..1ea3bc16a 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -4,6 +4,7 @@ includes: - tests/phpstan/configs/gc-hacks.neon - tests/phpstan/configs/l7-baseline.neon - tests/phpstan/configs/l8-baseline.neon + - tests/phpstan/configs/php74-compat.neon - tests/phpstan/configs/php-bugs.neon - tests/phpstan/configs/phpstan-bugs.neon - tests/phpstan/configs/phpunit-wiring-tests.neon @@ -47,3 +48,5 @@ parameters: #we'll just fill it with 10 - it's very unlikely to encounter a callable with 10 parameters anyway. anyCallable: 'callable(mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed) : mixed' anyClosure: '\Closure(mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed) : mixed' + PhpSocket: '\Socket' + PhpCurlHandle: '\CurlHandle' diff --git a/phpstan.php7.neon b/phpstan.php7.neon new file mode 100644 index 000000000..e16e7b8c3 --- /dev/null +++ b/phpstan.php7.neon @@ -0,0 +1,9 @@ +includes: + - phpstan.neon.dist + - tests/phpstan/configs/php7.neon + +parameters: + phpVersion: 70400 + typeAliases: + PhpSocket: resource + PhpCurlHandle: resource diff --git a/phpstan.php8.neon b/phpstan.php8.neon deleted file mode 100644 index 2d5932c02..000000000 --- a/phpstan.php8.neon +++ /dev/null @@ -1,4 +0,0 @@ -includes: - - phpstan.neon.dist - - tests/phpstan/configs/php8.neon - diff --git a/src/pocketmine/network/rcon/RCON.php b/src/pocketmine/network/rcon/RCON.php index e0522de45..87ccab802 100644 --- a/src/pocketmine/network/rcon/RCON.php +++ b/src/pocketmine/network/rcon/RCON.php @@ -57,15 +57,24 @@ use const SOL_TCP; class RCON{ /** @var Server */ private $server; - /** @var resource */ + /** + * @var \Socket|resource + * @phpstan-var PhpSocket + */ private $socket; /** @var RCONInstance */ private $instance; - /** @var resource */ + /** + * @var \Socket|resource + * @phpstan-var PhpSocket + */ private $ipcMainSocket; - /** @var resource */ + /** + * @var resource + * @phpstan-var PhpSocket + */ private $ipcThreadSocket; public function __construct(Server $server, string $password, int $port = 19132, string $interface = "0.0.0.0", int $maxClients = 50){ diff --git a/src/pocketmine/network/rcon/RCONInstance.php b/src/pocketmine/network/rcon/RCONInstance.php index 2ff3e07da..42212f6d3 100644 --- a/src/pocketmine/network/rcon/RCONInstance.php +++ b/src/pocketmine/network/rcon/RCONInstance.php @@ -60,7 +60,10 @@ class RCONInstance extends Thread{ /** @var bool */ private $stop; - /** @var resource */ + /** + * @var \Socket|resource + * @phpstan-var PhpSocket + */ private $socket; /** @var string */ private $password; @@ -68,14 +71,19 @@ class RCONInstance extends Thread{ private $maxClients; /** @var \ThreadedLogger */ private $logger; - /** @var resource */ + /** + * @var \Socket|resource + * @phpstan-var PhpSocket + */ private $ipcSocket; /** @var SleeperNotifier|null */ private $notifier; /** - * @param resource $socket - * @param resource $ipcSocket + * @param \Socket|resource $socket + * @param \Socket|resource $ipcSocket + * @phpstan-param PhpSocket $socket + * @phpstan-param PhpSocket $ipcSocket */ public function __construct($socket, string $password, int $maxClients, \ThreadedLogger $logger, $ipcSocket, ?SleeperNotifier $notifier){ $this->stop = false; @@ -92,7 +100,8 @@ class RCONInstance extends Thread{ } /** - * @param resource $client + * @param \Socket|resource $client + * @phpstan-param PhpSocket $client * * @return int|false */ @@ -105,10 +114,11 @@ class RCONInstance extends Thread{ } /** - * @param resource $client + * @param \Socket|resource $client * @param int $requestID reference parameter * @param int $packetType reference parameter * @param string $payload reference parameter + * @phpstan-param PhpSocket $client * * @return bool */ @@ -165,7 +175,10 @@ class RCONInstance extends Thread{ public function run(){ $this->registerClassLoader(); - /** @var resource[] $clients */ + /** + * @var \Socket[]|resource[] $clients + * @phpstan-var array $clients + */ $clients = []; /** @var bool[] $authenticated */ $authenticated = []; @@ -265,7 +278,8 @@ class RCONInstance extends Thread{ } /** - * @param resource $client + * @param \Socket|resource $client + * @phpstan-param PhpSocket $client */ private function disconnectClient($client) : void{ socket_getpeername($client, $ip, $port); diff --git a/src/pocketmine/utils/Internet.php b/src/pocketmine/utils/Internet.php index 271404d36..26b393061 100644 --- a/src/pocketmine/utils/Internet.php +++ b/src/pocketmine/utils/Internet.php @@ -196,7 +196,7 @@ class Internet{ * @param callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle. * @phpstan-param array $extraOpts * @phpstan-param list $extraHeaders - * @phpstan-param (callable(resource) : void)|null $onSuccess + * @phpstan-param (callable(PhpCurlHandle) : void)|null $onSuccess * * @return array a plain array of three [result body : string, headers : string[][], HTTP response code : int]. Headers are grouped by requests with strtolower(header name) as keys and header value as values * @phpstan-return array{string, list>, int} diff --git a/src/pocketmine/utils/Utils.php b/src/pocketmine/utils/Utils.php index 5e8deeb81..1b81ad3b8 100644 --- a/src/pocketmine/utils/Utils.php +++ b/src/pocketmine/utils/Utils.php @@ -454,7 +454,7 @@ class Utils{ * @param callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle. * @phpstan-param array $extraOpts * @phpstan-param list $extraHeaders - * @phpstan-param (callable(resource) : void)|null $onSuccess + * @phpstan-param (callable(PhpCurlHandle) : void)|null $onSuccess * * @return array a plain array of three [result body : string, headers : string[][], HTTP response code : int]. Headers are grouped by requests with strtolower(header name) as keys and header value as values * @phpstan-return array{string, list>, int} diff --git a/tests/phpstan/configs/check-explicit-mixed-baseline.neon b/tests/phpstan/configs/check-explicit-mixed-baseline.neon index f0c9749a4..7c9cc5451 100644 --- a/tests/phpstan/configs/check-explicit-mixed-baseline.neon +++ b/tests/phpstan/configs/check-explicit-mixed-baseline.neon @@ -41,7 +41,7 @@ parameters: path: ../../../src/pocketmine/Player.php - - message: "#^Parameter \\#1 \\$str of function base64_decode expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$string of function base64_decode expects string, mixed given\\.$#" count: 5 path: ../../../src/pocketmine/Player.php @@ -121,7 +121,7 @@ parameters: path: ../../../src/pocketmine/Server.php - - message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/Server.php @@ -151,7 +151,7 @@ parameters: path: ../../../src/pocketmine/command/CommandReader.php - - message: "#^Parameter \\#1 \\$number of function round expects float, mixed given\\.$#" + message: "#^Parameter \\#1 \\$num of function round expects float\\|int, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/command/defaults/StatusCommand.php @@ -231,7 +231,7 @@ parameters: path: ../../../src/pocketmine/level/format/io/leveldb/LevelDB.php - - message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/level/format/io/leveldb/LevelDB.php @@ -466,7 +466,7 @@ parameters: path: ../../../src/pocketmine/plugin/PluginDescription.php - - message: "#^Parameter \\#1 \\$str of function mb_strtoupper expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$string of function mb_strtoupper expects string, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/plugin/PluginDescription.php @@ -516,7 +516,7 @@ parameters: path: ../../../src/pocketmine/resourcepacks/ZippedResourcePack.php - - message: "#^Parameter \\#1 \\$variable_representation of function unserialize expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$data of function unserialize expects string, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/scheduler/AsyncTask.php @@ -531,7 +531,7 @@ parameters: path: ../../../src/pocketmine/updater/AutoUpdater.php - - message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/updater/AutoUpdater.php @@ -541,7 +541,7 @@ parameters: path: ../../../src/pocketmine/updater/AutoUpdater.php - - message: "#^Parameter \\#2 \\$timestamp of function date expects int, mixed given\\.$#" + message: "#^Parameter \\#2 \\$timestamp of function date expects int\\|null, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/updater/AutoUpdater.php @@ -551,12 +551,12 @@ parameters: path: ../../../src/pocketmine/updater/AutoUpdater.php - - message: "#^Parameter \\#2 \\$start of function substr expects int, mixed given\\.$#" + message: "#^Parameter \\#2 \\$offset of function substr expects int, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/utils/Internet.php - - message: "#^Parameter \\#3 \\$length of function substr expects int, mixed given\\.$#" + message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/utils/Internet.php @@ -576,7 +576,7 @@ parameters: path: ../../../src/pocketmine/utils/Utils.php - - message: "#^Parameter \\#2 \\$input1 of function array_map expects array, mixed given\\.$#" + message: "#^Parameter \\#2 \\$array of function array_map expects array, mixed given\\.$#" count: 1 path: ../../../src/pocketmine/utils/Utils.php diff --git a/tests/phpstan/configs/l7-baseline.neon b/tests/phpstan/configs/l7-baseline.neon index 593bcc369..8da59e251 100644 --- a/tests/phpstan/configs/l7-baseline.neon +++ b/tests/phpstan/configs/l7-baseline.neon @@ -16,12 +16,12 @@ parameters: path: ../../../build/server-phar.php - - message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#" count: 1 path: ../../../src/pocketmine/MemoryManager.php - - message: "#^Parameter \\#1 \\$fp of function fwrite expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#" count: 1 path: ../../../src/pocketmine/MemoryManager.php @@ -86,12 +86,12 @@ parameters: path: ../../../src/pocketmine/Server.php - - message: "#^Parameter \\#1 \\$buffer of method pocketmine\\\\nbt\\\\NBTStream\\:\\:readCompressed\\(\\) expects string, string\\|false given\\.$#" + message: "#^Parameter \\#1 \\$array of function array_filter expects array, array\\\\|false given\\.$#" count: 1 path: ../../../src/pocketmine/Server.php - - message: "#^Parameter \\#1 \\$input of function array_filter expects array, array\\\\|false given\\.$#" + message: "#^Parameter \\#1 \\$buffer of method pocketmine\\\\nbt\\\\NBTStream\\:\\:readCompressed\\(\\) expects string, string\\|false given\\.$#" count: 1 path: ../../../src/pocketmine/Server.php @@ -220,23 +220,23 @@ parameters: count: 1 path: ../../../src/pocketmine/command/defaults/PardonIpCommand.php - - - message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#" - count: 2 - path: ../../../src/pocketmine/command/defaults/TimingsCommand.php - - - - message: "#^Parameter \\#1 \\$fp of function fseek expects resource, resource\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/command/defaults/TimingsCommand.php - - message: "#^Parameter \\#1 \\$fp of static method pocketmine\\\\timings\\\\TimingsHandler\\:\\:printTimings\\(\\) expects resource, resource\\|false given\\.$#" count: 1 path: ../../../src/pocketmine/command/defaults/TimingsCommand.php - - message: "#^Parameter \\#1 \\$source of function stream_get_contents expects resource, resource\\|false given\\.$#" + message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#" + count: 2 + path: ../../../src/pocketmine/command/defaults/TimingsCommand.php + + - + message: "#^Parameter \\#1 \\$stream of function fseek expects resource, resource\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/command/defaults/TimingsCommand.php + + - + message: "#^Parameter \\#1 \\$stream of function stream_get_contents expects resource, resource\\|false given\\.$#" count: 1 path: ../../../src/pocketmine/command/defaults/TimingsCommand.php @@ -276,7 +276,7 @@ parameters: path: ../../../src/pocketmine/entity/projectile/Projectile.php - - message: "#^Parameter \\#1 \\$argument of class ReflectionClass constructor expects class\\-string\\\\|T of object, string given\\.$#" + message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\\\|T of object, string given\\.$#" count: 1 path: ../../../src/pocketmine/event/HandlerList.php @@ -301,7 +301,7 @@ parameters: path: ../../../src/pocketmine/item/Item.php - - message: "#^Parameter \\#2 \\$input1 of function array_map expects array, array\\|false given\\.$#" + message: "#^Parameter \\#2 \\$array of function array_map expects array, array\\|false given\\.$#" count: 1 path: ../../../src/pocketmine/lang/BaseLang.php @@ -546,7 +546,7 @@ parameters: path: ../../../src/pocketmine/level/format/io/region/McRegion.php - - message: "#^Parameter \\#1 \\$input of function array_filter expects array, array\\\\|false given\\.$#" + message: "#^Parameter \\#1 \\$array of function array_filter expects array, array\\\\|false given\\.$#" count: 1 path: ../../../src/pocketmine/level/format/io/region/McRegion.php @@ -616,7 +616,7 @@ parameters: path: ../../../src/pocketmine/network/mcpe/VerifyLoginTask.php - - message: "#^Parameter \\#1 \\$str of function str_split expects string, string\\|false given\\.$#" + message: "#^Parameter \\#1 \\$string of function str_split expects string, string\\|false given\\.$#" count: 1 path: ../../../src/pocketmine/network/mcpe/VerifyLoginTask.php @@ -795,3 +795,8 @@ parameters: count: 3 path: ../../../src/pocketmine/tile/Tile.php + - + message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/utils/Timezone.php + diff --git a/tests/phpstan/configs/php-bugs.neon b/tests/phpstan/configs/php-bugs.neon index 224981252..b0a489b34 100644 --- a/tests/phpstan/configs/php-bugs.neon +++ b/tests/phpstan/configs/php-bugs.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Method ReflectionMethod\\:\\:getClosure\\(\\) invoked with 0 parameters, 1 required\\.$#" - count: 1 - path: ../../phpunit/network/mcpe/StupidJsonDecodeTest.php - - message: "#^Property pocketmine\\\\network\\\\mcpe\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\(string, bool\\)\\: mixed\\) does not accept Closure\\|null\\.$#" count: 1 diff --git a/tests/phpstan/configs/php7.neon b/tests/phpstan/configs/php7.neon new file mode 100644 index 000000000..e98ee2176 --- /dev/null +++ b/tests/phpstan/configs/php7.neon @@ -0,0 +1,112 @@ +parameters: + ignoreErrors: + - + message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/MemoryManager.php + + - + message: "#^Parameter \\#1 \\$fp of function fwrite expects resource, resource\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/MemoryManager.php + + - + message: "#^Parameter \\#1 \\$str of function base64_decode expects string, mixed given\\.$#" + count: 5 + path: ../../../src/pocketmine/Player.php + + - + message: "#^Parameter \\#1 \\$input of function array_filter expects array, array\\\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/Server.php + + - + message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/Server.php + + - + message: "#^Parameter \\#1 \\$number of function round expects float, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/command/defaults/StatusCommand.php + + - + message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#" + count: 2 + path: ../../../src/pocketmine/command/defaults/TimingsCommand.php + + - + message: "#^Parameter \\#1 \\$fp of function fseek expects resource, resource\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/command/defaults/TimingsCommand.php + + - + message: "#^Parameter \\#1 \\$source of function stream_get_contents expects resource, resource\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/command/defaults/TimingsCommand.php + + - + message: "#^Parameter \\#1 \\$argument of class ReflectionClass constructor expects class\\-string\\\\|T of object, string given\\.$#" + count: 1 + path: ../../../src/pocketmine/event/HandlerList.php + + - + message: "#^Parameter \\#2 \\$input1 of function array_map expects array, array\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/lang/BaseLang.php + + - + message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/level/format/io/leveldb/LevelDB.php + + - + message: "#^Parameter \\#1 \\$input of function array_filter expects array, array\\\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/level/format/io/region/McRegion.php + + - + message: "#^Parameter \\#1 \\$str of function str_split expects string, string\\|false given\\.$#" + count: 1 + path: ../../../src/pocketmine/network/mcpe/VerifyLoginTask.php + + - + message: "#^Parameter \\#1 \\$str of function mb_strtoupper expects string, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/plugin/PluginDescription.php + + - + message: "#^Parameter \\#1 \\$variable_representation of function unserialize expects string, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/scheduler/AsyncTask.php + + - + message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/updater/AutoUpdater.php + + - + message: "#^Parameter \\#2 \\$timestamp of function date expects int, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/updater/AutoUpdater.php + + - + message: "#^Parameter \\#2 \\$start of function substr expects int, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/utils/Internet.php + + - + message: "#^Parameter \\#3 \\$length of function substr expects int, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/utils/Internet.php + + - + message: "#^Parameter \\#2 \\$input1 of function array_map expects array, mixed given\\.$#" + count: 1 + path: ../../../src/pocketmine/utils/Utils.php + + - + message: "#^Method ReflectionMethod\\:\\:getClosure\\(\\) invoked with 0 parameters, 1 required\\.$#" + count: 1 + path: ../../phpunit/network/mcpe/StupidJsonDecodeTest.php + diff --git a/tests/phpstan/configs/php74-compat.neon b/tests/phpstan/configs/php74-compat.neon new file mode 100644 index 000000000..c5aaf4443 --- /dev/null +++ b/tests/phpstan/configs/php74-compat.neon @@ -0,0 +1,11 @@ +parameters: + ignoreErrors: + - + message: "#^Strict comparison using \\=\\=\\= between array\\ and false will always evaluate to false\\.$#" + count: 1 + path: ../../../src/pocketmine/utils/Timezone.php + + - + message: "#^Strict comparison using \\=\\=\\= between array and false will always evaluate to false\\.$#" + count: 1 + path: ../../../src/pocketmine/utils/Utils.php diff --git a/tests/phpstan/configs/php8.neon b/tests/phpstan/configs/php8.neon deleted file mode 100644 index 132895422..000000000 --- a/tests/phpstan/configs/php8.neon +++ /dev/null @@ -1,217 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/MemoryManager.php - - - - message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/MemoryManager.php - - - - message: "#^Parameter \\#1 \\$string of function base64_decode expects string, mixed given\\.$#" - count: 5 - path: ../../../src/pocketmine/Player.php - - - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, array\\\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/Server.php - - - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/Server.php - - - - message: "#^Parameter \\#1 \\$num of function round expects float\\|int, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/command/defaults/StatusCommand.php - - - - message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#" - count: 2 - path: ../../../src/pocketmine/command/defaults/TimingsCommand.php - - - - message: "#^Parameter \\#1 \\$stream of function fseek expects resource, resource\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/command/defaults/TimingsCommand.php - - - - message: "#^Parameter \\#1 \\$stream of function stream_get_contents expects resource, resource\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/command/defaults/TimingsCommand.php - - - - message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\\\|T of object, string given\\.$#" - count: 1 - path: ../../../src/pocketmine/event/HandlerList.php - - - - message: "#^Parameter \\#2 \\$array of function array_map expects array, array\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/lang/BaseLang.php - - - - message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/level/format/io/leveldb/LevelDB.php - - - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, array\\\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/level/format/io/region/McRegion.php - - - - message: "#^Parameter \\#1 \\$string of function str_split expects string, string\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/mcpe/VerifyLoginTask.php - - - - message: "#^Parameter \\#1 \\$socket of class pocketmine\\\\network\\\\rcon\\\\RCONInstance constructor expects resource, Socket given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCON.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_close expects Socket, resource given\\.$#" - count: 3 - path: ../../../src/pocketmine/network/rcon/RCON.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_write expects Socket, resource given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCON.php - - - - message: "#^Property pocketmine\\\\network\\\\rcon\\\\RCON\\:\\:\\$socket \\(resource\\) does not accept Socket\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCON.php - - - - message: "#^Parameter \\#1 \\$client of method pocketmine\\\\network\\\\rcon\\\\RCONInstance\\:\\:disconnectClient\\(\\) expects resource, resource\\|Socket given\\.$#" - count: 2 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$client of method pocketmine\\\\network\\\\rcon\\\\RCONInstance\\:\\:readPacket\\(\\) expects resource, resource\\|Socket given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$client of method pocketmine\\\\network\\\\rcon\\\\RCONInstance\\:\\:writePacket\\(\\) expects resource, resource\\|Socket given\\.$#" - count: 3 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$read of function socket_select expects array\\\\|null, array\\ given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_accept expects Socket, resource given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_close expects Socket, resource given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_getpeername expects Socket, resource given\\.$#" - count: 2 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_getpeername expects Socket, resource\\|Socket given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_last_error expects Socket\\|null, resource given\\.$#" - count: 2 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_read expects Socket, resource given\\.$#" - count: 4 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_set_block expects Socket, resource given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_set_option expects Socket, resource given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_shutdown expects Socket, resource given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$socket of function socket_write expects Socket, resource given\\.$#" - count: 1 - path: ../../../src/pocketmine/network/rcon/RCONInstance.php - - - - message: "#^Parameter \\#1 \\$string of function mb_strtoupper expects string, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/plugin/PluginDescription.php - - - - message: "#^Parameter \\#1 \\$data of function unserialize expects string, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/scheduler/AsyncTask.php - - - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/updater/AutoUpdater.php - - - - message: "#^Parameter \\#2 \\$timestamp of function date expects int\\|null, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/updater/AutoUpdater.php - - - - message: "#^Parameter \\#1 \\$ of callable callable\\(resource\\)\\: void expects resource, CurlHandle given\\.$#" - count: 1 - path: ../../../src/pocketmine/utils/Internet.php - - - - message: "#^Parameter \\#2 \\$offset of function substr expects int, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/utils/Internet.php - - - - message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/utils/Internet.php - - - - message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#" - count: 1 - path: ../../../src/pocketmine/utils/Timezone.php - - - - message: "#^Strict comparison using \\=\\=\\= between array\\ and false will always evaluate to false\\.$#" - count: 1 - path: ../../../src/pocketmine/utils/Timezone.php - - - - message: "#^Parameter \\#2 \\$array of function array_map expects array, mixed given\\.$#" - count: 1 - path: ../../../src/pocketmine/utils/Utils.php - - - - message: "#^Strict comparison using \\=\\=\\= between array and false will always evaluate to false\\.$#" - count: 1 - path: ../../../src/pocketmine/utils/Utils.php - diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index df2ff10e7..2fc5c83fe 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -20,6 +20,11 @@ parameters: count: 1 path: ../../../src/pocketmine/network/mcpe/protocol/DataPacket.php + - + message: "#^Parameter \\#1 \\$read of function socket_select expects array\\\\|null, array\\ given\\.$#" + count: 1 + path: ../../../src/pocketmine/network/rcon/RCONInstance.php + - message: "#^Parameter \\#1 \\$ of closure expects TMemberType, TMemberType given\\.$#" count: 1