finally, integrate phpstan-strict-rules

This commit is contained in:
Dylan K. Taylor
2020-02-06 19:44:10 +00:00
parent 25bc95cd1e
commit 6c7dada232
5 changed files with 199 additions and 2 deletions

View File

@ -1,5 +1,6 @@
parameters:
ignoreErrors:
- "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
-
message: "#^Default value of the parameter \\#\\d+ \\$[A-Za-z\\d_]+ \\(\\-?\\d+\\) of method .+\\(\\) is incompatible with type float\\.$#"
path: ../../../src
@ -33,7 +34,30 @@ parameters:
count: 1
path: ../../../src/pocketmine/block/Liquid.php
-
#readline() may return false
message: "#^Strict comparison using \\!\\=\\= between string and false will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/command/CommandReader.php
-
#generics corruption, this might show up in other forms too
message: "#^Parameter \\#1 \\$offset \\(int\\) of method pocketmine\\\\entity\\\\AttributeMap\\:\\:offsetGet\\(\\) should be contravariant with parameter \\$offset \\(mixed\\) of method ArrayAccess\\<int,float\\>\\:\\:offsetGet\\(\\)$#"
count: 1
path: ../../../src/pocketmine/entity/AttributeMap.php
-
message: "#^Call to function assert\\(\\) with false and 'unknown hit type' will always evaluate to false\\.$#"
count: 1
path: ../../../src/pocketmine/entity/projectile/Projectile.php
-
message: "#^Call to function method_exists\\(\\) with pocketmine\\\\network\\\\mcpe\\\\CachedEncapsulatedPacket and '__toString' will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/network/mcpe/protocol/DataPacket.php
-
#phpstan doesn't understand that SplFixedArray may contain null
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotNull\\(\\) with int and string will always evaluate to true\\.$#"
count: 1
path: ../../../tests/phpunit/block/BlockTest.php

View File

@ -1,11 +1,31 @@
parameters:
ignoreErrors:
-
message: "#^Call to function is_subclass_of\\(\\) with class\\-string\\<pocketmine\\\\level\\\\generator\\\\Generator\\> and 'pocketmine\\\\\\\\level…' will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/Server.php
-
#::add() / ::remove() thread parameter
message: "#^If condition is always true\\.$#"
count: 2
path: ../../../src/pocketmine/ThreadManager.php
-
message: "#^Instanceof between pocketmine\\\\Worker and pocketmine\\\\Worker will always evaluate to true\\.$#"
count: 2
path: ../../../src/pocketmine/ThreadManager.php
-
message: "#^Instanceof between pocketmine\\\\plugin\\\\RegisteredListener and pocketmine\\\\plugin\\\\RegisteredListener will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/event/HandlerList.php
-
#jsonDeserialize(), not currently validated
message: "#^Casting to int something that's already int\\.$#"
count: 3
path: ../../../src/pocketmine/item/Item.php
-
#::get() tags parameter
message: "#^If condition is always false\\.$#"
@ -24,8 +44,39 @@ parameters:
count: 1
path: ../../../src/pocketmine/item/ItemFactory.php
-
message: "#^Call to function is_object\\(\\) with \\*NEVER\\* will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/item/ItemFactory.php
-
#->sendBlocks() blocks parameter
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
count: 2
path: ../../../src/pocketmine/level/Level.php
-
message: "#^Instanceof between pocketmine\\\\math\\\\Vector3 and pocketmine\\\\math\\\\Vector3 will always evaluate to true\\.$#"
count: 2
path: ../../../src/pocketmine/level/Level.php
-
message: "#^Call to function is_object\\(\\) with \\*NEVER\\* will always evaluate to true\\.$#"
count: 2
path: ../../../src/pocketmine/level/Level.php
-
message: "#^Call to function assert\\(\\) with bool will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/level/Level.php
-
message: "#^Call to function is_subclass_of\\(\\) with class\\-string\\<pocketmine\\\\level\\\\generator\\\\Generator\\> and 'pocketmine\\\\\\\\level…' will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/level/generator/GeneratorManager.php
-
#commands plugin.yml not currently validated, can't be sure
message: "#^Call to function is_array\\(\\) with array\\<string, mixed\\> will always evaluate to true\\.$#"
count: 1
path: ../../../src/pocketmine/plugin/PluginManager.php