mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 07:54:19 +00:00
phpstan: better hack for any-callable parameters
variadics are a bad fit for this because what we really need is to accept callable with any number of arguments. LSP requires that the provided number of arguments must be >= than the required number of arguments.
This commit is contained in:
parent
bac57c159f
commit
16fa958416
@ -42,3 +42,9 @@ parameters:
|
||||
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,
|
||||
#we'll just fill it with 10 - it's very unlikely to encounter a callable with 10 parameters anyway.
|
||||
anyCallable: 'callable(mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed) : mixed'
|
||||
anyClosure: '\Closure(mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed, mixed) : mixed'
|
||||
|
@ -117,7 +117,7 @@ class Utils{
|
||||
/**
|
||||
* Generates an unique identifier to a callable
|
||||
*
|
||||
* @phpstan-param callable(mixed...) : mixed $variable
|
||||
* @phpstan-param anyCallable $variable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@ -134,7 +134,7 @@ class Utils{
|
||||
/**
|
||||
* Returns a readable identifier for the given Closure, including file and line.
|
||||
*
|
||||
* @phpstan-param \Closure(mixed...) : mixed $closure
|
||||
* @phpstan-param anyClosure $closure
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public static function getNiceClosureName(\Closure $closure) : string{
|
||||
@ -688,8 +688,8 @@ class Utils{
|
||||
*
|
||||
* @param callable $signature Dummy callable with the required parameters and return type
|
||||
* @param callable $subject Callable to check the signature of
|
||||
* @phpstan-param callable(mixed...) : mixed $signature
|
||||
* @phpstan-param callable(mixed...) : mixed $subject
|
||||
* @phpstan-param anyCallable $signature
|
||||
* @phpstan-param anyCallable $subject
|
||||
*
|
||||
* @throws \DaveRandom\CallbackValidator\InvalidCallbackException
|
||||
* @throws \TypeError
|
||||
|
Loading…
x
Reference in New Issue
Block a user