mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 17:36:12 +00:00
Update to PHPStan 2.x
This commit is contained in:
@ -51,9 +51,8 @@ final class CommandStringHelper{
|
||||
foreach($matches[0] as $k => $_){
|
||||
for($i = 1; $i <= 2; ++$i){
|
||||
if($matches[$i][$k] !== ""){
|
||||
/** @var string $match */ //phpstan can't understand preg_match and friends by itself :(
|
||||
$match = $matches[$i][$k];
|
||||
$args[(int) $k] = preg_replace('/\\\\([\\\\"])/u', '$1', $match) ?? throw new AssumptionFailedError(preg_last_error_msg());
|
||||
$args[] = preg_replace('/\\\\([\\\\"])/u', '$1', $match) ?? throw new AssumptionFailedError(preg_last_error_msg());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -167,6 +167,7 @@ final class Utils{
|
||||
|
||||
/**
|
||||
* @phpstan-return \Closure(object) : object
|
||||
* @deprecated
|
||||
*/
|
||||
public static function cloneCallback() : \Closure{
|
||||
return static function(object $o){
|
||||
@ -179,15 +180,13 @@ final class Utils{
|
||||
* @phpstan-template TValue of object
|
||||
*
|
||||
* @param object[] $array
|
||||
* @phpstan-param array<TKey, TValue> $array
|
||||
* @phpstan-param array<TKey, TValue>|list<TValue> $array
|
||||
*
|
||||
* @return object[]
|
||||
* @phpstan-return array<TKey, TValue>
|
||||
* @phpstan-return ($array is list<TValue> ? list<TValue> : array<TKey, TValue>)
|
||||
*/
|
||||
public static function cloneObjectArray(array $array) : array{
|
||||
/** @phpstan-var \Closure(TValue) : TValue $callback */
|
||||
$callback = self::cloneCallback();
|
||||
return array_map($callback, $array);
|
||||
return array_map(fn(object $o) => clone $o, $array);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,6 +215,9 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-return \RegexIterator<mixed, string, \FilesystemIterator>
|
||||
*/
|
||||
private function createRegionIterator() : \RegexIterator{
|
||||
return new \RegexIterator(
|
||||
new \FilesystemIterator(
|
||||
|
@ -117,7 +117,7 @@ final class FlatGeneratorOptions{
|
||||
}
|
||||
}
|
||||
}
|
||||
$options[(string) $option] = $params;
|
||||
$options[$option] = $params;
|
||||
}
|
||||
return new self($structure, $biomeId, $options);
|
||||
}
|
||||
|
Reference in New Issue
Block a user