mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 16:49:53 +00:00
Utils: don't assume that callable is only array|string implicitly
this should really support closures too, but since it's not used anywhere, I feel OK with this change.
This commit is contained in:
parent
b193d9f919
commit
42a08e7e4a
@ -111,8 +111,10 @@ class Utils{
|
|||||||
public static function getCallableIdentifier(callable $variable){
|
public static function getCallableIdentifier(callable $variable){
|
||||||
if(is_array($variable)){
|
if(is_array($variable)){
|
||||||
return sha1(strtolower(spl_object_hash($variable[0])) . "::" . strtolower($variable[1]));
|
return sha1(strtolower(spl_object_hash($variable[0])) . "::" . strtolower($variable[1]));
|
||||||
}else{
|
}elseif(is_string($variable)){
|
||||||
return sha1(strtolower($variable));
|
return sha1(strtolower($variable));
|
||||||
|
}else{
|
||||||
|
throw new AssumptionFailedError("Unhandled callable type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user