phan and phpstan fixes
This commit is contained in:
@@ -135,6 +135,11 @@ final class CoreLibsConvertStringsTest extends TestCase
|
||||
public function splitFormatStringExceptionProvider(): array
|
||||
{
|
||||
return [
|
||||
'string format with no splitter match' => [
|
||||
'1234',
|
||||
'22',
|
||||
'12-34'
|
||||
],
|
||||
'invalid format string' => [
|
||||
'1234',
|
||||
'2あ2',
|
||||
|
||||
@@ -333,7 +333,7 @@ print "(kosrt, lower case, reverse): "
|
||||
print "<hr>";
|
||||
$nested = [
|
||||
'B' => 'foo', 'a', '0', 9,
|
||||
1 => ['z', 'b', 'a'],
|
||||
'1' => ['z', 'b', 'a'],
|
||||
'd' => ['zaip', 'bar', 'baz']
|
||||
];
|
||||
print "Nested: " . DgS::printAr($nested) . "<br>";
|
||||
|
||||
@@ -251,10 +251,10 @@ class ArrayHandler
|
||||
* @param array<mixed> $array
|
||||
* @param string|int|float|bool $search_value
|
||||
* @param string|array<string> $required_key
|
||||
* @param ?string $serach_key [null]
|
||||
* @param ?string $search_key [null]
|
||||
* @param string $path_separator [DATA_SEPARATOR]
|
||||
* @param string $current_path
|
||||
* @return array<array{content?:array<mixed>,path?:string,missing_key?:string}>
|
||||
* @return array<array{content?:array<mixed>,path?:string,missing_key?:array<string>}>
|
||||
*/
|
||||
public static function findArraysMissingKey(
|
||||
array $array,
|
||||
|
||||
@@ -85,7 +85,12 @@ class Strings
|
||||
);
|
||||
}
|
||||
// get the split characters that are not numerical and check they are ascii
|
||||
$split_characters = self::removeDuplicates(preg_replace('/[0-9]/', '', $split_format));
|
||||
$split_characters = self::removeDuplicates(preg_replace('/[0-9]/', '', $split_format) ?: '');
|
||||
if (empty($split_characters)) {
|
||||
throw new \InvalidArgumentException(
|
||||
"A split character must exist in the format string: " . $split_format
|
||||
);
|
||||
}
|
||||
if (preg_match('/[^\x20-\x7e]/', $split_characters)) {
|
||||
throw new \InvalidArgumentException(
|
||||
"The split character has to be a valid ascii character: " . $split_characters
|
||||
@@ -296,7 +301,7 @@ class Strings
|
||||
* check if a regex is invalid, returns array with flag and error string
|
||||
*
|
||||
* @param string $pattern
|
||||
* @return array{valid:bool,preg_error:0,error:null|string,pcre_error:null|string}
|
||||
* @return array{valid:bool,preg_error:int,error:null|string,pcre_error:null|string}
|
||||
*/
|
||||
public static function validateRegex(string $pattern): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user