diff --git a/.gitignore b/.gitignore index 7f82cee..7c5ecae 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,8 @@ composer.phar # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file # composer.lock /composer.lock + +# Maintenance +phpcs.xml +phpunit.xml +psalm.xml diff --git a/composer.json b/composer.json index 139b5ad..1c8e75a 100644 --- a/composer.json +++ b/composer.json @@ -10,15 +10,16 @@ ], "require": { "php": "~8.1.0 || ~8.2.0 || ~8.3.0", - "symfony/config": "*", - "symfony/routing": "*", - "symfony/http-foundation": "*", - "laminas/laminas-router": "*" + "symfony/config": "^6.4 || ^7.0", + "symfony/routing": "^6.4 || ^7.0", + "symfony/http-foundation": "^6.4 || ^7.0", + "laminas/laminas-router": "^3.0" }, "require-dev": { "laminas/laminas-coding-standard": "~2.5.0", - "laminas/laminas-test": "*", - "symfony/expression-language": "*" + "laminas/laminas-test": "^4.0", + "symfony/expression-language": "^6.4 || ^7.0", + "vimeo/psalm": "^5.18" }, "suggest": { "symfony/expression-language": "to use symfony conditonal routes" @@ -46,6 +47,7 @@ "cs-check": "phpcs", "cs-fix": "phpcbf", "static-analysis": "psalm --shepherd --stats", + "static-analysis-all": "psalm --show-info=true", "test": "phpunit --colors=always" } } diff --git a/config/test/application.global.php b/config/test/application.global.php index 5672315..483b5ec 100644 --- a/config/test/application.global.php +++ b/config/test/application.global.php @@ -6,7 +6,7 @@ // Retrieve list of modules used in this application. 'modules' => [ 'Laminas\Router', - 'Laminas\Router\Attributes', + Laminas\Router\Attributes\Module::class, ], // These are various options for the listeners attached to the ModuleManager diff --git a/psalm.xml.dist b/psalm.xml.dist new file mode 100644 index 0000000..849eb27 --- /dev/null +++ b/psalm.xml.dist @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Listener/RoutingAttributesListener.php b/src/Listener/RoutingAttributesListener.php index 61e7f6c..a756c08 100644 --- a/src/Listener/RoutingAttributesListener.php +++ b/src/Listener/RoutingAttributesListener.php @@ -7,7 +7,7 @@ use Laminas\EventManager\EventManagerInterface; use Laminas\EventManager\ListenerAggregateInterface; use Laminas\EventManager\ListenerAggregateTrait; -use Laminas\Http\Request; +use Laminas\Http\PhpEnvironment\Request; use Laminas\Mvc\MvcEvent; use Laminas\Router\Attributes\Loader\AttributesClassLoader; use Laminas\Router\RouteMatch; @@ -20,7 +20,7 @@ use function array_keys; -class RoutingAttributesListener implements ListenerAggregateInterface +final class RoutingAttributesListener implements ListenerAggregateInterface { use ListenerAggregateTrait; @@ -57,7 +57,7 @@ private function onNoLaminasRouteFound(MvcEvent $event): ?RouteMatch $event->setRouteMatch($routeMatch); $event->stopPropagation(); - $event->setError(null); + $event->setError(''); return $routeMatch; } catch (ResourceNotFoundException | MethodNotAllowedException) {