From 0727543987d365338a273d87085c873951684c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 18 Jul 2018 16:35:49 +0200 Subject: [PATCH 1/4] Removing dependencies on Mouf --- composer.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/composer.json b/composer.json index 8b1cb40..86806a4 100644 --- a/composer.json +++ b/composer.json @@ -24,14 +24,8 @@ "psr/cache": "^1.0", "cache/void-adapter": "^0.3.0", "doctrine/annotations": "^1.2", - "mouf/html.htmlelement" : "^2.0", - "mouf/utils.action.common-action" : "~1.0", "mouf/utils.common.url-interface" : "~1.0", - "mouf/html.renderer.twig-extensions": "~1.0", - "mouf/utils.common.conditioninterface": "~2.0", - "mouf/utils.cache.cache-interface": "~2.0", "zendframework/zend-diactoros": "~1.0", - "mouf/html.template.templateinterface": "^2.1", "psr/http-server-middleware": "^1.0" }, "require-dev": { From 8230ea27df4473308597eab6db6774b4ac7f9cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 18 Jul 2018 16:45:50 +0200 Subject: [PATCH 2/4] Adding composer-require-checker and missing direct dependencies --- .travis.yml | 1 + composer.json | 15 ++++++++++----- .../Splash/Routers/SplashRouter.php | 4 +--- .../Splash/Services/ControllerAnalyzer.php | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4a2c68e..63e6847 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ before_script: script: - composer cs-check - composer phpstan + - composer-require-checker - ./vendor/bin/phpunit after_script: diff --git a/composer.json b/composer.json index 86806a4..d264492 100644 --- a/composer.json +++ b/composer.json @@ -21,12 +21,16 @@ ], "require" : { "php" : ">=7.1", - "psr/cache": "^1.0", "cache/void-adapter": "^0.3.0", "doctrine/annotations": "^1.2", - "mouf/utils.common.url-interface" : "~1.0", - "zendframework/zend-diactoros": "~1.0", - "psr/http-server-middleware": "^1.0" + "mouf/utils.common.url-interface" : "^1", + "zendframework/zend-diactoros": "^1", + "psr/cache": "^1.0", + "psr/http-server-handler": "^1", + "psr/http-server-middleware": "^1", + "psr/http-message": "^1", + "psr/container": "^1", + "psr/log": "^1" }, "require-dev": { "phpunit/phpunit": "^7.0", @@ -35,7 +39,8 @@ "mnapoli/simplex": "^0.3", "cache/array-adapter": "^0.4.0", "squizlabs/php_codesniffer": "^3.1", - "phpstan/phpstan": "^0.10.1" + "phpstan/phpstan": "^0.10.1", + "maglnet/composer-require-checker": "^1.0" }, "conflict": { "zendframework/zend-stratigility": "<2.0" diff --git a/src/TheCodingMachine/Splash/Routers/SplashRouter.php b/src/TheCodingMachine/Splash/Routers/SplashRouter.php index 9541b34..7e3e27f 100644 --- a/src/TheCodingMachine/Splash/Routers/SplashRouter.php +++ b/src/TheCodingMachine/Splash/Routers/SplashRouter.php @@ -3,12 +3,11 @@ namespace TheCodingMachine\Splash\Routers; use Cache\Adapter\Void\VoidCachePool; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; use TheCodingMachine\Splash\Controllers\Http400HandlerInterface; use TheCodingMachine\Splash\Exception\BadRequestException; use TheCodingMachine\Splash\Exception\PageNotFoundException; use TheCodingMachine\Splash\Filters\FilterPipe; -use TheCodingMachine\Splash\Services\ParameterFetcher; use TheCodingMachine\Splash\Services\ParameterFetcherRegistry; use TheCodingMachine\Splash\Services\SplashRoute; use TheCodingMachine\Splash\Services\SplashRouteInterface; @@ -24,7 +23,6 @@ use TheCodingMachine\Splash\Services\SplashUtils; use Psr\Log\NullLogger; use Zend\Diactoros\Response\RedirectResponse; -use Zend\Stratigility\MiddlewarePipe; class SplashRouter implements MiddlewareInterface { diff --git a/src/TheCodingMachine/Splash/Services/ControllerAnalyzer.php b/src/TheCodingMachine/Splash/Services/ControllerAnalyzer.php index f2710d0..4890203 100644 --- a/src/TheCodingMachine/Splash/Services/ControllerAnalyzer.php +++ b/src/TheCodingMachine/Splash/Services/ControllerAnalyzer.php @@ -3,7 +3,7 @@ namespace TheCodingMachine\Splash\Services; use Doctrine\Common\Annotations\Reader; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; use TheCodingMachine\Splash\Annotations\Action; use TheCodingMachine\Splash\Annotations\URL; use TheCodingMachine\Splash\Annotations\Delete; From cd75af680cd2ad2ccdc04d4b5be7cfa94c4729b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 18 Jul 2018 16:50:41 +0200 Subject: [PATCH 3/4] Fixing doc --- doc/filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/filters.md b/doc/filters.md index 8bf8643..e87b0c4 100644 --- a/doc/filters.md +++ b/doc/filters.md @@ -58,7 +58,7 @@ To create a filter: - The filters must be a valid [Doctrine annotation](http://doctrine-orm.readthedocs.io/projects/doctrine-common/en/latest/reference/annotations.html). - The filter must implement the FilterInterface. -Note that a filter is very similar to a PSR-7 middleware, except the `__invoke` method is additionally passed a container (useful to bind the annotation to a given service). +Note that a filter is very similar to a PSR-15 middleware, except the `process` method is additionally passed a container (useful to bind the annotation to a given service). Here is the typical filter layout: From 6a23abfee9f2c0cc505e3f51b1f36a97df580914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 18 Jul 2018 16:54:21 +0200 Subject: [PATCH 4/4] Migrating UrlEntryPoint to mvc.splash-common --- .travis.yml | 2 +- src/TheCodingMachine/Splash/UrlEntryPoint.php | 74 ------------------- 2 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 src/TheCodingMachine/Splash/UrlEntryPoint.php diff --git a/.travis.yml b/.travis.yml index 63e6847..a1c6856 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ before_script: script: - composer cs-check - composer phpstan - - composer-require-checker + - ./vendor/bin/composer-require-checker - ./vendor/bin/phpunit after_script: diff --git a/src/TheCodingMachine/Splash/UrlEntryPoint.php b/src/TheCodingMachine/Splash/UrlEntryPoint.php deleted file mode 100644 index 506252b..0000000 --- a/src/TheCodingMachine/Splash/UrlEntryPoint.php +++ /dev/null @@ -1,74 +0,0 @@ - $actions The list of actions to perform when the URL is called. - */ - public function __construct($url, array $actions = array()) - { - $this->url = $url; - $this->actions = $actions; - } - - /** - * Method called when the URL is called. - */ - public function action() - { - foreach ($this->actions as $action) { - $action->run(); - } - } - - /** - * Returns the list of URLs that can be accessed, and the function/method that should be called when the URL is called. - * - * @param string $instanceName The identifier for this object in the container. - * - * @return SplashRoute[] - */ - public function getUrlsList($instanceName) - { - $route = new SplashRoute($this->url, $instanceName, 'action', null, null); - - return array($route); - } - - /* (non-PHPdoc) - * @see \Mouf\Utils\Common\UrlInterface::getUrl() - */ - public function getUrl() - { - return $this->url; - } - - /** - * Returns a unique tag representing the list of SplashRoutes returned. - * If the tag changes, the cache is flushed by Splash. - * - * Important! This must be quick to compute. - */ - public function getExpirationTag() : string - { - return $this->url; - } -}