From 0d8858f9482c5ea7e6a09f94025ef6771ae676cc Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 9 Jan 2021 17:38:22 +0000 Subject: [PATCH 1/5] composer.json: sort packages automatically --- composer.json | 3 ++- src/pocketmine/utils/Filesystem.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/pocketmine/utils/Filesystem.php diff --git a/composer.json b/composer.json index 88d17bfa0..cb0f6d18e 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,8 @@ "config": { "platform": { "php": "7.3.0" - } + }, + "sort-packages": true }, "scripts": { "make-devtools": "@php -dphar.readonly=0 tests/plugins/DevTools/src/DevTools/ConsoleScript.php --make tests/plugins/DevTools --out plugins/DevTools.phar", diff --git a/src/pocketmine/utils/Filesystem.php b/src/pocketmine/utils/Filesystem.php new file mode 100644 index 000000000..ca964f666 --- /dev/null +++ b/src/pocketmine/utils/Filesystem.php @@ -0,0 +1,28 @@ + Date: Sat, 9 Jan 2021 18:04:42 +0000 Subject: [PATCH 2/5] phpstan 0.12.65 --- composer.json | 2 +- composer.lock | 14 +++++++------- src/pocketmine/metadata/MetadataStore.php | 7 +++++-- src/pocketmine/scheduler/AsyncTask.php | 5 ++++- tests/phpstan/configs/actual-problems.neon | 5 +++++ 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index cb0f6d18e..25755413e 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "composer-runtime-api": "^2.0" }, "require-dev": { - "phpstan/phpstan": "0.12.64", + "phpstan/phpstan": "0.12.65", "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 56f6c8bd2..11f824a63 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": "f0cec87ced440a2ea2b189283e9f696c", + "content-hash": "21ef5b68eba33e23b11acde01e8a2f36", "packages": [ { "name": "adhocore/json-comment", @@ -1000,16 +1000,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.64", + "version": "0.12.65", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa" + "reference": "1c7658668b28f8d647a8b874372acf14c4352688" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa", - "reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1c7658668b28f8d647a8b874372acf14c4352688", + "reference": "1c7658668b28f8d647a8b874372acf14c4352688", "shasum": "" }, "require": { @@ -1040,7 +1040,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.64" + "source": "https://github.com/phpstan/phpstan/tree/0.12.65" }, "funding": [ { @@ -1056,7 +1056,7 @@ "type": "tidelift" } ], - "time": "2020-12-21T11:59:02+00:00" + "time": "2021-01-06T16:51:10+00:00" }, { "name": "phpstan/phpstan-phpunit", diff --git a/src/pocketmine/metadata/MetadataStore.php b/src/pocketmine/metadata/MetadataStore.php index 47e551d8c..5882ea6f4 100644 --- a/src/pocketmine/metadata/MetadataStore.php +++ b/src/pocketmine/metadata/MetadataStore.php @@ -29,7 +29,10 @@ namespace pocketmine\metadata; use pocketmine\plugin\Plugin; abstract class MetadataStore{ - /** @var \SplObjectStorage[]|MetadataValue[][] */ + /** + * @var \SplObjectStorage[]|MetadataValue[][] + * @phpstan-var array> + */ private $metadataMap; /** @@ -41,6 +44,7 @@ abstract class MetadataStore{ $owningPlugin = $newMetadataValue->getOwningPlugin(); if(!isset($this->metadataMap[$key])){ + /** @phpstan-var \SplObjectStorage $entry */ $entry = new \SplObjectStorage(); $this->metadataMap[$key] = $entry; }else{ @@ -92,7 +96,6 @@ abstract class MetadataStore{ * @return void */ public function invalidateAll(Plugin $owningPlugin){ - /** @var \SplObjectStorage|MetadataValue[] $values */ foreach($this->metadataMap as $values){ if(isset($values[$owningPlugin])){ $values[$owningPlugin]->invalidate(); diff --git a/src/pocketmine/scheduler/AsyncTask.php b/src/pocketmine/scheduler/AsyncTask.php index 21be7a736..fbb6d00db 100644 --- a/src/pocketmine/scheduler/AsyncTask.php +++ b/src/pocketmine/scheduler/AsyncTask.php @@ -51,6 +51,7 @@ use function unserialize; abstract class AsyncTask extends Collectable{ /** * @var \SplObjectStorage|null + * @phpstan-var \SplObjectStorage * Used to store objects on the main thread which should not be serialized. */ private static $threadLocalStorage; @@ -258,7 +259,9 @@ abstract class AsyncTask extends Collectable{ } if(self::$threadLocalStorage === null){ - self::$threadLocalStorage = new \SplObjectStorage(); //lazy init + /** @phpstan-var \SplObjectStorage $storage */ + $storage = new \SplObjectStorage(); + self::$threadLocalStorage = $storage; //lazy init } if(isset(self::$threadLocalStorage[$this])){ diff --git a/tests/phpstan/configs/actual-problems.neon b/tests/phpstan/configs/actual-problems.neon index 670d85c03..e6a9617ff 100644 --- a/tests/phpstan/configs/actual-problems.neon +++ b/tests/phpstan/configs/actual-problems.neon @@ -745,6 +745,11 @@ parameters: count: 1 path: ../../../src/pocketmine/level/generator/normal/Normal.php + - + message: "#^Method pocketmine\\\\metadata\\\\MetadataStore\\:\\:getMetadataInternal\\(\\) should return array\\ but returns SplObjectStorage\\\\.$#" + count: 1 + path: ../../../src/pocketmine/metadata/MetadataStore.php + - message: "#^Variable method call on pocketmine\\\\event\\\\Listener\\.$#" count: 1 From da663deea1a67a0dc45b546c81e83f1e2af35c9d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 12 Jan 2021 10:41:59 +0000 Subject: [PATCH 3/5] Bump phpstan/phpstan from 0.12.65 to 0.12.66 (#4001) --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 25755413e..c1073e0d3 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "composer-runtime-api": "^2.0" }, "require-dev": { - "phpstan/phpstan": "0.12.65", + "phpstan/phpstan": "0.12.66", "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 11f824a63..05641a5ad 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": "21ef5b68eba33e23b11acde01e8a2f36", + "content-hash": "4d776995a3d8476bf76f529ecbd568e7", "packages": [ { "name": "adhocore/json-comment", @@ -1000,16 +1000,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.65", + "version": "0.12.66", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1c7658668b28f8d647a8b874372acf14c4352688" + "reference": "4110a2425c6bd53acbdfcda07885e87b66e9ba3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1c7658668b28f8d647a8b874372acf14c4352688", - "reference": "1c7658668b28f8d647a8b874372acf14c4352688", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4110a2425c6bd53acbdfcda07885e87b66e9ba3e", + "reference": "4110a2425c6bd53acbdfcda07885e87b66e9ba3e", "shasum": "" }, "require": { @@ -1040,7 +1040,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.65" + "source": "https://github.com/phpstan/phpstan/tree/0.12.66" }, "funding": [ { @@ -1056,7 +1056,7 @@ "type": "tidelift" } ], - "time": "2021-01-06T16:51:10+00:00" + "time": "2021-01-11T16:43:15+00:00" }, { "name": "phpstan/phpstan-phpunit", From 56501178b791071f7c7bd31f89b860ec5522fedb Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 12 Jan 2021 21:41:25 +0000 Subject: [PATCH 4/5] Updated composer dependencies --- composer.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/composer.lock b/composer.lock index 05641a5ad..7d9e57d1a 100644 --- a/composer.lock +++ b/composer.lock @@ -1115,21 +1115,21 @@ }, { "name": "phpstan/phpstan-strict-rules", - "version": "0.12.7", + "version": "0.12.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "03807e3410747ec18cd5f05a6342384adcc423bf" + "reference": "ee0009302ff5312ca6b92a7330a6b66da0c70f12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/03807e3410747ec18cd5f05a6342384adcc423bf", - "reference": "03807e3410747ec18cd5f05a6342384adcc423bf", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/ee0009302ff5312ca6b92a7330a6b66da0c70f12", + "reference": "ee0009302ff5312ca6b92a7330a6b66da0c70f12", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.60" + "phpstan/phpstan": "^0.12.66" }, "require-dev": { "phing/phing": "^2.16.3", @@ -1160,9 +1160,9 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/0.12.7" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/0.12.8" }, - "time": "2020-12-13T13:27:14+00:00" + "time": "2021-01-11T13:36:23+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2551,16 +2551,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "shasum": "" }, "require": { @@ -2572,7 +2572,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -2610,7 +2610,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.0" }, "funding": [ { @@ -2626,7 +2626,7 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "theseer/tokenizer", From 97c124edf9b40bba16410e63d0ff2259af2bdad9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 12 Jan 2021 21:43:34 +0000 Subject: [PATCH 5/5] thanks git, this just sneaked in without any questions ................ --- src/pocketmine/utils/Filesystem.php | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 src/pocketmine/utils/Filesystem.php diff --git a/src/pocketmine/utils/Filesystem.php b/src/pocketmine/utils/Filesystem.php deleted file mode 100644 index ca964f666..000000000 --- a/src/pocketmine/utils/Filesystem.php +++ /dev/null @@ -1,28 +0,0 @@ -