1
0
mirror of synced 2024-11-24 05:26:03 +03:00

phpcs & code quality fixes

This commit is contained in:
Pavel 2020-09-29 16:40:35 +03:00
parent 08d118a842
commit fbfca80dec
7 changed files with 39 additions and 20 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ phpunit.xml
.swp
/nbproject
.env
.php_cs.cache

View File

@ -42,7 +42,7 @@
"phpmd": "./vendor/bin/phpmd src text controversial,design,./phpmd.xml",
"phpcs": "./vendor/bin/phpcs -p src --runtime-set testVersion 7.3",
"phpcbf": "./vendor/bin/phpcbf -p src",
"test": "composer run-script phpmd && composer run-script phpunit"
"test": "composer run-script phpcs && composer run-script phpmd && composer run-script phpunit"
},
"prefer-stable": true,
"license": "MIT"

13
phpcs.xml.dist Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<arg name="basepath" value="."/>
<arg name="cache" value=".php_cs.cache"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<rule ref="PSR2"/>
<file>src/</file>
<file>tests/</file>
</ruleset>

View File

@ -119,9 +119,12 @@ class Stream implements StreamInterface
throw $exception;
}
trigger_error(sprintf(
trigger_error(
sprintf(
'%s::__toString exception: %s',
self::class, (string) $exception),
self::class,
(string) $exception
),
E_USER_ERROR
);
}

View File

@ -66,11 +66,11 @@ class SerializerFactory implements FactoryInterface
$container = $this->container;
return SerializerBuilder::create()
->configureHandlers(function(HandlerRegistry $registry) use ($container) {
$returnNull = function($visitor, $obj, array $type) {
->configureHandlers(function (HandlerRegistry $registry) use ($container) {
$returnNull = function ($visitor, $obj, array $type) {
return null;
};
$returnSame = function($visitor, $obj, array $type) {
$returnSame = function ($visitor, $obj, array $type) {
return $obj;
};
@ -78,7 +78,7 @@ class SerializerFactory implements FactoryInterface
GraphNavigatorInterface::DIRECTION_SERIALIZATION,
'RequestDtoInterface',
'json',
function($visitor, $obj, array $type) use ($container) {
function ($visitor, $obj, array $type) use ($container) {
/** @var SerializerInterface $serializer */
$serializer = $container->get(Constants::SERIALIZER);
@ -95,7 +95,7 @@ class SerializerFactory implements FactoryInterface
GraphNavigatorInterface::DIRECTION_SERIALIZATION,
'RequestDtoInterface',
'xml',
function($visitor, $obj, array $type) use ($container) {
function ($visitor, $obj, array $type) use ($container) {
/** @var SerializerInterface $serializer */
$serializer = $container->get(Constants::SERIALIZER);

View File

@ -136,7 +136,9 @@ abstract class BaseRequest
*
* @return void
*/
final public function setMethod(string $method): void {}
final public function setMethod(string $method): void
{
}
/**
* Should return method name for this request.