Skip to content

Commit

Permalink
Update routing, requests and dependencies
Browse files Browse the repository at this point in the history
This commit updates various modules and request classes in the application's global configuration, changes route match error status, and introduces more explicit version constraints in composer.json. Also, a new psalm.xml.dist file and new entries in .gitignore are added for the static analysis tool Psalm.
  • Loading branch information
Sebastian Hopfe committed Dec 27, 2023
1 parent c22d517 commit db3b5e8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion config/test/application.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="true"
>
<projectFiles>
<directory name="config" />
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
6 changes: 3 additions & 3 deletions src/Listener/RoutingAttributesListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,7 +20,7 @@

use function array_keys;

class RoutingAttributesListener implements ListenerAggregateInterface
final class RoutingAttributesListener implements ListenerAggregateInterface
{
use ListenerAggregateTrait;

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit db3b5e8

Please sign in to comment.