[FEATURE] add phpmd

This commit is contained in:
Marco Stoll 2019-06-27 09:36:19 +02:00
parent 709fc817eb
commit 0fbf9a553b
6 changed files with 16 additions and 14 deletions

3
bin/phpmd.bat Normal file
View File

@ -0,0 +1,3 @@
@ECHO OFF
SET PROJECT_HOME=C:\dev\ffe\fastforward\Factories
vendor\bin\phpmd %PROJECT_HOME%\src xml cleancode,codesize,controversial,design,naming,unusedcode --strict --reportfile %PROJECT_HOME%\logs\phpmd\report.xml

View File

@ -14,9 +14,10 @@
],
"require": {
"php": ">=7.2",
"fastforward/utils": "^1.0.0"
"fastforward/utils": "^1.1.0"
},
"require-dev": {
"phpmd/phpmd" : "@stable",
"phpunit/phpunit": "^8",
"squizlabs/php_codesniffer": "^3",
"theseer/phpdox": "*"

View File

@ -90,11 +90,9 @@
</source>
<!-- PHPMessDetector -->
<!--
<source type="pmd">
<file name="pmd.xml" />
<file name="../logs/phpmd/report.xml" />
</source>
-->
<!-- PHPUnit Coverage XML -->
<!-- <source type="phpunit"> -->

View File

@ -69,12 +69,12 @@ class BaseNamespaceClassLocator extends NamespaceClassLocator
}
/**
* @param string $ns
* @param string $namespace
* @param string $classIdentifier
* @return string
*/
protected function buildFqClassName(string $ns, string $classIdentifier): string
protected function buildFqClassName(string $namespace, string $classIdentifier): string
{
return parent::buildFqClassName($ns . '\\' . $this->commonSuffix, $classIdentifier);
return parent::buildFqClassName($namespace . '\\' . $this->commonSuffix, $classIdentifier);
}
}

View File

@ -101,13 +101,13 @@ class NamespaceClassLocator implements ClassLocatorInterface
}
/**
* @param string $ns
* @param string $namespace
* @param string $classIdentifier
* @return string
*/
protected function buildFqClassName(string $ns, string $classIdentifier): string
protected function buildFqClassName(string $namespace, string $classIdentifier): string
{
return $ns . '\\' . $classIdentifier;
return $namespace . '\\' . $classIdentifier;
}
/**

View File

@ -69,16 +69,16 @@ class NamespacePrefixedClassLocator extends NamespaceClassLocator
}
/**
* @param string $ns
* @param string $namespace
* @param string $classIdentifier
* @return string
*/
protected function buildFqClassName(string $ns, string $classIdentifier): string
protected function buildFqClassName(string $namespace, string $classIdentifier): string
{
$classPath = explode('\\', ClassUtils::normalizeNamespace($classIdentifier));
$localClassName = array_pop($classPath);
$subNs = !empty($classPath) ? implode('\\', $classPath) . '\\' : '';
$subNamespace = !empty($classPath) ? implode('\\', $classPath) . '\\' : '';
return $ns . '\\' . $subNs . $this->prefix . '\\' . $localClassName;
return $namespace . '\\' . $subNamespace . $this->prefix . '\\' . $localClassName;
}
}