mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-21 10:26:38 +00:00
finally, integrate phpstan-strict-rules
This commit is contained in:
parent
25bc95cd1e
commit
6c7dada232
@ -38,7 +38,8 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpstan/phpstan": "^0.12.8",
|
"phpstan/phpstan": "^0.12.8",
|
||||||
"irstea/phpunit-shim": "^8.5",
|
"irstea/phpunit-shim": "^8.5",
|
||||||
"phpstan/phpstan-phpunit": "^0.12.6"
|
"phpstan/phpstan-phpunit": "^0.12.6",
|
||||||
|
"phpstan/phpstan-strict-rules": "^0.12.2"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
53
composer.lock
generated
53
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "82c757af39ed282d0d329dcd3053d045",
|
"content-hash": "3bc1131c6ecd44aef9d1043f49563a6a",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adhocore/json-comment",
|
"name": "adhocore/json-comment",
|
||||||
@ -523,6 +523,57 @@
|
|||||||
],
|
],
|
||||||
"description": "PHPUnit extensions and rules for PHPStan",
|
"description": "PHPUnit extensions and rules for PHPStan",
|
||||||
"time": "2020-01-10T12:07:21+00:00"
|
"time": "2020-01-10T12:07:21+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phpstan/phpstan-strict-rules",
|
||||||
|
"version": "0.12.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
|
||||||
|
"reference": "a670a59aff7cf96f75d21b974860ada10e25b2ee"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/a670a59aff7cf96f75d21b974860ada10e25b2ee",
|
||||||
|
"reference": "a670a59aff7cf96f75d21b974860ada10e25b2ee",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "~7.1",
|
||||||
|
"phpstan/phpstan": "^0.12.6"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"consistence/coding-standard": "^3.0.1",
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
|
||||||
|
"ergebnis/composer-normalize": "^2.0.2",
|
||||||
|
"jakub-onderka/php-parallel-lint": "^1.0",
|
||||||
|
"phing/phing": "^2.16.0",
|
||||||
|
"phpstan/phpstan-phpunit": "^0.12",
|
||||||
|
"phpunit/phpunit": "^7.0",
|
||||||
|
"slevomat/coding-standard": "^4.5.2"
|
||||||
|
},
|
||||||
|
"type": "phpstan-extension",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "0.12-dev"
|
||||||
|
},
|
||||||
|
"phpstan": {
|
||||||
|
"includes": [
|
||||||
|
"rules.neon"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PHPStan\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "Extra strict and opinionated rules for PHPStan",
|
||||||
|
"time": "2020-01-20T13:08:52+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
|
@ -9,6 +9,7 @@ includes:
|
|||||||
- tests/phpstan/configs/runtime-type-checks.neon
|
- tests/phpstan/configs/runtime-type-checks.neon
|
||||||
- vendor/phpstan/phpstan-phpunit/extension.neon
|
- vendor/phpstan/phpstan-phpunit/extension.neon
|
||||||
- vendor/phpstan/phpstan-phpunit/rules.neon
|
- vendor/phpstan/phpstan-phpunit/rules.neon
|
||||||
|
- vendor/phpstan/phpstan-strict-rules/rules.neon
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
level: 6
|
level: 6
|
||||||
@ -31,11 +32,50 @@ parameters:
|
|||||||
- tests/phpstan/stubs/chunkutils.stub
|
- tests/phpstan/stubs/chunkutils.stub
|
||||||
reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings
|
reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
|
-
|
||||||
|
message: "#^Instanceof between pocketmine\\\\plugin\\\\PluginManager and pocketmine\\\\plugin\\\\PluginManager will always evaluate to true\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/CrashDump.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/Player.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Cannot instantiate interface pocketmine\\\\level\\\\format\\\\io\\\\LevelProvider\\.$#"
|
message: "#^Cannot instantiate interface pocketmine\\\\level\\\\format\\\\io\\\\LevelProvider\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: src/pocketmine/Server.php
|
path: src/pocketmine/Server.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Instanceof between pocketmine\\\\plugin\\\\PluginManager and pocketmine\\\\plugin\\\\PluginManager will always evaluate to true\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/Server.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Instanceof between pocketmine\\\\scheduler\\\\AsyncPool and pocketmine\\\\scheduler\\\\AsyncPool will always evaluate to true\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/Server.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Instanceof between pocketmine\\\\command\\\\CommandReader and pocketmine\\\\command\\\\CommandReader will always evaluate to true\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/Server.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Instanceof between pocketmine\\\\network\\\\Network and pocketmine\\\\network\\\\Network will always evaluate to true\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/Server.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^pocketmine\\\\block\\\\[A-Za-z\\d]+\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#"
|
||||||
|
path: src/pocketmine/block
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^pocketmine\\\\block\\\\Block\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\level\\\\Position\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/block/Block.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Call to an undefined method pocketmine\\\\command\\\\CommandSender\\:\\:teleport\\(\\)\\.$#"
|
message: "#^Call to an undefined method pocketmine\\\\command\\\\CommandSender\\:\\:teleport\\(\\)\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
@ -77,6 +117,31 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/pocketmine/event/entity/ProjectileLaunchEvent.php
|
path: src/pocketmine/event/entity/ProjectileLaunchEvent.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^pocketmine\\\\inventory\\\\DoubleChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/inventory/DoubleChestInventory.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^pocketmine\\\\inventory\\\\EnderChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/inventory/EnderChestInventory.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^pocketmine\\\\item\\\\GoldenAppleEnchanted\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\GoldenApple\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/item/GoldenAppleEnchanted.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^pocketmine\\\\item\\\\WrittenBook\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\WritableBook\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/item/WrittenBook.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Variable property access on \\$this\\(pocketmine\\\\level\\\\generator\\\\PopulationTask\\)\\.$#"
|
||||||
|
count: 4
|
||||||
|
path: src/pocketmine/level/generator/PopulationTask.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\hell\\\\Nether has an unused parameter \\$options\\.$#"
|
message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\hell\\\\Nether has an unused parameter \\$options\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
@ -87,6 +152,11 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: src/pocketmine/level/generator/normal/Normal.php
|
path: src/pocketmine/level/generator/normal/Normal.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Variable method call on pocketmine\\\\event\\\\Listener\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/pocketmine/plugin/MethodEventExecutor.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Constructor of class pocketmine\\\\scheduler\\\\TaskScheduler has an unused parameter \\$logger\\.$#"
|
message: "#^Constructor of class pocketmine\\\\scheduler\\\\TaskScheduler has an unused parameter \\$logger\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
parameters:
|
parameters:
|
||||||
ignoreErrors:
|
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\\.$#"
|
message: "#^Default value of the parameter \\#\\d+ \\$[A-Za-z\\d_]+ \\(\\-?\\d+\\) of method .+\\(\\) is incompatible with type float\\.$#"
|
||||||
path: ../../../src
|
path: ../../../src
|
||||||
@ -33,7 +34,30 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/pocketmine/block/Liquid.php
|
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\\.$#"
|
message: "#^Call to function assert\\(\\) with false and 'unknown hit type' will always evaluate to false\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/pocketmine/entity/projectile/Projectile.php
|
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
|
||||||
|
@ -1,11 +1,31 @@
|
|||||||
parameters:
|
parameters:
|
||||||
ignoreErrors:
|
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
|
#::add() / ::remove() thread parameter
|
||||||
message: "#^If condition is always true\\.$#"
|
message: "#^If condition is always true\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
path: ../../../src/pocketmine/ThreadManager.php
|
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
|
#::get() tags parameter
|
||||||
message: "#^If condition is always false\\.$#"
|
message: "#^If condition is always false\\.$#"
|
||||||
@ -24,8 +44,39 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/pocketmine/item/ItemFactory.php
|
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
|
#->sendBlocks() blocks parameter
|
||||||
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
|
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
path: ../../../src/pocketmine/level/Level.php
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user