File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Inpsyde/Sniffs/CodeQuality Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -107,8 +107,10 @@ private function checkPsr4(
107107
108108 list (, $ namespace ) = PhpcsHelpers::findNamespace ($ file , $ position );
109109 $ namespace = is_string ($ namespace ) ? "{$ namespace }\\" : '' ;
110+ $ namespace = rtrim ($ namespace , '\\' );
111+
112+ $ fullyQualifiedName = $ namespace . "\\{$ className }" ;
110113
111- $ fullyQualifiedName = $ namespace . $ className ;
112114 foreach ($ this ->exclude as $ excluded ) {
113115 if (strpos ($ fullyQualifiedName , $ excluded ) === 0 ) {
114116 return ;
@@ -130,6 +132,7 @@ private function checkPsr4(
130132 }
131133
132134 $ relativePath = array_pop ($ folderSplit );
135+
133136 if (basename ($ relativePath ) !== "{$ className }.php " ) {
134137 continue ;
135138 }
Original file line number Diff line number Diff line change @@ -23,6 +23,15 @@ class ThisIsWrong
2323 }
2424}
2525
26+ namespace Inpsyde \CodingStandard \Tests \fixtures \Foo {
27+
28+ // @phpcsErrorCodeOnNextLine InvalidPSR4
29+ class Psr4Fixture
30+ {
31+
32+ }
33+ }
34+
2635namespace Inpsyde \CodingStandard \Foo \Bar {
2736
2837 // @phpcsErrorCodeOnNextLine InvalidPSR4
@@ -47,4 +56,4 @@ interface Psr4Fixture
4756 {
4857
4958 }
50- }
59+ }
You can’t perform that action at this time.
0 commit comments