1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

🐛 #1225 Allow use lead asterisk wildcard in referenceClass

This commit is contained in:
Andrii 2019-02-01 12:15:42 +02:00 committed by Matthew Brown
parent b8b1106d79
commit 21d383d6c6
2 changed files with 10 additions and 1 deletions

View File

@ -259,7 +259,7 @@ class FileFilter
foreach ($e->referencedClass as $referenced_class) {
$class_name = strtolower((string)$referenced_class['name']);
if (strpos($class_name, '*')) {
if (strpos($class_name, '*') !== false) {
$regex = '/' . \str_replace('*', '.*', str_replace('\\', '\\\\', $class_name)) . '/i';
$filter->fq_classlike_patterns[] = $regex;
} else {

View File

@ -372,6 +372,7 @@ class ConfigTest extends TestCase
<errorLevel type="suppress">
<referencedClass name="Psalm\Badger" />
<referencedClass name="Psalm\*Actor" />
<referencedClass name="*MagicFactory" />
</errorLevel>
</UndefinedClass>
<UndefinedMethod>
@ -437,6 +438,14 @@ class ConfigTest extends TestCase
)
);
$this->assertSame(
'suppress',
$config->getReportingLevelForClass(
'UndefinedClass',
'Psalm\MagicFactory'
)
);
$this->assertSame(
'error',
$config->getReportingLevelForClass(