From 04191ec44a00dd058f5d7e9e315d451e44285494 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 15 Jun 2020 22:47:20 +0100 Subject: [PATCH] Rail: specify type for local static variable fixes a phpstan level 7 error phpstan doesn't make any assumptions about local static variable types because analysing them would require too much work, apparently. --- src/pocketmine/block/Rail.php | 1 + tests/phpstan/configs/l7-baseline.neon | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pocketmine/block/Rail.php b/src/pocketmine/block/Rail.php index eb66d98af..52f2d328c 100644 --- a/src/pocketmine/block/Rail.php +++ b/src/pocketmine/block/Rail.php @@ -71,6 +71,7 @@ class Rail extends BaseRail{ } protected function getPossibleConnectionDirectionsOneConstraint(int $constraint) : array{ + /** @var int[] $horizontal */ static $horizontal = [ Vector3::SIDE_NORTH, Vector3::SIDE_SOUTH, diff --git a/tests/phpstan/configs/l7-baseline.neon b/tests/phpstan/configs/l7-baseline.neon index d3634af84..703cec134 100644 --- a/tests/phpstan/configs/l7-baseline.neon +++ b/tests/phpstan/configs/l7-baseline.neon @@ -275,11 +275,6 @@ parameters: count: 3 path: ../../../src/pocketmine/block/Mycelium.php - - - message: "#^Method pocketmine\\\\block\\\\Rail\\:\\:getPossibleConnectionDirectionsOneConstraint\\(\\) should return array\\ but returns array\\\\.$#" - count: 1 - path: ../../../src/pocketmine/block/Rail.php - - message: "#^Parameter \\#2 \\$x of static method pocketmine\\\\level\\\\generator\\\\object\\\\Tree\\:\\:growTree\\(\\) expects int, float\\|int given\\.$#" count: 2