Skip to content

Commit 0d5ee82

Browse files
committed
Improve exclusion login in PSR4 sniff
1 parent 940cf8c commit 0d5ee82

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Inpsyde/Sniffs/CodeQuality/Psr4Sniff.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ private function checkPsr4(
107107
list(, $namespace) = PhpcsHelpers::findNamespace($file, $position);
108108

109109
$fullyQualifiedName = "{$namespace}\\{$className}";
110-
if (in_array($fullyQualifiedName, $this->exclude, true)) {
111-
return;
110+
foreach ($this->exclude as $excluded) {
111+
if (strpos($fullyQualifiedName, $excluded) === 0) {
112+
return;
113+
}
112114
}
113115

114116
$filePath = str_replace('\\', '/', $file->getFilename());

0 commit comments

Comments
 (0)