File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
SlevomatCodingStandard/Sniffs/Files Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ public function __construct(
3232 */
3333 public function getTypeNameFromProjectPath ($ path )
3434 {
35+ if (pathinfo ($ path , PATHINFO_EXTENSION ) !== 'php ' ) {
36+ return null ;
37+ }
38+
3539 $ pathParts = explode (DIRECTORY_SEPARATOR , $ path );
3640 $ rootNamespace = null ;
3741 while (count ($ pathParts ) > 0 ) {
@@ -56,21 +60,13 @@ public function getTypeNameFromProjectPath($path)
5660 return null ;
5761 }
5862
59- if (pathinfo ($ pathParts [count ($ pathParts ) - 1 ], PATHINFO_EXTENSION ) !== 'php ' ) {
60- return null ;
61- }
62-
63- if (count ($ pathParts ) === 0 ) {
64- return null ;
65- }
66-
6763 array_unshift ($ pathParts , $ rootNamespace );
6864
6965 $ typeName = implode ('\\' , array_filter ($ pathParts , function ($ pathPart ) {
7066 return !isset ($ this ->skipDirs [$ pathPart ]);
7167 }));
7268
73- return pathinfo ($ typeName , PATHINFO_FILENAME );
69+ return substr ($ typeName , 0 , - strlen ( ' .php ' ) );
7470 }
7571
7672}
You can’t perform that action at this time.
0 commit comments