Skip to content

Commit a056af1

Browse files
committed
Update composer dev dependencies
1 parent b237cac commit a056af1

File tree

9 files changed

+70
-34
lines changed

9 files changed

+70
-34
lines changed

build/generate-block-serializer-consts.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
use pocketmine\data\bedrock\block\BlockTypeNames;
3030
use pocketmine\errorhandler\ErrorToExceptionHandler;
3131
use pocketmine\nbt\NbtException;
32+
use pocketmine\nbt\tag\ByteTag;
33+
use pocketmine\nbt\tag\IntTag;
34+
use pocketmine\nbt\tag\StringTag;
3235
use pocketmine\network\mcpe\convert\BlockStateDictionary;
3336
use pocketmine\utils\AssumptionFailedError;
3437
use pocketmine\utils\Utils;
@@ -78,6 +81,9 @@ function generateBlockPaletteReport(array $states) : BlockPaletteReport{
7881
$name = $stateData->getName();
7982
$result->seenTypes[$name] = $name;
8083
foreach(Utils::stringifyKeys($stateData->getStates()) as $k => $v){
84+
if(!$v instanceof ByteTag && !$v instanceof IntTag && !$v instanceof StringTag){
85+
throw new AssumptionFailedError("Assumed all state tags should be TAG_Byte, TAG_Int or TAG_String, but found $k ($v) on block $name");
86+
}
8187
$result->seenStateValues[$k][$v->getValue()] = $v->getValue();
8288
asort($result->seenStateValues[$k]);
8389
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"symfony/filesystem": "~6.4.0"
5353
},
5454
"require-dev": {
55-
"phpstan/phpstan": "2.1.17",
55+
"phpstan/phpstan": "2.1.25",
5656
"phpstan/phpstan-phpunit": "^2.0.0",
5757
"phpstan/phpstan-strict-rules": "^2.0.0",
5858
"phpunit/phpunit": "^10.5.24"

composer.lock

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/data/bedrock/block/upgrade/BlockStateUpgrader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ private function applyPropertyValueChanged(BlockStateUpgradeSchema $schema, stri
278278
private function applyPropertyFlattened(BlockStateUpgradeSchemaFlattenInfo $flattenInfo, string $oldName, array $states) : array{
279279
$flattenedValue = $states[$flattenInfo->flattenedProperty] ?? null;
280280
$expectedType = $flattenInfo->flattenedPropertyType;
281+
if($expectedType === null){
282+
//TODO: we can't make this non-nullable in a patch release
283+
throw new AssumptionFailedError("We never give this null");
284+
}
281285
if(!$flattenedValue instanceof $expectedType){
282286
//flattened property is not of the expected type, so this transformation is not applicable
283287
return [$oldName, $states];

tests/phpstan/configs/actual-problems.neon

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,12 @@ parameters:
948948
count: 1
949949
path: ../../../src/plugin/PluginDescription.php
950950

951+
-
952+
message: '#^Property pocketmine\\plugin\\PluginDescription\:\:\$srcNamespacePrefix \(string\) does not accept mixed\.$#'
953+
identifier: assign.propertyType
954+
count: 1
955+
path: ../../../src/plugin/PluginDescription.php
956+
951957
-
952958
message: '#^Cannot call method addChild\(\) on pocketmine\\permission\\Permission\|null\.$#'
953959
identifier: method.nonObject
@@ -990,6 +996,12 @@ parameters:
990996
count: 1
991997
path: ../../../src/scheduler/TaskScheduler.php
992998

999+
-
1000+
message: '#^Possibly invalid array key type mixed\.$#'
1001+
identifier: offsetAccess.invalidOffset
1002+
count: 1
1003+
path: ../../../src/thread/ThreadManager.php
1004+
9931005
-
9941006
message: '#^Cannot access offset string on mixed\.$#'
9951007
identifier: offsetAccess.nonOffsetAccessible

tests/phpstan/configs/phpstan-bugs.neon

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,6 @@ parameters:
192192
count: 1
193193
path: ../../../src/network/mcpe/cache/CraftingDataCache.php
194194

195-
-
196-
message: '#^Method pocketmine\\network\\mcpe\\compression\\ZlibCompressor\:\:getNetworkId\(\) never returns 1 so it can be removed from the return type\.$#'
197-
identifier: return.unusedType
198-
count: 1
199-
path: ../../../src/network/mcpe/compression/ZlibCompressor.php
200-
201-
-
202-
message: '#^Method pocketmine\\network\\mcpe\\compression\\ZlibCompressor\:\:getNetworkId\(\) never returns 255 so it can be removed from the return type\.$#'
203-
identifier: return.unusedType
204-
count: 1
205-
path: ../../../src/network/mcpe/compression/ZlibCompressor.php
206-
207195
-
208196
message: '#^Parameter \#1 \$states of class pocketmine\\network\\mcpe\\convert\\BlockStateDictionary constructor expects list\<pocketmine\\network\\mcpe\\convert\\BlockStateDictionaryEntry\>, array\<int\<0, max\>, pocketmine\\network\\mcpe\\convert\\BlockStateDictionaryEntry\> given\.$#'
209197
identifier: argument.type

tests/phpstan/configs/spl-fixed-array-sucks.neon

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,26 @@ parameters:
3030
count: 4
3131
path: ../../../src/world/generator/noise/Noise.php
3232

33+
-
34+
message: '#^Parameter \$q00 of static method pocketmine\\world\\generator\\noise\\Noise\:\:bilinearLerp\(\) expects float, float\|null given\.$#'
35+
identifier: argument.type
36+
count: 1
37+
path: ../../../src/world/generator/noise/Noise.php
38+
39+
-
40+
message: '#^Parameter \$q01 of static method pocketmine\\world\\generator\\noise\\Noise\:\:bilinearLerp\(\) expects float, float\|null given\.$#'
41+
identifier: argument.type
42+
count: 1
43+
path: ../../../src/world/generator/noise/Noise.php
44+
45+
-
46+
message: '#^Parameter \$q10 of static method pocketmine\\world\\generator\\noise\\Noise\:\:bilinearLerp\(\) expects float, float\|null given\.$#'
47+
identifier: argument.type
48+
count: 1
49+
path: ../../../src/world/generator/noise/Noise.php
50+
51+
-
52+
message: '#^Parameter \$q11 of static method pocketmine\\world\\generator\\noise\\Noise\:\:bilinearLerp\(\) expects float, float\|null given\.$#'
53+
identifier: argument.type
54+
count: 1
55+
path: ../../../src/world/generator/noise/Noise.php

tests/phpunit/utils/CloningRegistryTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testEachMemberClone(\Closure $provider) : void{
4747
public function testGetAllClone() : void{
4848
$list1 = TestCloningRegistry::getAll();
4949
$list2 = TestCloningRegistry::getAll();
50-
foreach(Utils::promoteKeys($list1) as $k => $member){
50+
foreach(Utils::stringifyKeys($list1) as $k => $member){
5151
self::assertNotSame($member, $list2[$k], "VanillaBlocks ought to clone its members");
5252
}
5353
}

tools/blockstate-upgrade-schema-utils.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ function processStateGroup(string $oldName, array $upgradeTable, BlockStateUpgra
354354
* @param string[] $strings
355355
*/
356356
function findCommonPrefix(array $strings) : string{
357+
if(count($strings) === 0){
358+
return "";
359+
}
357360
sort($strings, SORT_STRING);
358361

359362
$first = $strings[array_key_first($strings)];

0 commit comments

Comments
 (0)