mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
more code style and shepherd
This commit is contained in:
parent
c2388b4d90
commit
7593b5bdc6
@ -23,6 +23,7 @@ use function glob;
|
||||
use function implode;
|
||||
use function is_array;
|
||||
use function is_dir;
|
||||
use function is_string;
|
||||
use function json_decode;
|
||||
use function ksort;
|
||||
use function max;
|
||||
|
@ -329,7 +329,16 @@ class FileFilter
|
||||
if (isset($config['referencedFunction']) && is_iterable($config['referencedFunction'])) {
|
||||
/** @var array $referenced_function */
|
||||
foreach ($config['referencedFunction'] as $referenced_function) {
|
||||
$filter->method_ids[] = strtolower((string) ($referenced_function['name'] ?? ''));
|
||||
$function_id = $referenced_function['name'] ?? '';
|
||||
if ($function_id === ''
|
||||
|| !is_string($function_id)
|
||||
|| !static::isRegularExpression($function_id)) {
|
||||
throw new ConfigException(
|
||||
'Invalid referencedFunction ' . ((string) $function_id),
|
||||
);
|
||||
}
|
||||
|
||||
$filter->method_ids[] = strtolower($function_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,6 +450,9 @@ class FileFilter
|
||||
return self::loadFromArray($config, $base_dir, $inclusive);
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-assert-if-true non-empty-string $string
|
||||
*/
|
||||
private static function isRegularExpression(string $string): bool
|
||||
{
|
||||
if ($string === '') {
|
||||
|
Loading…
Reference in New Issue
Block a user