Skip to content

Commit

Permalink
Remove support of Symfony 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Nov 4, 2023
1 parent 93f8009 commit 3bb04f1
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 183 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ jobs:
- 8.1
- 8.2
symfony-version:
- 4.4.x
- 5.4.x
- 6.2.x
- 6.3.x
dependencies:
- highest
include:
- php-version: 7.4
dependencies: lowest
symfony-version: 4.4
symfony-version: 5.4
exclude:
- php-version: 7.4
symfony-version: 6.2.x
symfony-version: 6.3.x

steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 3.x.x (xxxx-xx-xx)
* Fixed overriding CSP header
* Dropped support for Symfony < 5.4

### 3.0.0 (2022-03-17)
* Bump minimal PHP version to 7.4
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
],
"require": {
"php": "^7.4 || ^8.0",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.0",
"symfony/security-core": "^4.4 || ^5.4 || ^6.0",
"symfony/security-csrf": "^4.4 || ^5.4 || ^6.0",
"symfony/security-http": "^4.4 || ^5.4 || ^6.0",
"symfony/yaml": "^4.4 || ^5.4 || ^6.0",
"symfony/framework-bundle": "^5.4 || ^6.3",
"symfony/http-kernel": "^5.4 || ^6.3",
"symfony/security-core": "^5.4 || ^6.3",
"symfony/security-csrf": "^5.4 || ^6.3",
"symfony/security-http": "^5.4 || ^6.3",
"symfony/yaml": "^5.4 || ^6.3",
"ua-parser/uap-php": "^3.4.4"
},
"require-dev": {
Expand All @@ -34,10 +34,10 @@
"phpstan/phpstan-symfony": "^1.1",
"phpunit/phpunit": "^9.5",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.0",
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
"symfony/phpunit-bridge": "^6.0",
"symfony/twig-bundle": "^4.4 || ^5.4 || ^6.0",
"symfony/browser-kit": "^5.4 || ^6.3",
"symfony/cache": "^5.4 || ^6.3",
"symfony/phpunit-bridge": "^6.3",
"symfony/twig-bundle": "^5.4 || ^6.3",
"twig/twig": "^2.10 || ^3.0"
},
"autoload": {
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ parameters:
ignoreErrors:
- '#^Dynamic call to static method PHPUnit\\Framework\\\S+\(\)\.$#'
- '#^Dynamic call to static method Symfony\\Bundle\\FrameworkBundle\\Test\\\S+\(\)\.$#'
# BC with Symfony 4.4
- "#^Call to function method_exists\\(\\) with Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\KernelEvent and 'isMainRequest' will always evaluate to true\\.#"
- '#^Call to an undefined method Symfony\\Component\\HttpKernel\\Event\\KernelEvent\:\:isMasterRequest\(\)\.#'
# Ignore typing providers in tests
- '#^Method Nelmio\\SecurityBundle\\Tests\\[^:]+Test::(provide\w+|\w+Provider)\(\) return type has no value type specified in iterable type (array|iterable)\.#'
dynamicConstantNames:
Expand Down
7 changes: 1 addition & 6 deletions src/DependencyInjection/NelmioSecurityExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\Kernel;

final class NelmioSecurityExtension extends Extension
{
Expand Down Expand Up @@ -132,11 +131,7 @@ public function load(array $configs, ContainerBuilder $container): void
}

if ($this->isConfigEnabled($container, $config['flexible_ssl'])) {
if (version_compare(Kernel::VERSION, '5.1', '<')) {
$loader->load('flexible_ssl_legacy.php');
} else {
$loader->load('flexible_ssl.php');
}
$loader->load('flexible_ssl.php');

$container->setParameter('nelmio_security.flexible_ssl.cookie_name', $config['flexible_ssl']['cookie_name']);
$container->setParameter('nelmio_security.flexible_ssl.unsecured_logout', $config['flexible_ssl']['unsecured_logout']);
Expand Down
33 changes: 0 additions & 33 deletions src/EventListener/BaseFlexibleSslListener.php

This file was deleted.

4 changes: 1 addition & 3 deletions src/EventListener/ClickjackingListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

final class ClickjackingListener extends AbstractContentTypeRestrictableListener
{
use KernelEventForwardCompatibilityTrait;

/**
* @var array<string, array<string, string>>
*/
Expand All @@ -46,7 +44,7 @@ public static function getSubscribedEvents(): array

public function onKernelResponse(ResponseEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down
6 changes: 2 additions & 4 deletions src/EventListener/ContentSecurityPolicyListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

final class ContentSecurityPolicyListener extends AbstractContentTypeRestrictableListener
{
use KernelEventForwardCompatibilityTrait;

private DirectiveSet $report;
private DirectiveSet $enforce;
private bool $compatHeaders;
Expand Down Expand Up @@ -68,7 +66,7 @@ public function __construct(

public function onKernelRequest(RequestEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down Expand Up @@ -135,7 +133,7 @@ public function getNonce(string $usage): string

public function onKernelResponse(ResponseEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down
4 changes: 1 addition & 3 deletions src/EventListener/ContentTypeListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

final class ContentTypeListener
{
use KernelEventForwardCompatibilityTrait;

private bool $nosniff;

public function __construct(bool $nosniff)
Expand All @@ -28,7 +26,7 @@ public function __construct(bool $nosniff)

public function onKernelResponse(ResponseEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down
4 changes: 1 addition & 3 deletions src/EventListener/ExternalRedirectListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

final class ExternalRedirectListener
{
use KernelEventForwardCompatibilityTrait;

private bool $abort;
private ?string $override;
private ?string $forwardAs;
Expand Down Expand Up @@ -68,7 +66,7 @@ public function __construct(

public function onKernelResponse(ResponseEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down
20 changes: 3 additions & 17 deletions src/EventListener/FlexibleSslListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Symfony\Component\Security\Http\Event\LogoutEvent;

final class FlexibleSslListener implements BaseFlexibleSslListener
final class FlexibleSslListener
{
use KernelEventForwardCompatibilityTrait;

private string $cookieName;
private bool $unsecuredLogout;
private EventDispatcherInterface $dispatcher;
Expand All @@ -41,7 +37,7 @@ public function __construct(string $cookieName, bool $unsecuredLogout, EventDisp

public function onKernelRequest(RequestEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand All @@ -60,7 +56,7 @@ public function onLogin(InteractiveLoginEvent $e): void

public function onPostLoginKernelResponse(ResponseEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down Expand Up @@ -127,16 +123,6 @@ public function onLogout(LogoutEvent $e): void
$this->doLogout($response);
}

/**
* Legacy method called from deprecated/removed Symfony\Component\Security\Http\Logout\LogoutHandlerInterface.
*
* @internal
*/
public function logout(Request $request, Response $response, TokenInterface $token): void
{
$this->doLogout($response);
}

private function doLogout(Response $response): void
{
if ($this->unsecuredLogout && null !== $response->headers->get('Location')) {
Expand Down
6 changes: 2 additions & 4 deletions src/EventListener/ForcedSslListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

final class ForcedSslListener
{
use KernelEventForwardCompatibilityTrait;

private ?int $hstsMaxAge;
private bool $hstsSubdomains;
private bool $hstsPreload;
Expand Down Expand Up @@ -50,7 +48,7 @@ public function __construct(

public function onKernelRequest(RequestEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand All @@ -77,7 +75,7 @@ public function onKernelRequest(RequestEvent $e): void

public function onKernelResponse(ResponseEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down
32 changes: 0 additions & 32 deletions src/EventListener/KernelEventForwardCompatibilityTrait.php

This file was deleted.

4 changes: 1 addition & 3 deletions src/EventListener/ReferrerPolicyListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*/
final class ReferrerPolicyListener
{
use KernelEventForwardCompatibilityTrait;

/**
* @var list<string>
*/
Expand All @@ -37,7 +35,7 @@ public function __construct(array $policies)

public function onKernelResponse(ResponseEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down
6 changes: 2 additions & 4 deletions src/EventListener/SignedCookieListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

final class SignedCookieListener
{
use KernelEventForwardCompatibilityTrait;

private Signer $signer;

/**
Expand All @@ -44,7 +42,7 @@ public function __construct(Signer $signer, array $signedCookieNames)

public function onKernelRequest(RequestEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand All @@ -65,7 +63,7 @@ public function onKernelRequest(RequestEvent $e): void

public function onKernelResponse(ResponseEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down
4 changes: 1 addition & 3 deletions src/EventListener/XssProtectionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

final class XssProtectionListener implements EventSubscriberInterface
{
use KernelEventForwardCompatibilityTrait;

private bool $enabled;
private bool $modeBlock;
private ?string $reportUri;
Expand All @@ -34,7 +32,7 @@ public function __construct(bool $enabled, bool $modeBlock, ?string $reportUri =

public function onKernelResponse(ResponseEvent $e): void
{
if (!$this->isMainRequest($e)) {
if (!$e->isMainRequest()) {
return;
}

Expand Down
Loading

0 comments on commit 3bb04f1

Please sign in to comment.