mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 23:44:17 +00:00
Merge branch 'next-minor'
This commit is contained in:
commit
a9c09e4517
@ -1,11 +1,13 @@
|
||||
includes:
|
||||
- tests/phpstan/configs/debug-const-checks.neon
|
||||
- tests/phpstan/configs/gc-hacks.neon
|
||||
- tests/phpstan/configs/optional-com-dotnet.neon
|
||||
- tests/phpstan/configs/phpstan-bugs.neon
|
||||
- tests/phpstan/configs/pthreads-bugs.neon
|
||||
- tests/phpstan/configs/runtime-type-checks.neon
|
||||
|
||||
parameters:
|
||||
level: 3
|
||||
level: 4
|
||||
autoload_files:
|
||||
- tests/phpstan/bootstrap.php
|
||||
- src/PocketMine.php
|
||||
|
@ -36,7 +36,7 @@ abstract class BaseInventory implements Inventory{
|
||||
|
||||
/** @var int */
|
||||
protected $maxStackSize = Inventory::MAX_STACK;
|
||||
/** @var \SplFixedArray|Item[] */
|
||||
/** @var \SplFixedArray|(Item|null)[] */
|
||||
protected $slots;
|
||||
/** @var Player[] */
|
||||
protected $viewers = [];
|
||||
|
@ -148,10 +148,10 @@ class BanEntry{
|
||||
/**
|
||||
* @param string $date
|
||||
*
|
||||
* @return \DateTime|null
|
||||
* @return \DateTime
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
private static function parseDate(string $date) : ?\DateTime{
|
||||
private static function parseDate(string $date) : \DateTime{
|
||||
$datetime = \DateTime::createFromFormat(self::$format, $date);
|
||||
if(!($datetime instanceof \DateTime)){
|
||||
throw new \RuntimeException("Corrupted date/time: " . implode(", ", \DateTime::getLastErrors()["errors"]));
|
||||
|
@ -32,6 +32,8 @@ use pocketmine\scheduler\TaskHandler;
|
||||
use function dechex;
|
||||
|
||||
abstract class Timings{
|
||||
/** @var bool */
|
||||
private static $initialized = false;
|
||||
|
||||
/** @var TimingsHandler */
|
||||
public static $fullTickTimer;
|
||||
@ -113,9 +115,10 @@ abstract class Timings{
|
||||
public static $pluginTaskTimingMap = [];
|
||||
|
||||
public static function init() : void{
|
||||
if(self::$serverTickTimer instanceof TimingsHandler){
|
||||
if(self::$initialized){
|
||||
return;
|
||||
}
|
||||
self::$initialized = true;
|
||||
|
||||
self::$fullTickTimer = new TimingsHandler("Full Server Tick");
|
||||
self::$serverTickTimer = new TimingsHandler("** Full Server Tick", self::$fullTickTimer);
|
||||
|
@ -168,7 +168,7 @@ class TimingsHandler{
|
||||
|
||||
public function stopTiming() : void{
|
||||
if(self::$enabled){
|
||||
if(--$this->timingDepth !== 0 or $this->start === 0){
|
||||
if(--$this->timingDepth !== 0 or $this->start == 0){
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2042,7 +2042,7 @@ class World implements ChunkManager{
|
||||
* @param int $x
|
||||
* @param int $z
|
||||
*
|
||||
* @return Chunk[]
|
||||
* @return (Chunk|null)[]
|
||||
*/
|
||||
public function getAdjacentChunks(int $x, int $z) : array{
|
||||
$result = [];
|
||||
|
@ -33,7 +33,7 @@ interface WritableWorldProvider extends WorldProvider{
|
||||
* @param string $name
|
||||
* @param int $seed
|
||||
* @param string $generator
|
||||
* @param array[] $options
|
||||
* @param array $options
|
||||
*/
|
||||
public static function generate(string $path, string $name, int $seed, string $generator, array $options = []) : void;
|
||||
|
||||
|
@ -59,11 +59,9 @@ class PopulationTask extends AsyncTask{
|
||||
}
|
||||
|
||||
public function onRun() : void{
|
||||
/** @var SimpleChunkManager $manager */
|
||||
$manager = $this->worker->getFromThreadStore("generation.world{$this->worldId}.manager");
|
||||
/** @var Generator $generator */
|
||||
$generator = $this->worker->getFromThreadStore("generation.world{$this->worldId}.generator");
|
||||
if($manager === null or $generator === null){
|
||||
if(!($manager instanceof SimpleChunkManager) or !($generator instanceof Generator)){
|
||||
$this->state = false;
|
||||
return;
|
||||
}
|
||||
|
21
tests/phpstan/configs/debug-const-checks.neon
Normal file
21
tests/phpstan/configs/debug-const-checks.neon
Normal file
@ -0,0 +1,21 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^If condition is always true\\.$#"
|
||||
count: 2
|
||||
path: ../../../src/Server.php
|
||||
|
||||
-
|
||||
message: "#^Ternary operator condition is always true\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/Server.php
|
||||
|
||||
-
|
||||
message: "#^If condition is always false\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/updater/AutoUpdater.php
|
||||
|
||||
-
|
||||
message: "#^Negated boolean expression is always false\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/updater/AutoUpdater.php
|
@ -26,22 +26,50 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../src/MemoryManager.php
|
||||
|
||||
-
|
||||
message: "#^Comparison operation \"\\>\\=\" between 0 and 2 is always false\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/Liquid.php
|
||||
|
||||
-
|
||||
#adjacentSources comparison FP
|
||||
message: "#^If condition is always false\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/Liquid.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access an offset on Ds\\\\Deque&iterable\\<pocketmine\\\\block\\\\utils\\\\BannerPattern\\>\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/block/tile/Banner.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: "#^Cannot access offset int on Ds\\\\Deque&iterable\\<pocketmine\\\\item\\\\WritableBookPage\\>\\.$#"
|
||||
count: 2
|
||||
path: ../../../src/item/WritableBookBase.php
|
||||
|
||||
-
|
||||
message: "#^Array \\(array\\) does not accept key int\\.$#"
|
||||
message: "#^Instanceof between int and PharFileInfo will always evaluate to false\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/plugin/PluginDescription.php
|
||||
path: ../../../src/plugin/PharPluginLoader.php
|
||||
|
||||
-
|
||||
message: "#^Array \\(array\\) does not accept key int\\.$#"
|
||||
#ReflectionFunction::getClosureThis() should be nullable
|
||||
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/world/format/SubChunk.php
|
||||
path: ../../../src/utils/Utils.php
|
||||
|
||||
-
|
||||
#ReflectionFunction::getClosureScopeClass() should be nullable
|
||||
message: "#^Unreachable statement \\- code above always terminates\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/utils/Utils.php
|
||||
|
||||
-
|
||||
message: "#^Strict comparison using \\=\\=\\= between int\\<min, 3\\> and 4 will always evaluate to false\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/world/World.php
|
||||
|
13
tests/phpstan/configs/runtime-type-checks.neon
Normal file
13
tests/phpstan/configs/runtime-type-checks.neon
Normal file
@ -0,0 +1,13 @@
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
#::add() / ::remove() thread parameter
|
||||
message: "#^If condition is always true\\.$#"
|
||||
count: 2
|
||||
path: ../../../src/thread/ThreadManager.php
|
||||
|
||||
-
|
||||
#->sendBlocks() blocks parameter
|
||||
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
|
||||
count: 1
|
||||
path: ../../../src/world/World.php
|
@ -21,7 +21,7 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ ! -f phpstan.phar ] && echo "Downloading PHPStan..." && curl -sSLO https://github.com/phpstan/phpstan/releases/download/0.12.0/phpstan.phar
|
||||
[ ! -f phpstan.phar ] && echo "Downloading PHPStan..." && curl -sSLO https://github.com/phpstan/phpstan/releases/download/0.12.2/phpstan.phar
|
||||
"$PHP_BINARY" phpstan.phar analyze --no-progress --memory-limit=2G || exit 1
|
||||
echo "PHPStan scan succeeded"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user