Merge commit 'e38866c4ba90f8efd5630dbe674fd7ca15f586ff'

This commit is contained in:
Dylan K. Taylor 2021-10-12 23:23:27 +01:00
commit b5699679ef
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
5 changed files with 65 additions and 30 deletions

View File

@ -53,7 +53,7 @@
"webmozart/path-util": "^2.3"
},
"require-dev": {
"phpstan/phpstan": "0.12.98",
"phpstan/phpstan": "0.12.99",
"phpstan/phpstan-phpunit": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^9.2"

38
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": "77f899b35819bca38246a665fd0233f3",
"content-hash": "c7a00c5a35d43f307fdba7a588029131",
"packages": [
{
"name": "adhocore/json-comment",
@ -836,16 +836,16 @@
},
{
"name": "ramsey/collection",
"version": "1.2.1",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/ramsey/collection.git",
"reference": "eaca1dc1054ddd10cbd83c1461907bee6fb528fa"
"reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/collection/zipball/eaca1dc1054ddd10cbd83c1461907bee6fb528fa",
"reference": "eaca1dc1054ddd10cbd83c1461907bee6fb528fa",
"url": "https://api.github.com/repos/ramsey/collection/zipball/cccc74ee5e328031b15640b51056ee8d3bb66c0a",
"reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a",
"shasum": ""
},
"require": {
@ -899,7 +899,7 @@
],
"support": {
"issues": "https://github.com/ramsey/collection/issues",
"source": "https://github.com/ramsey/collection/tree/1.2.1"
"source": "https://github.com/ramsey/collection/tree/1.2.2"
},
"funding": [
{
@ -911,7 +911,7 @@
"type": "tidelift"
}
],
"time": "2021-08-06T03:41:06+00:00"
"time": "2021-10-10T03:01:02+00:00"
},
{
"name": "ramsey/uuid",
@ -1971,16 +1971,16 @@
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.5.0",
"version": "1.5.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f"
"reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f",
"reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"shasum": ""
},
"require": {
@ -2015,9 +2015,9 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.0"
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1"
},
"time": "2021-09-17T15:28:14+00:00"
"time": "2021-10-02T14:08:47+00:00"
},
{
"name": "phpspec/prophecy",
@ -2088,16 +2088,16 @@
},
{
"name": "phpstan/phpstan",
"version": "0.12.98",
"version": "0.12.99",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "3bb7cc246c057405dd5e290c3ecc62ab51d57e00"
"reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/3bb7cc246c057405dd5e290c3ecc62ab51d57e00",
"reference": "3bb7cc246c057405dd5e290c3ecc62ab51d57e00",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b4d40f1d759942f523be267a1bab6884f46ca3f7",
"reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7",
"shasum": ""
},
"require": {
@ -2128,7 +2128,7 @@
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/0.12.98"
"source": "https://github.com/phpstan/phpstan/tree/0.12.99"
},
"funding": [
{
@ -2148,7 +2148,7 @@
"type": "tidelift"
}
],
"time": "2021-09-02T12:33:01+00:00"
"time": "2021-09-12T20:09:55+00:00"
},
{
"name": "phpstan/phpstan-phpunit",

View File

@ -57,5 +57,5 @@ parameters:
#variadics don't work for this - mixed probably shouldn't work either, but for now it does
#what we actually need is something that accepts an infinite number of parameters, but in the absence of that,
#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'
anyCallable: 'callable(never, never, never, never, never, never, never, never, never, never) : mixed'
anyClosure: '\Closure(never, never, never, never, never, never, never, never, never, never) : mixed'

View File

@ -218,8 +218,8 @@ class Internet{
throw new InternetException(curl_error($ch));
}
if(!is_string($raw)) throw new AssumptionFailedError("curl_exec() should return string|false when CURLOPT_RETURNTRANSFER is set");
/** @var int $httpCode */
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if(!is_int($httpCode)) throw new AssumptionFailedError("curl_getinfo(CURLINFO_HTTP_CODE) always returns int");
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$rawHeaders = substr($raw, 0, $headerSize);
$body = substr($raw, $headerSize);

View File

@ -5,6 +5,16 @@ parameters:
count: 1
path: ../../../src/block/BaseBanner.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\block\\\\Block\\|null\\)\\: bool given\\.$#"
count: 1
path: ../../../src/block/BlockFactory.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\player\\\\Player\\)\\: bool given\\.$#"
count: 1
path: ../../../src/command/defaults/ListCommand.php
-
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 2
@ -15,36 +25,56 @@ parameters:
count: 1
path: ../../../src/crafting/CraftingManager.php
-
message: "#^Parameter \\#2 \\$callback of function usort expects callable\\(mixed, mixed\\)\\: int, array\\('pocketmine\\\\\\\\crafting\\\\\\\\CraftingManager', 'sort'\\) given\\.$#"
count: 1
path: ../../../src/crafting/CraftingManager.php
-
message: "#^Property pocketmine\\\\crafting\\\\CraftingManager\\:\\:\\$destructorCallbacks \\(pocketmine\\\\utils\\\\ObjectSet\\<Closure\\(\\)\\: void\\>\\|null\\) does not accept pocketmine\\\\utils\\\\ObjectSet\\<object\\>\\.$#"
count: 1
path: ../../../src/crafting/CraftingManager.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\entity\\\\Attribute\\)\\: bool given\\.$#"
count: 1
path: ../../../src/entity/AttributeMap.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\item\\\\Item\\)\\: bool given\\.$#"
count: 1
path: ../../../src/entity/Human.php
-
message: "#^Call to function assert\\(\\) with false and 'unknown hit type' will always evaluate to false\\.$#"
count: 1
path: ../../../src/entity/projectile/Projectile.php
-
message: "#^Parameter \\#1 \\$ of closure expects TValue, TValue given\\.$#"
count: 2
path: ../../../src/utils/Promise.php
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(string\\)\\: bool given\\.$#"
count: 1
path: ../../../src/lang/Language.php
-
message: "#^Property pocketmine\\\\utils\\\\Promise\\<TValue\\>\\:\\:\\$result \\(TValue\\|null\\) does not accept TValue\\.$#"
message: "#^Parameter \\#2 \\$callback of function usort expects callable\\(mixed, mixed\\)\\: int, Closure\\(pocketmine\\\\utils\\\\VersionString, pocketmine\\\\utils\\\\VersionString\\)\\: int given\\.$#"
count: 1
path: ../../../src/utils/Promise.php
path: ../../../src/plugin/ApiVersion.php
-
message: "#^Parameter \\#1 \\$ of closure expects TMemberType, TMemberType given\\.$#"
message: "#^Parameter \\#1 \\$closure of static method pocketmine\\\\utils\\\\Utils\\:\\:getNiceClosureName\\(\\) expects Closure\\(\\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*, \\*NEVER\\*\\)\\: mixed, Closure\\(TEvent of pocketmine\\\\event\\\\Event\\)\\: void given\\.$#"
count: 1
path: ../../../src/utils/Utils.php
path: ../../../src/plugin/PluginManager.php
-
message: "#^Strict comparison using \\=\\=\\= between string and false will always evaluate to false\\.$#"
count: 1
path: ../../../src/utils/Utils.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\entity\\\\Entity\\)\\: bool given\\.$#"
count: 2
path: ../../../src/world/World.php
-
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 2
@ -55,3 +85,8 @@ parameters:
count: 2
path: ../../../src/world/generator/noise/Noise.php
-
message: "#^Parameter \\#2 \\$callback of function array_filter expects \\(callable\\(mixed, mixed\\)\\: bool\\)\\|null, Closure\\(pocketmine\\\\world\\\\format\\\\io\\\\WorldProviderManagerEntry\\)\\: bool given\\.$#"
count: 1
path: ../../../tools/convert-world.php