From 8564912149443d930ca3be951b46ac81118974fd Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 11 Oct 2020 23:01:21 +0100 Subject: [PATCH] phpstan: define LEVELDB_ZLIB_RAW_COMPRESSION if it doesn't exist (for phpstan) this improves the analysis quality by informing phpstan of the type of whatever should be there. --- phpstan.neon.dist | 1 - tests/phpstan/bootstrap.php | 5 +++++ tests/phpstan/configs/custom-leveldb.neon | 12 ------------ 3 files changed, 5 insertions(+), 13 deletions(-) delete mode 100644 tests/phpstan/configs/custom-leveldb.neon diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a2f5351fb..e4c7e4ecf 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,7 +2,6 @@ includes: - tests/phpstan/configs/actual-problems.neon - tests/phpstan/configs/check-explicit-mixed-baseline.neon - tests/phpstan/configs/com-dotnet-magic.neon - - tests/phpstan/configs/custom-leveldb.neon - tests/phpstan/configs/gc-hacks.neon - tests/phpstan/configs/l7-baseline.neon - tests/phpstan/configs/l8-baseline.neon diff --git a/tests/phpstan/bootstrap.php b/tests/phpstan/bootstrap.php index b852e304f..ddbe9b703 100644 --- a/tests/phpstan/bootstrap.php +++ b/tests/phpstan/bootstrap.php @@ -23,6 +23,11 @@ declare(strict_types=1); define('pocketmine\_PHPSTAN_ANALYSIS', true); +if(!defined('LEVELDB_ZLIB_RAW_COMPRESSION')){ + //leveldb might not be loaded + define('LEVELDB_ZLIB_RAW_COMPRESSION', 4); +} + //TODO: these need to be defined properly or removed define('pocketmine\COMPOSER_AUTOLOADER_PATH', dirname(__DIR__, 2) . '/vendor/autoload.php'); define('pocketmine\DATA', ''); diff --git a/tests/phpstan/configs/custom-leveldb.neon b/tests/phpstan/configs/custom-leveldb.neon deleted file mode 100644 index 05e8a7702..000000000 --- a/tests/phpstan/configs/custom-leveldb.neon +++ /dev/null @@ -1,12 +0,0 @@ -parameters: - ignoreErrors: - #TODO: use custom stubs - - - message: "#^Used constant LEVELDB_ZLIB_RAW_COMPRESSION not found\\.$#" - count: 1 - path: ../../../src/pocketmine/level/format/io/leveldb/LevelDB.php - - - - message: "#^Constant LEVELDB_ZLIB_RAW_COMPRESSION not found\\.$#" - count: 1 - path: ../../../src/pocketmine/level/format/io/leveldb/LevelDB.php