mirror of
https://github.com/marcostoll/FF.git
synced 2025-04-21 15:41:56 +02:00
[FEATURE] add phpmd
This commit is contained in:
parent
5844b05d64
commit
5ba3f8efe8
3
bin/phpmd.bat
Normal file
3
bin/phpmd.bat
Normal file
@ -0,0 +1,3 @@
|
||||
@ECHO OFF
|
||||
SET PROJECT_HOME=C:\dev\ffe\fastforward\FF
|
||||
vendor\bin\phpmd %PROJECT_HOME%\src xml cleancode,codesize,controversial,design,naming,unusedcode --strict --reportfile %PROJECT_HOME%\logs\phpmd\report.xml
|
@ -23,6 +23,7 @@
|
||||
"twig/twig": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpmd/phpmd" : "@stable",
|
||||
"phpunit/phpunit": "^8",
|
||||
"squizlabs/php_codesniffer": "^3",
|
||||
"theseer/phpdox": "*"
|
||||
|
@ -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"> -->
|
||||
|
@ -71,7 +71,7 @@ class Dispatcher extends AbstractService
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getFireEvents(): bool
|
||||
public function hasFireEvents(): bool
|
||||
{
|
||||
return $this->fireEvents;
|
||||
}
|
||||
@ -311,10 +311,10 @@ class Dispatcher extends AbstractService
|
||||
. 'of controller [' . get_class($controller) . ']'
|
||||
);
|
||||
}
|
||||
$methodArgs[] = $param->getDefaultValue();
|
||||
} else {
|
||||
$methodArgs[] = $args[$name];
|
||||
$args[$name] = $param->getDefaultValue();
|
||||
}
|
||||
|
||||
$methodArgs[] = $args[$name];
|
||||
}
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new ControllerInspectionException(
|
||||
|
@ -17,8 +17,8 @@ use FF\Services\AbstractService;
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - error-types : int (default: E_ALL) - error type bit mask to trigger this handler
|
||||
* - bypass-php-error-handling . bool (default: false) - whether to suppress php's built-in error handling
|
||||
* - error-types : int (default: E_ALL) - error type bit mask to trigger this handler
|
||||
* - bypass-php : bool (default: false) - whether to suppress php's built-in error handling
|
||||
*
|
||||
* @package FF\Services\Runtime
|
||||
*/
|
||||
@ -37,7 +37,7 @@ class ErrorHandler extends AbstractService implements RuntimeEventHandlerInterfa
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $bypassPhpErrorHandling = false;
|
||||
protected $bypassPhp = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@ -103,18 +103,18 @@ class ErrorHandler extends AbstractService implements RuntimeEventHandlerInterfa
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getBypassPhpErrorHandling(): bool
|
||||
public function hasBypassPhp(): bool
|
||||
{
|
||||
return $this->bypassPhpErrorHandling;
|
||||
return $this->bypassPhp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bypassPhpErrorHandling
|
||||
* @param bool $bypassPhp
|
||||
* @return $this
|
||||
*/
|
||||
public function setBypassPhpErrorHandling(bool $bypassPhpErrorHandling)
|
||||
public function setBypassPhp(bool $bypassPhp)
|
||||
{
|
||||
$this->bypassPhpErrorHandling = $bypassPhpErrorHandling;
|
||||
$this->bypassPhp = $bypassPhp;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ class ErrorHandler extends AbstractService implements RuntimeEventHandlerInterfa
|
||||
): bool {
|
||||
$this->fire('Runtime\Error', $errNo, $errMsg, $errFile, $errLine, $errContext);
|
||||
|
||||
return $this->bypassPhpErrorHandling;
|
||||
return $this->bypassPhp;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,6 +150,6 @@ class ErrorHandler extends AbstractService implements RuntimeEventHandlerInterfa
|
||||
parent::initialize($options);
|
||||
|
||||
$this->errorTypes = $this->getOption('error-types', E_ALL);
|
||||
$this->bypassPhpErrorHandling = $this->getOption('bypass-php-error-handling', false);
|
||||
$this->bypassPhp = $this->getOption('bypass-php', false);
|
||||
}
|
||||
}
|
||||
|
@ -71,15 +71,15 @@ class ExceptionHandler extends AbstractService implements RuntimeEventHandlerInt
|
||||
* To prevent potential loops any unhandled exception thrown while processing the Exception event
|
||||
* is caught and discarded.
|
||||
*
|
||||
* @param \Throwable $e
|
||||
* @param \Throwable $throwable
|
||||
* @fires Runtime\Exception
|
||||
* @see http://php.net/set_exception_handler
|
||||
*/
|
||||
public function onException(\Throwable $e)
|
||||
public function onException(\Throwable $throwable)
|
||||
{
|
||||
try {
|
||||
$this->fire('Runtime\Exception', $e);
|
||||
} catch (\Exception $e) {
|
||||
$this->fire('Runtime\Exception', $throwable);
|
||||
} catch (\Exception $exception) {
|
||||
// do not handle exceptions thrown while
|
||||
// processing the Exception event
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class ShutdownHandler extends AbstractService implements RuntimeEventHandlerInte
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getForceExit(): bool
|
||||
public function hasForceExit(): bool
|
||||
{
|
||||
return $this->forceExit;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class TwigRenderer extends AbstractService implements TemplateRendererInterface
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getFireEvents(): bool
|
||||
public function hasFireEvents(): bool
|
||||
{
|
||||
return $this->fireEvents;
|
||||
}
|
||||
|
@ -117,12 +117,12 @@ namespace FF\Tests\Services\Dispatching {
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
public function testSetGetFireEvents()
|
||||
public function testSetHasFireEvents()
|
||||
{
|
||||
$value = false;
|
||||
$same = $this->uut->setFireEvents($value);
|
||||
$this->assertSame($this->uut, $same);
|
||||
$this->assertSame($value, $this->uut->getFireEvents());
|
||||
$this->assertSame($value, $this->uut->hasFireEvents());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,11 +131,11 @@ class ErrorHandlerTest extends TestCase
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
public function testSetGetBypassPhpErrorHandling()
|
||||
public function testSetHasBypassPhp()
|
||||
{
|
||||
$same = $this->uut->setBypassPhpErrorHandling(false);
|
||||
$same = $this->uut->setBypassPhp(false);
|
||||
$this->assertSame($this->uut, $same);
|
||||
$this->assertFalse($this->uut->getBypassPhpErrorHandling());
|
||||
$this->assertFalse($this->uut->hasBypassPhp());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,11 +76,11 @@ class ShutdownHandlerTest extends TestCase
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
public function testSetGetForceExit()
|
||||
public function testSetHasForceExit()
|
||||
{
|
||||
$same = $this->uut->setForceExit(false);
|
||||
$this->assertSame($this->uut, $same);
|
||||
$this->assertFalse($this->uut->getForceExit());
|
||||
$this->assertFalse($this->uut->hasForceExit());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,12 +105,12 @@ class TwigRendererTest extends TestCase
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
public function testSetGetFireEvents()
|
||||
public function testSetHasFireEvents()
|
||||
{
|
||||
$value = false;
|
||||
$same = $this->uut->setFireEvents($value);
|
||||
$this->assertSame($this->uut, $same);
|
||||
$this->assertEquals($value, $this->uut->getFireEvents());
|
||||
$this->assertEquals($value, $this->uut->hasFireEvents());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user