Skip to content

Commit

Permalink
Apply Woohoo Labs. Coding Standard
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Dec 21, 2018
1 parent 3bafdd7 commit 49f7387
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 44 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.phpcs-cache export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpcs.xml export-ignore
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor/
.phpcs-cache
composer.lock
phpunit.xml
5 changes: 5 additions & 0 deletions .prettyci.composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require-dev": {
"woohoolabs/coding-standard": "dev-master as 1.0.0"
}
}
14 changes: 0 additions & 14 deletions .styleci.yml

This file was deleted.

12 changes: 2 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ test:
docker-compose up

cs:
docker-compose run php /var/www/vendor/bin/phpcs \
--standard=/var/www/phpcs.xml \
--encoding=UTF-8 \
--report-full \
--extensions=php \
/var/www/src/ /var/www/tests/
docker-compose run --rm php /var/www/vendor/bin/phpcs --standard=/var/www/phpcs.xml

cs-fix:
docker-compose run php /var/www/vendor/bin/phpcbf \
--standard=/var/www/phpcs.xml \
--extensions=php \
/var/www/src/ /var/www/tests/
docker-compose run --rm php /var/www/vendor/bin/phpcbf --standard=/var/www/phpcs.xml
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"justinrainbow/json-schema": "^5.2.0",
"phpunit/phpunit": "^7.0.0",
"seld/jsonlint": "^1.4.0",
"squizlabs/php_codesniffer": "^3.3.0",
"squizlabs/php_codesniffer": "^3.4.0",
"woohoolabs/coding-standard": "dev-master as 1.0.0",
"zendframework/zend-diactoros": "^2.0.0"
},
"autoload": {
Expand Down
34 changes: 16 additions & 18 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
<?xml version="1.0"?>
<ruleset name="Woohoo Labs. Coding Standard">
<description>Woohoo Labs. Coding Standard</description>
<ruleset name="Yin-Middleware" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>PHP Coding Standards for Yin-Middleware</description>

<!-- Options -->
<arg value="p"/>
<arg name="colors"/>
<arg name="basepath" value="."/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors" />
<arg name="encoding" value="UTF-8"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="report" value="code"/>
<arg name="report-width" value="160"/>

<!-- Rules -->
<rule ref="PSR12"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="150"/>
<property name="absoluteLineLimit" value="160"/>
</properties>
</rule>
<!-- Show progress of the run -->
<arg value="nps"/>

<!-- Paths -->
<file>examples</file>
<file>src</file>
<file>tests</file>
<file>src/</file>
<file>tests/</file>

<rule ref="WoohooLabs"/>
</ruleset>
3 changes: 3 additions & 0 deletions src/Middleware/JsonApiDispatcherMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use WoohooLabs\Yin\JsonApi\Serializer\JsonSerializer;
use WoohooLabs\Yin\JsonApi\Serializer\SerializerInterface;
use WoohooLabs\YinMiddleware\Exception\JsonApiRequestException;
use function is_array;
use function is_callable;
use function is_string;

class JsonApiDispatcherMiddleware implements MiddlewareInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/JsonApiResponseValidatorMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class JsonApiResponseValidatorMiddleware extends JsonApiMessageValidator impleme

public function __construct(
?ExceptionFactoryInterface $exceptionFactory = null,
SerializerInterface $serializer = null,
?SerializerInterface $serializer = null,
bool $includeOriginalMessageInResponse = true,
bool $lintBody = true,
bool $validateBody = true
Expand Down
1 change: 1 addition & 0 deletions tests/Middleware/JsonApiErrorHandlerMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use WoohooLabs\YinMiddleware\Tests\Utils\DummyException;
use Zend\Diactoros\Response;
use Zend\Diactoros\ServerRequest;
use function json_decode;

class JsonApiErrorHandlerMiddlewareTest extends TestCase
{
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/DummyException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace WoohooLabs\YinMiddleware\Tests\Utils;

Expand Down
1 change: 1 addition & 0 deletions tests/Utils/FakeController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace WoohooLabs\YinMiddleware\Tests\Utils;

Expand Down

0 comments on commit 49f7387

Please sign in to comment.