From d8d994351be481f1a043938f763dda0755d054cb Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 14 Jun 2020 16:25:55 +0100 Subject: [PATCH] phpstan 0.12.29 --- composer.json | 2 +- composer.lock | 87 +++++++++++++++++-- src/pocketmine/level/Level.php | 10 ++- src/pocketmine/level/light/LightUpdate.php | 10 ++- src/pocketmine/scheduler/TaskScheduler.php | 5 +- src/pocketmine/utils/ReversePriorityQueue.php | 7 ++ tests/phpstan/configs/l7-baseline.neon | 15 ++++ 7 files changed, 123 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 7f007b343..12f3eabf5 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "ocramius/package-versions": "^1.5" }, "require-dev": { - "phpstan/phpstan": "^0.12.25", + "phpstan/phpstan": "^0.12.29", "phpstan/phpstan-phpunit": "^0.12.6", "phpstan/phpstan-strict-rules": "^0.12.2", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index b9557608d..fd2da4dab 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": "4a4625f83ffdea9395cfa97c4750c90d", + "content-hash": "6e9727056a0fe492ddf126b84fa57188", "packages": [ { "name": "adhocore/json-comment", @@ -892,16 +892,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.25", + "version": "0.12.29", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64" + "reference": "9771daaf6b95c6313b908d0bcdee0afcd51f838a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9619551d68b2d4c0d681a8df73f3c847c798ee64", - "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9771daaf6b95c6313b908d0bcdee0afcd51f838a", + "reference": "9771daaf6b95c6313b908d0bcdee0afcd51f838a", "shasum": "" }, "require": { @@ -930,7 +930,21 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2020-05-10T20:36:16+00:00" + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2020-06-14T14:10:59+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -1101,6 +1115,12 @@ "testing", "xunit" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-05-23T08:02:54+00:00" }, { @@ -1151,6 +1171,12 @@ "filesystem", "iterator" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-04-18T05:02:12+00:00" }, { @@ -1299,6 +1325,12 @@ "keywords": [ "timer" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-06-07T12:05:53+00:00" }, { @@ -1348,6 +1380,12 @@ "keywords": [ "tokenizer" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-05-06T09:56:31+00:00" }, { @@ -1436,6 +1474,16 @@ "testing", "xunit" ], + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-06-07T14:14:21+00:00" }, { @@ -1482,6 +1530,12 @@ ], "description": "Collection of value objects that represent the PHP code units", "homepage": "https://github.com/sebastianbergmann/code-unit", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-04-30T05:58:10+00:00" }, { @@ -1647,6 +1701,12 @@ "unidiff", "unified diff" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-05-08T05:01:12+00:00" }, { @@ -1700,6 +1760,12 @@ "environment", "hhvm" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-04-14T13:36:52+00:00" }, { @@ -2057,6 +2123,12 @@ ], "description": "Collection of value objects that represent the types of the PHP type system", "homepage": "https://github.com/sebastianbergmann/type", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "time": "2020-06-01T12:21:09+00:00" }, { @@ -2275,5 +2347,6 @@ "ext-zip": "*", "ext-zlib": ">=1.2.11" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 485bd471c..3284717b7 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -216,12 +216,18 @@ class Level implements ChunkManager, Metadatable{ /** @var Vector3[][] */ private $changedBlocks = []; - /** @var ReversePriorityQueue */ + /** + * @var ReversePriorityQueue + * @phpstan-var ReversePriorityQueue + */ private $scheduledBlockUpdateQueue; /** @var int[] */ private $scheduledBlockUpdateQueueIndex = []; - /** @var \SplQueue */ + /** + * @var \SplQueue + * @phpstan-var \SplQueue + */ private $neighbourBlockUpdateQueue; /** @var Player[][] */ diff --git a/src/pocketmine/level/light/LightUpdate.php b/src/pocketmine/level/light/LightUpdate.php index e4fa7cf03..4e4cf5e26 100644 --- a/src/pocketmine/level/light/LightUpdate.php +++ b/src/pocketmine/level/light/LightUpdate.php @@ -40,7 +40,10 @@ abstract class LightUpdate{ */ protected $updateNodes = []; - /** @var \SplQueue */ + /** + * @var \SplQueue + * @phpstan-var \SplQueue + */ protected $spreadQueue; /** * @var true[] @@ -48,7 +51,10 @@ abstract class LightUpdate{ */ protected $spreadVisited = []; - /** @var \SplQueue */ + /** + * @var \SplQueue + * @phpstan-var \SplQueue + */ protected $removalQueue; /** * @var true[] diff --git a/src/pocketmine/scheduler/TaskScheduler.php b/src/pocketmine/scheduler/TaskScheduler.php index 31621a89c..037208a7d 100644 --- a/src/pocketmine/scheduler/TaskScheduler.php +++ b/src/pocketmine/scheduler/TaskScheduler.php @@ -36,7 +36,10 @@ class TaskScheduler{ /** @var bool */ private $enabled = true; - /** @var ReversePriorityQueue */ + /** + * @var ReversePriorityQueue + * @phpstan-var ReversePriorityQueue + */ protected $queue; /** @var TaskHandler[] */ diff --git a/src/pocketmine/utils/ReversePriorityQueue.php b/src/pocketmine/utils/ReversePriorityQueue.php index d9fa2d0e0..fc8588a13 100644 --- a/src/pocketmine/utils/ReversePriorityQueue.php +++ b/src/pocketmine/utils/ReversePriorityQueue.php @@ -23,11 +23,18 @@ declare(strict_types=1); namespace pocketmine\utils; +/** + * @phpstan-template TPriority + * @phpstan-template TValue + * @phpstan-extends \SplPriorityQueue + */ class ReversePriorityQueue extends \SplPriorityQueue{ /** * @param mixed $priority1 * @param mixed $priority2 + * @phpstan-param TPriority $priority1 + * @phpstan-param TPriority $priority2 * * @return int */ diff --git a/tests/phpstan/configs/l7-baseline.neon b/tests/phpstan/configs/l7-baseline.neon index 698dd9a4a..d4ebd2bff 100644 --- a/tests/phpstan/configs/l7-baseline.neon +++ b/tests/phpstan/configs/l7-baseline.neon @@ -590,6 +590,16 @@ parameters: count: 1 path: ../../../src/pocketmine/level/Level.php + - + message: "#^Cannot access offset 'priority' on array\\('priority' \\=\\> int, 'data' \\=\\> pocketmine\\\\math\\\\Vector3\\)\\|int\\|pocketmine\\\\math\\\\Vector3\\.$#" + count: 1 + path: ../../../src/pocketmine/level/Level.php + + - + message: "#^Cannot access offset 'data' on array\\('priority' \\=\\> int, 'data' \\=\\> pocketmine\\\\math\\\\Vector3\\)\\|int\\|pocketmine\\\\math\\\\Vector3\\.$#" + count: 1 + path: ../../../src/pocketmine/level/Level.php + - message: "#^Parameter \\#1 \\$x of static method pocketmine\\\\level\\\\Level\\:\\:blockHash\\(\\) expects int, float\\|int given\\.$#" count: 3 @@ -975,6 +985,11 @@ parameters: count: 1 path: ../../../src/pocketmine/resourcepacks/ZippedResourcePack.php + - + message: "#^Cannot call method getNextRun\\(\\) on array\\\\|int\\|pocketmine\\\\scheduler\\\\TaskHandler\\.$#" + count: 1 + path: ../../../src/pocketmine/scheduler/TaskScheduler.php + - message: "#^Parameter \\#2 \\$y of method pocketmine\\\\level\\\\Level\\:\\:getTileAt\\(\\) expects int, float\\|int given\\.$#" count: 1