Compare commits

..

2 Commits

Author SHA1 Message Date
Clemens Schwaighofer
b022662dfc Removed restrictions for printAr to only accept arrays
print_r call takes any value, changed that for all functions

array -> mixed
2023-06-01 12:00:20 +09:00
Clemens Schwaighofer
3039ebf913 Unlink files after test 2023-06-01 11:02:53 +09:00
3 changed files with 25 additions and 20 deletions

View File

@@ -24,6 +24,11 @@ final class CoreLibsLoggingLoggingTest extends TestCase
. "\[\w+\]\s{1}" // run id . "\[\w+\]\s{1}" // run id
. "{[\w\\\\]+(::\w+)?}\s{1}"; // class . "{[\w\\\\]+(::\w+)?}\s{1}"; // class
public static function tearDownAfterClass(): void
{
array_map('unlink', glob(self::LOG_FOLDER . '*.log'));
}
/** /**
* test set for options BASIC * test set for options BASIC
* *

View File

@@ -34,29 +34,29 @@ class Support
} }
/** /**
* prints a html formatted (pre) array * prints a html formatted (pre) data
* *
* @param array<mixed> $array any array * @param mixed $data any data
* @param bool $no_html default add <pre> * @param bool $no_html default add <pre>
* @return string formatted array for output with <pre> tag added * @return string formatted array for output with <pre> tag added
*/ */
public static function printAr(array $array, bool $no_html = false): string public static function printAr(mixed $data, bool $no_html = false): string
{ {
return $no_html ? return $no_html ?
print_r($array, true) : print_r($data, true) :
'<pre>' . print_r($array, true) . '</pre>'; '<pre>' . print_r($data, true) . '</pre>';
} }
/** /**
* alternate name for printAr function * alternate name for printAr function
* *
* @param array<mixed> $array any array * @param mixed $data any array
* @param bool $no_html default add <pre> * @param bool $no_html default add <pre>
* @return string formatted array for output with <pre> tag added * @return string formatted array for output with <pre> tag added
*/ */
public static function printArray(array $array, bool $no_html = false): string public static function printArray(mixed $data, bool $no_html = false): string
{ {
return self::printAr($array, $no_html); return self::printAr($data, $no_html);
} }
/** /**
@@ -65,12 +65,12 @@ class Support
* Do not use this without using it in a string in debug function * Do not use this without using it in a string in debug function
* Note: for full data debug dumps use Support::dumpVar() * Note: for full data debug dumps use Support::dumpVar()
* *
* @param array<mixed> $a Array to format * @param mixed $data Data to print
* @return string print_r formated * @return string print_r formated
*/ */
public static function prAr(array $a): string public static function prAr(mixed $data): string
{ {
return self::printAr($a, true); return self::printAr($data, true);
} }
/** /**

View File

@@ -1082,12 +1082,12 @@ class Logging
* But this does not wrap it in <pre></pre> * But this does not wrap it in <pre></pre>
* Do not use this without using it in a string in debug function * Do not use this without using it in a string in debug function
* *
* @param array<mixed> $a Array to format * @param mixed $data Data to format
* @return string print_r formated * @return string print_r formated
*/ */
public function prAr(array $a): string public function prAr(mixed $data): string
{ {
return Support::printArray($a, true); return Support::printArray($data, true);
} }
/** /**