Skip to content

Commit

Permalink
Conform to PSR-12
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Oct 4, 2019
1 parent 35848f0 commit f7b4a90
Show file tree
Hide file tree
Showing 46 changed files with 150 additions and 103 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ DEPRECATED:

FIXED:

## 6.2.2 - 2019-10-04

CHANGED:

- Improved PSR-12 conformance
- Added more property type declarations

## 6.2.1 - 2019-08-21

CHANGED:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"phpstan/phpstan-phpunit": "^0.11.0",
"phpstan/phpstan-strict-rules": "^0.11.0",
"phpunit/phpunit": "^8.3.4",
"squizlabs/php_codesniffer": "^3.4.2",
"woohoolabs/coding-standard": "^2.0.1",
"woohoolabs/releaser": "^1.1.0",
"squizlabs/php_codesniffer": "^3.5.0",
"woohoolabs/coding-standard": "^2.1.1",
"woohoolabs/releaser": "^1.2.0",
"zendframework/zend-diactoros": "^2.0.0",
"zendframework/zend-httphandlerrunner": "^1.0.0"
},
Expand Down
177 changes: 87 additions & 90 deletions composer.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/Controller/GetBookAction.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Examples\Controller;
Expand Down
1 change: 1 addition & 0 deletions examples/Controller/UserController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Examples\Controller;
Expand Down
1 change: 1 addition & 0 deletions examples/Middleware/ExceptionHandlerMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Examples\Middleware;
Expand Down
1 change: 1 addition & 0 deletions examples/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

require_once "../vendor/autoload.php";
Expand Down
1 change: 1 addition & 0 deletions src/Condition/ConditionInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Condition;
Expand Down
2 changes: 2 additions & 0 deletions src/Condition/ExactPathCondition.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Condition;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

use function in_array;

class ExactPathCondition implements ConditionInterface
Expand Down
2 changes: 2 additions & 0 deletions src/Condition/HttpMethodCondition.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Condition;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

use function in_array;

class HttpMethodCondition implements ConditionInterface
Expand Down
2 changes: 2 additions & 0 deletions src/Condition/PathPrefixCondition.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Condition;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

use function strpos;

class PathPrefixCondition implements ConditionInterface
Expand Down
2 changes: 2 additions & 0 deletions src/Container/BasicContainer.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Container;

use Psr\Container\ContainerInterface;
use Throwable;

use function class_exists;

class BasicContainer implements ContainerInterface
Expand Down
1 change: 1 addition & 0 deletions src/Container/BasicContainerException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Container;
Expand Down
1 change: 1 addition & 0 deletions src/Container/BasicContainerNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Container;
Expand Down
1 change: 1 addition & 0 deletions src/Exception/DispatcherException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Exception;
Expand Down
1 change: 1 addition & 0 deletions src/Exception/FastRouteException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Exception;
Expand Down
1 change: 1 addition & 0 deletions src/Exception/MethodNotAllowed.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Exception;
Expand Down
1 change: 1 addition & 0 deletions src/Exception/RouteNotFound.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Exception;
Expand Down
5 changes: 2 additions & 3 deletions src/Harmony.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony;
Expand All @@ -8,16 +9,14 @@
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use WoohooLabs\Harmony\Condition\ConditionInterface;

use function array_key_exists;

class Harmony implements RequestHandlerInterface
{
protected ServerRequestInterface $request;

protected ResponseInterface $response;

protected array $middleware = [];

protected int $currentMiddleware = -1;

public function __construct(ServerRequestInterface $request, ResponseInterface $response)
Expand Down
6 changes: 3 additions & 3 deletions src/Middleware/DispatcherMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Middleware;
Expand All @@ -10,15 +11,14 @@
use Psr\Http\Server\RequestHandlerInterface;
use WoohooLabs\Harmony\Container\BasicContainer;
use WoohooLabs\Harmony\Exception\DispatcherException;

use function is_array;
use function is_callable;
use function is_string;

class DispatcherMiddleware implements MiddlewareInterface
{
/** @var ContainerInterface */
protected $container;

protected ContainerInterface $container;
protected string $actionAttributeName;

public function __construct(?ContainerInterface $container = null, string $actionAttributeName = "__action")
Expand Down
5 changes: 2 additions & 3 deletions src/Middleware/FastRouteMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Middleware;
Expand All @@ -14,9 +15,7 @@

class FastRouteMiddleware implements MiddlewareInterface
{
/** @var Dispatcher|null */
protected $fastRoute;

protected ?Dispatcher $fastRoute;
protected string $actionAttributeName;

public function __construct(?Dispatcher $fastRoute = null, string $actionAttributeName = "__action")
Expand Down
3 changes: 2 additions & 1 deletion src/Middleware/HttpHandlerRunnerMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Middleware;
Expand All @@ -9,12 +10,12 @@
use Psr\Http\Server\RequestHandlerInterface;
use Zend\HttpHandlerRunner\Emitter\EmitterInterface;
use Zend\HttpHandlerRunner\Emitter\SapiEmitter;

use function headers_sent;

class HttpHandlerRunnerMiddleware implements MiddlewareInterface
{
protected EmitterInterface $emitter;

protected bool $checkOutputStart;

public function __construct(?EmitterInterface $emitter = null, bool $checkOutputStart = false)
Expand Down
1 change: 1 addition & 0 deletions tests/Condition/ExactPathConditionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Condition;
Expand Down
1 change: 1 addition & 0 deletions tests/Condition/HttpMethodConditionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Condition;
Expand Down
1 change: 1 addition & 0 deletions tests/Condition/PathPrefixConditionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Condition;
Expand Down
1 change: 1 addition & 0 deletions tests/Container/BasicContainerTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Container;
Expand Down
1 change: 1 addition & 0 deletions tests/HarmonyTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests;
Expand Down
1 change: 1 addition & 0 deletions tests/Middleware/DispatcherMiddlewareTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Middleware;
Expand Down
1 change: 1 addition & 0 deletions tests/Middleware/FastRouteMiddlewareTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Middleware;
Expand Down
1 change: 1 addition & 0 deletions tests/Middleware/HttpHandlerRunnerMiddlewareTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Middleware;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Condition/StubCondition.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Condition;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Container/DummyContainer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Container;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Controller/DummyController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Controller;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Controller/ExceptionController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Controller;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Controller/InvokableExceptionController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Controller;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Emitter/DummyHttpHandlerRunnerEmitter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Emitter;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Exception/TestException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Exception;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/FastRoute/StubDispatcher.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\FastRoute;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Middleware/ExceptionMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Middleware;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Middleware/FakeMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Middleware;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Middleware/HeaderMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Middleware;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Middleware/InternalServerErrorMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Middleware;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Middleware/SpyMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Middleware;
Expand Down
2 changes: 2 additions & 0 deletions tests/Utils/Psr7/DummyResponse.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Psr7;
Expand All @@ -7,6 +8,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Zend\Diactoros\Stream;

use function is_array;

class DummyResponse implements ResponseInterface
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Psr7/DummyServerRequest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Psr7;
Expand Down
1 change: 1 addition & 0 deletions tests/Utils/Psr7/DummyUri.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Harmony\Tests\Utils\Psr7;
Expand Down

0 comments on commit f7b4a90

Please sign in to comment.