Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4

- name: Pull in optional dependencies
run: composer require --no-update jean-beru/fos-http-cache-cloudfront twig/twig symfony/console
run: composer require --no-update jean-beru/fos-http-cache-cloudfront twig/twig symfony/console phpstan/phpstan-symfony

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"symfony/routing": "^6.4 || ^7.0",
"matthiasnoback/symfony-config-test": "^4.3.0 || ^5.1",
"matthiasnoback/symfony-dependency-injection-test": "^4.3.1 || ^5.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-symfony": "^1.3",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^2",
"phpstan/phpstan-symfony": "^2",
"phpstan/extension-installer": "^1.4",
"jean-beru/fos-http-cache-cloudfront": "^1.1",
"friendsofphp/php-cs-fixer": "^3.54"
},
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
parameters:
level: 1
level: 5
paths:
- src
4 changes: 4 additions & 0 deletions src/EventListener/FlashMessageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\HttpFoundation\Session\FlashBagAwareSessionInterface;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
Expand Down Expand Up @@ -56,6 +57,9 @@ public function onKernelResponse(ResponseEvent $event): void
} catch (SessionNotFoundException) {
return;
}
if (!($session instanceof FlashBagAwareSessionInterface)) {
return;
}

// Flash messages are stored in the session. If there is none, there
// can't be any flash messages in it. $session->getFlashBag() would
Expand Down
14 changes: 6 additions & 8 deletions src/EventListener/InvalidationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,13 @@ private function invalidateRoutes(array $routes, Request $request): void
foreach ($routes as $route) {
$params = [];

if (null !== $route->getParams()) {
// Iterate over route params and try to evaluate their values
foreach ($route->getParams() as $key => $value) {
if (is_array($value)) {
$value = $this->getExpressionLanguage()->evaluate($value['expression'], $values);
}

$params[$key] = $value;
// Iterate over route params and try to evaluate their values
foreach ($route->getParams() as $key => $value) {
if (is_array($value)) {
$value = $this->getExpressionLanguage()->evaluate($value['expression'], $values);
}

$params[$key] = $value;
}
$this->cacheManager->invalidateRoute($route->getName(), $params);
}
Expand Down
5 changes: 3 additions & 2 deletions src/EventListener/TagListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ public static function getSubscribedEvents(): array
private function getAttributeTags(Request $request): array
{
// Check for _tag request attribute that is set when using Tag attribute
/** @var $tagConfigurations Tag[] */
if (!$tagConfigurations = $request->attributes->get('_tag')) {
/** @var Tag[] $tagConfigurations */
$tagConfigurations = $request->attributes->get('_tag');
if (!$tagConfigurations) {
return [];
}

Expand Down
Loading