Merge commit 'd8d994351'

# Conflicts:
#	composer.lock
#	resources/vanilla
#	tests/phpstan/configs/l7-baseline.neon
This commit is contained in:
Dylan K. Taylor 2020-06-14 19:47:21 +01:00
commit f55a7f8b53
9 changed files with 68 additions and 41 deletions

View File

@ -50,7 +50,7 @@
"respect/validation": "^2.0"
},
"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"

26
composer.lock generated
View File

@ -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": "fb110ec33e506f610d1cb2ca9447597a",
"content-hash": "b8160d3c44bfbc1212084957a8ed3731",
"packages": [
{
"name": "adhocore/json-comment",
@ -1369,16 +1369,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": {
@ -1407,7 +1407,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",

View File

@ -154,7 +154,10 @@ class NetworkSession{
/** @var PacketBatch|null */
private $sendBuffer;
/** @var \SplQueue|CompressBatchPromise[] */
/**
* @var \SplQueue|CompressBatchPromise[]
* @phpstan-var \SplQueue<CompressBatchPromise>
*/
private $compressedQueue;
/** @var Compressor */
private $compressor;

View File

@ -49,7 +49,10 @@ class AsyncPool{
/** @var int */
private $workerMemoryLimit;
/** @var \SplQueue[]|AsyncTask[][] */
/**
* @var \SplQueue[]|AsyncTask[][]
* @phpstan-var array<int, \SplQueue<AsyncTask>>
*/
private $taskQueues = [];
/**

View File

@ -36,7 +36,10 @@ class TaskScheduler{
/** @var bool */
private $enabled = true;
/** @var ReversePriorityQueue<TaskHandler> */
/**
* @var ReversePriorityQueue
* @phpstan-var ReversePriorityQueue<int, TaskHandler>
*/
protected $queue;
/** @var TaskHandler[] */

View File

@ -23,11 +23,18 @@ declare(strict_types=1);
namespace pocketmine\utils;
/**
* @phpstan-template TPriority
* @phpstan-template TValue
* @phpstan-extends \SplPriorityQueue<TPriority, TValue>
*/
class ReversePriorityQueue extends \SplPriorityQueue{
/**
* @param mixed $priority1
* @param mixed $priority2
* @phpstan-param TPriority $priority1
* @phpstan-param TPriority $priority2
*
* @return int
*/

View File

@ -197,12 +197,18 @@ class World implements ChunkManager{
/** @var Vector3[][] */
private $changedBlocks = [];
/** @var ReversePriorityQueue */
/**
* @var ReversePriorityQueue
* @phpstan-var ReversePriorityQueue<int, Vector3>
*/
private $scheduledBlockUpdateQueue;
/** @var int[] */
private $scheduledBlockUpdateQueueIndex = [];
/** @var \SplQueue */
/**
* @var \SplQueue
* @phpstan-var \SplQueue<int>
*/
private $neighbourBlockUpdateQueue;
/** @var bool[] blockhash => dummy */
private $neighbourBlockUpdateQueueIndex = [];

View File

@ -42,7 +42,10 @@ abstract class LightUpdate{
*/
protected $updateNodes = [];
/** @var \SplQueue */
/**
* @var \SplQueue
* @phpstan-var \SplQueue<array{int, int, int}>
*/
protected $spreadQueue;
/**
* @var true[]
@ -50,7 +53,10 @@ abstract class LightUpdate{
*/
protected $spreadVisited = [];
/** @var \SplQueue */
/**
* @var \SplQueue
* @phpstan-var \SplQueue<array{int, int, int, int}>
*/
protected $removalQueue;
/**
* @var true[]

View File

@ -751,34 +751,9 @@ parameters:
path: ../../../src/resourcepacks/ZippedResourcePack.php
-
message: "#^Cannot call method enqueue\\(\\) on array\\<pocketmine\\\\scheduler\\\\AsyncTask\\>\\|SplQueue\\.$#"
message: "#^Cannot call method getNextRun\\(\\) on array\\<string, int\\|pocketmine\\\\scheduler\\\\TaskHandler\\>\\|int\\|pocketmine\\\\scheduler\\\\TaskHandler\\.$#"
count: 1
path: ../../../src/scheduler/AsyncPool.php
-
message: "#^Cannot call method count\\(\\) on array\\<pocketmine\\\\scheduler\\\\AsyncTask\\>\\|SplQueue\\.$#"
count: 1
path: ../../../src/scheduler/AsyncPool.php
-
message: "#^Method pocketmine\\\\scheduler\\\\AsyncPool\\:\\:selectWorker\\(\\) should return int but returns int\\|string\\.$#"
count: 1
path: ../../../src/scheduler/AsyncPool.php
-
message: "#^Cannot call method isEmpty\\(\\) on array\\<pocketmine\\\\scheduler\\\\AsyncTask\\>\\|SplQueue\\.$#"
count: 3
path: ../../../src/scheduler/AsyncPool.php
-
message: "#^Cannot call method bottom\\(\\) on array\\<pocketmine\\\\scheduler\\\\AsyncTask\\>\\|SplQueue\\.$#"
count: 1
path: ../../../src/scheduler/AsyncPool.php
-
message: "#^Cannot call method dequeue\\(\\) on array\\<pocketmine\\\\scheduler\\\\AsyncTask\\>\\|SplQueue\\.$#"
count: 2
path: ../../../src/scheduler/AsyncPool.php
path: ../../../src/scheduler/TaskScheduler.php
-
message: "#^Parameter \\#2 \\$subject of function preg_match expects string, string\\|false given\\.$#"
@ -895,6 +870,16 @@ parameters:
count: 1
path: ../../../src/world/World.php
-
message: "#^Cannot access offset 'priority' on array\\('priority' \\=\\> int, 'data' \\=\\> pocketmine\\\\math\\\\Vector3\\)\\|int\\|pocketmine\\\\math\\\\Vector3\\.$#"
count: 1
path: ../../../src/world/World.php
-
message: "#^Cannot access offset 'data' on array\\('priority' \\=\\> int, 'data' \\=\\> pocketmine\\\\math\\\\Vector3\\)\\|int\\|pocketmine\\\\math\\\\Vector3\\.$#"
count: 1
path: ../../../src/world/World.php
-
message: "#^Parameter \\#1 \\$x of static method pocketmine\\\\world\\\\World\\:\\:blockHash\\(\\) expects int, float\\|int given\\.$#"
count: 3