diff --git a/src/utils/Config.php b/src/utils/Config.php index 7acc43391..6b8c4f2e6 100644 --- a/src/utils/Config.php +++ b/src/utils/Config.php @@ -68,7 +68,7 @@ class Config{ public const ENUM = 5; // .txt, .list, .enum public const ENUMERATION = Config::ENUM; - /** @var array */ + /** @var mixed[] */ private $config = []; /** @var mixed[] */ @@ -104,9 +104,9 @@ class Config{ ]; /** - * @param string $file Path of the file to be loaded - * @param int $type Config type to load, -1 by default (detect) - * @param array $default Array with the default values that will be written to the file if it did not exist + * @param string $file Path of the file to be loaded + * @param int $type Config type to load, -1 by default (detect) + * @param mixed[] $default Array with the default values that will be written to the file if it did not exist */ public function __construct(string $file, int $type = Config::DETECT, array $default = []){ $this->load($file, $type, $default); @@ -134,6 +134,8 @@ class Config{ } /** + * @param mixed[] $default + * * @throws \InvalidArgumentException if config type could not be auto-detected * @throws \InvalidStateException if config type is invalid */ @@ -424,6 +426,9 @@ class Config{ } } + /** + * @param mixed[] $v + */ public function setAll(array $v) : void{ $this->config = $v; $this->changed = true; @@ -451,10 +456,16 @@ class Config{ $this->changed = true; } + /** + * @return mixed[] + */ public function getAll(bool $keys = false) : array{ return ($keys ? array_keys($this->config) : $this->config); } + /** + * @param mixed[] $defaults + */ public function setDefaults(array $defaults) : void{ $this->fillDefaults($defaults, $this->config); } diff --git a/src/utils/Terminal.php b/src/utils/Terminal.php index 9f8c40d84..6b0b2509f 100644 --- a/src/utils/Terminal.php +++ b/src/utils/Terminal.php @@ -198,7 +198,7 @@ abstract class Terminal{ * Returns a string with colorized ANSI Escape codes for the current terminal * Note that this is platform-dependent and might produce different results depending on the terminal type and/or OS. * - * @param string|array $string + * @param string|string[] $string */ public static function toANSI($string) : string{ if(!is_array($string)){ diff --git a/src/utils/TextFormat.php b/src/utils/TextFormat.php index 6ecfe9c8e..d02973c9b 100644 --- a/src/utils/TextFormat.php +++ b/src/utils/TextFormat.php @@ -68,6 +68,8 @@ abstract class TextFormat{ /** * Splits the string by Format tokens + * + * @return string[] */ public static function tokenize(string $string) : array{ return preg_split("/(" . TextFormat::ESCAPE . "[0-9a-fk-or])/u", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); @@ -99,7 +101,7 @@ abstract class TextFormat{ /** * Returns an JSON-formatted string with colors/markup * - * @param string|array $string + * @param string|string[] $string */ public static function toJSON($string) : string{ if(!is_array($string)){ @@ -285,7 +287,7 @@ abstract class TextFormat{ /** * Returns an HTML-formatted string with colors/markup * - * @param string|array $string + * @param string|string[] $string */ public static function toHTML($string) : string{ if(!is_array($string)){ diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 52e08f04d..64d270467 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -353,7 +353,7 @@ class Utils{ } /** - * @return array of claims + * @return mixed[] array of claims * * @throws \UnexpectedValueException */ @@ -390,6 +390,11 @@ class Utils{ return -1; } + /** + * @param mixed[][] $trace + * + * @return string[] + */ public static function printableTrace(array $trace, int $maxStringLength = 80) : array{ $messages = []; for($i = 0; isset($trace[$i]); ++$i){ @@ -419,6 +424,9 @@ class Utils{ return $messages; } + /** + * @return mixed[][] + */ public static function currentTrace(int $skipFrames = 0) : array{ ++$skipFrames; //omit this frame from trace, in addition to other skipped frames if(function_exists("xdebug_get_function_stack")){ @@ -433,6 +441,9 @@ class Utils{ return array_values($trace); } + /** + * @return string[] + */ public static function printableCurrentTrace(int $skipFrames = 0) : array{ return self::printableTrace(self::currentTrace(++$skipFrames)); }