mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
Account for reflection filename being false (in the case of classes/functions defined by builtins)
This commit is contained in:
parent
cf538d83bf
commit
2281fe4e67
@ -138,7 +138,12 @@ class Utils{
|
|||||||
//non-class function
|
//non-class function
|
||||||
return $func->getName();
|
return $func->getName();
|
||||||
}
|
}
|
||||||
return "closure@" . self::cleanPath($func->getFileName()) . "#L" . $func->getStartLine();
|
$filename = $func->getFileName();
|
||||||
|
|
||||||
|
return "closure@" . ($filename !== false ?
|
||||||
|
self::cleanPath($filename) . "#L" . $func->getStartLine() :
|
||||||
|
"internal"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,7 +154,12 @@ class Utils{
|
|||||||
public static function getNiceClassName(object $obj) : string{
|
public static function getNiceClassName(object $obj) : string{
|
||||||
$reflect = new \ReflectionClass($obj);
|
$reflect = new \ReflectionClass($obj);
|
||||||
if($reflect->isAnonymous()){
|
if($reflect->isAnonymous()){
|
||||||
return "anonymous@" . self::cleanPath($reflect->getFileName()) . "#L" . $reflect->getStartLine();
|
$filename = $reflect->getFileName();
|
||||||
|
|
||||||
|
return "anonymous@" . ($filename !== false ?
|
||||||
|
self::cleanPath($filename) . "#L" . $reflect->getStartLine() :
|
||||||
|
"internal"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $reflect->getName();
|
return $reflect->getName();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user