mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
More typehints, documentation fixes and static analysis cleanup
This commit is contained in:
@ -60,7 +60,7 @@ abstract class TextFormat{
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function tokenize($string) : array{
|
||||
public static function tokenize(string $string) : array{
|
||||
return preg_split("/(" . TextFormat::ESCAPE . "[0123456789abcdefklmnor])/", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||
}
|
||||
|
||||
@ -70,9 +70,9 @@ abstract class TextFormat{
|
||||
* @param string $string
|
||||
* @param bool $removeFormat
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
public static function clean($string, $removeFormat = true){
|
||||
public static function clean(string $string, bool $removeFormat = true) : string{
|
||||
if($removeFormat){
|
||||
return str_replace(TextFormat::ESCAPE, "", preg_replace(["/" . TextFormat::ESCAPE . "[0123456789abcdefklmnor]/", "/\x1b[\\(\\][[0-9;\\[\\(]+[Bm]/"], "", $string));
|
||||
}
|
||||
@ -386,7 +386,7 @@ abstract class TextFormat{
|
||||
/**
|
||||
* Returns a string with colorized ANSI Escape codes
|
||||
*
|
||||
* @param $string
|
||||
* @param string|array $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
Reference in New Issue
Block a user