1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

bugfix: quote regular expression

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
This commit is contained in:
Maximilian Bösing 2021-09-26 16:23:38 +02:00
parent 3e1be794c4
commit a050ff2878
No known key found for this signature in database
GPG Key ID: 9A8988C93CEC81A3

View File

@ -50,6 +50,7 @@ use function get_class;
use function max;
use function min;
use function preg_match;
use function preg_quote;
use function sprintf;
use function str_replace;
use function strpos;
@ -2419,7 +2420,7 @@ class SimpleAssertionReconciler extends \Psalm\Type\Reconciler
return $existing_type;
}
$constant_regex_pattern = sprintf('#^%s$#', str_replace('*', '.*', $constant_pattern));
$constant_regex_pattern = sprintf('#^%s$#', preg_quote(str_replace('*', '.*', $constant_pattern), '#'));
$class_like_storage = $codebase->classlike_storage_provider->get($class_name);
$matched_class_constant_types = [];