[FEATURE] add phpcs using PSR2

This commit is contained in:
Marco Stoll 2019-06-26 11:45:44 +02:00
parent e0842f17f0
commit ca2eea08e3
17 changed files with 22 additions and 19 deletions

3
bin/phpcs.bat Normal file
View File

@ -0,0 +1,3 @@
@ECHO OFF
SET PROJECT_HOME=C:\dev\ffe\fastforward\Factories
vendor\bin\phpcs --report=xml --report-file="%PROJECT_HOME%\logs\phpcs\report.xml" --standard=PSR2 %PROJECT_HOME%\src %PROJECT_HOME%\tests -p

View File

@ -18,6 +18,7 @@
},
"require-dev": {
"phpunit/phpunit": "^8",
"squizlabs/php_codesniffer": "^3",
"theseer/phpdox": "*"
},
"repositories": [

View File

@ -85,11 +85,9 @@
</source>
<!-- PHP Code Sniffer findings -->
<!--
<source type="phpcs">
<file name="logs/phpcs.xml" />
<file name="../logs/phpcs/report.xml" />
</source>
-->
<!-- PHPMessDetector -->
<!--

View File

@ -81,4 +81,4 @@ abstract class AbstractFactory
$this->classLocator = $classLocator;
return $this;
}
}
}

View File

@ -10,7 +10,6 @@ declare(strict_types=1);
namespace FF\Factories;
/**
* Class AbstractSingletonFactory
*
@ -52,4 +51,4 @@ abstract class AbstractSingletonFactory extends AbstractFactory
$this->instanceCache = [];
return $this;
}
}
}

View File

@ -77,4 +77,4 @@ class BaseNamespaceClassLocator extends NamespaceClassLocator
{
return parent::buildFqClassName($ns . '\\' . $this->commonSuffix, $classIdentifier);
}
}
}

View File

@ -23,4 +23,4 @@ interface ClassIdentifierAwareInterface
* @return string
*/
public static function getClassIdentifier(): string;
}
}

View File

@ -26,4 +26,4 @@ interface ClassLocatorInterface
* @return string|null
*/
public function locateClass(string $classIdentifier): ?string;
}
}

View File

@ -60,7 +60,9 @@ class NamespaceClassLocator implements ClassLocatorInterface
{
foreach ($this->namespaces as $ns) {
$fqClassname = $this->buildFqClassName($ns, $classIdentifier);
if (!class_exists($fqClassname)) continue;
if (!class_exists($fqClassname)) {
continue;
}
return $fqClassname;
}
@ -115,4 +117,4 @@ class NamespaceClassLocator implements ClassLocatorInterface
{
array_walk($namespaces, [ClassUtils::class, 'normalizeNamespace']);
}
}
}

View File

@ -81,4 +81,4 @@ class NamespacePrefixedClassLocator extends NamespaceClassLocator
return $ns . '\\' . $subNs . $this->prefix . '\\' . $localClassName;
}
}
}

View File

@ -18,4 +18,4 @@ namespace FF\Factories\Exceptions;
class ClassNotFoundException extends \RuntimeException
{
}
}

View File

@ -18,4 +18,4 @@ namespace FF\Factories\Exceptions;
class InstantiationException extends \RuntimeException
{
}
}

View File

@ -133,4 +133,4 @@ namespace FF\Tests\Factories\Sub {
{
}
}
}

View File

@ -77,4 +77,4 @@ class MySingletonFactory extends AbstractSingletonFactory
class MySingletonObject
{
}
}

View File

@ -80,4 +80,4 @@ namespace FF\Tests\Factories\ClassLocators\Sub {
{
}
}
}

View File

@ -115,4 +115,4 @@ namespace FF\Tests\Factories\ClassLocators\Sub {
{
}
}
}

View File

@ -92,4 +92,4 @@ namespace FF\Tests\Factories\ClassLocators\Sub\Foo {
{
}
}
}