From f3cc4a28e1c74627f56fef20efa67bc17fdd321f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 12 Nov 2024 22:12:54 +0000 Subject: [PATCH] Easy wins for PHPStan 2.0 support --- phpstan.neon.dist | 2 -- src/block/Block.php | 2 ++ src/data/runtime/RuntimeDataDescriber.php | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index b96e4348d..6e8578652 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -48,8 +48,6 @@ parameters: - tests/phpstan/stubs/leveldb.stub - tests/phpstan/stubs/pmmpthread.stub reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings - staticReflectionClassNamePatterns: - - "#^COM$#" typeAliases: #variadics don't work for this - mixed probably shouldn't work either, but for now it does #what we actually need is something that accepts an infinite number of parameters, but in the absence of that, diff --git a/src/block/Block.php b/src/block/Block.php index dbc269c63..89fe39265 100644 --- a/src/block/Block.php +++ b/src/block/Block.php @@ -362,6 +362,8 @@ class Block{ * * A replacement block may be returned. This is useful if the block type changed due to reading of world data (e.g. * data from a block entity). + * + * @phpstan-impure */ public function readStateFromWorld() : Block{ return $this; diff --git a/src/data/runtime/RuntimeDataDescriber.php b/src/data/runtime/RuntimeDataDescriber.php index 6f1d35b98..7866dabdc 100644 --- a/src/data/runtime/RuntimeDataDescriber.php +++ b/src/data/runtime/RuntimeDataDescriber.php @@ -89,6 +89,11 @@ interface RuntimeDataDescriber extends RuntimeEnumDescriber{ public function straightOnlyRailShape(int &$railShape) : void; + /** + * @phpstan-template T of \UnitEnum + * @phpstan-param T &$case + * @phpstan-param-out T &$case + */ public function enum(\UnitEnum &$case) : void; /**