File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Inpsyde/Sniffs/CodeQuality Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## not released
4+ - Fix bug in ` Psr4Sniff ` when class has not namespace.
5+
36## 0.11.0
47- Fix false positive in ` ReturnTypeDeclarationSniff ` with nullable types.
58- Relax check for missing return type when ` {aType}|null ` doc bloc is present.
Original file line number Diff line number Diff line change 2121final class Psr4Sniff implements Sniff
2222{
2323 /**
24- * @var string|null
24+ * @var array
2525 */
26- public $ psr4 = null ;
26+ public $ psr4 ;
2727
2828 /**
2929 * @var array
@@ -74,6 +74,7 @@ private function checkFilenameOnly(
7474 string $ className ,
7575 string $ entityType
7676 ) {
77+
7778 if (basename ($ file ->getFilename ()) === "{$ className }.php " ) {
7879 return ;
7980 }
@@ -105,8 +106,9 @@ private function checkPsr4(
105106 ) {
106107
107108 list (, $ namespace ) = PhpcsHelpers::findNamespace ($ file , $ position );
109+ $ namespace = is_string ($ namespace ) ? "{$ namespace }\\" : '' ;
108110
109- $ fullyQualifiedName = "{ $ namespace}\\{ $ className}" ;
111+ $ fullyQualifiedName = $ namespace . $ className ;
110112 foreach ($ this ->exclude as $ excluded ) {
111113 if (strpos ($ fullyQualifiedName , $ excluded ) === 0 ) {
112114 return ;
You can’t perform that action at this time.
0 commit comments