More typehints, documentation fixes and static analysis cleanup

This commit is contained in:
Dylan K. Taylor
2017-07-15 12:12:06 +01:00
parent 24bdf330d5
commit dbb92096e4
66 changed files with 309 additions and 219 deletions

View File

@ -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
*/