mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-21 10:54:05 +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
|
reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings
|
||||||
staticReflectionClassNamePatterns:
|
staticReflectionClassNamePatterns:
|
||||||
- "#^COM$#"
|
- "#^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
|
* Generates an unique identifier to a callable
|
||||||
*
|
*
|
||||||
* @phpstan-param callable(mixed...) : mixed $variable
|
* @phpstan-param anyCallable $variable
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -134,7 +134,7 @@ class Utils{
|
|||||||
/**
|
/**
|
||||||
* Returns a readable identifier for the given Closure, including file and line.
|
* Returns a readable identifier for the given Closure, including file and line.
|
||||||
*
|
*
|
||||||
* @phpstan-param \Closure(mixed...) : mixed $closure
|
* @phpstan-param anyClosure $closure
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getNiceClosureName(\Closure $closure) : string{
|
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 $signature Dummy callable with the required parameters and return type
|
||||||
* @param callable $subject Callable to check the signature of
|
* @param callable $subject Callable to check the signature of
|
||||||
* @phpstan-param callable(mixed...) : mixed $signature
|
* @phpstan-param anyCallable $signature
|
||||||
* @phpstan-param callable(mixed...) : mixed $subject
|
* @phpstan-param anyCallable $subject
|
||||||
*
|
*
|
||||||
* @throws \DaveRandom\CallbackValidator\InvalidCallbackException
|
* @throws \DaveRandom\CallbackValidator\InvalidCallbackException
|
||||||
* @throws \TypeError
|
* @throws \TypeError
|
||||||
|
Loading…
x
Reference in New Issue
Block a user