generator: fixup issues reported by PHPStan 2.0

This commit is contained in:
Dylan K. Taylor 2025-01-07 22:07:38 +00:00
parent 28d31c97f8
commit 7b1b35ab1f
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 3 additions and 4 deletions

View File

@ -75,8 +75,7 @@ final class FlatGeneratorOptions{
$y = 0; $y = 0;
$itemParser = LegacyStringToItemParser::getInstance(); $itemParser = LegacyStringToItemParser::getInstance();
foreach($split as $line){ foreach($split as $line){
preg_match('#^(?:(\d+)[x|*])?(.+)$#', $line, $matches); if(preg_match('#^(?:(\d+)[x|*])?(.+)$#', $line, $matches) !== 1){
if(count($matches) !== 3){
throw new InvalidGeneratorOptionsException("Invalid preset layer \"$line\""); throw new InvalidGeneratorOptionsException("Invalid preset layer \"$line\"");
} }

View File

@ -126,10 +126,10 @@ class Normal extends Generator{
$hash = (int) $hash; $hash = (int) $hash;
$xNoise = $hash >> 20 & 3; $xNoise = $hash >> 20 & 3;
$zNoise = $hash >> 22 & 3; $zNoise = $hash >> 22 & 3;
if($xNoise == 3){ if($xNoise === 3){
$xNoise = 1; $xNoise = 1;
} }
if($zNoise == 3){ if($zNoise === 3){
$zNoise = 1; $zNoise = 1;
} }