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:
parent
b8b1106d79
commit
21d383d6c6
@ -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 {
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user