Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Symfony support below 4.4 #643

Merged
merged 9 commits into from Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 1 addition & 13 deletions .github/workflows/tests.yaml
Expand Up @@ -24,7 +24,6 @@ jobs:
- '8.0'
- '8.1'
symfony-version:
- 3.4.*
- 4.4.*
- 5.*
- 6.*
Expand All @@ -37,14 +36,7 @@ jobs:
symfony-version: 6.*
- php: '7.4'
symfony-version: 6.*
- php: '8.0'
symfony-version: 3.4.*
- php: '8.1'
symfony-version: 3.4.*
include:
- php: '7.2'
symfony-version: 3.4.*
dependencies: lowest
- php: '7.2'
symfony-version: 4.4.*
dependencies: lowest
Expand All @@ -71,10 +63,6 @@ jobs:
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Remove Symfony Messenger
run: composer remove --dev symfony/messenger --no-update
if: matrix.symfony-version == '3.4.*'

- name: Install dependencies
uses: ramsey/composer-install@v1
with:
Expand All @@ -100,7 +88,7 @@ jobs:
include:
- php: '7.2'
dependencies: lowest
symfony-version: 3.4.*
symfony-version: 4.4.*
- php: '7.4'
dependencies: highest
- php: '8.0'
Expand Down
26 changes: 13 additions & 13 deletions composer.json
Expand Up @@ -28,14 +28,14 @@
"php-http/discovery": "^1.11",
"sentry/sdk": "^3.2",
"symfony/cache-contracts": "^1.1||^2.4||^3.0",
"symfony/config": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/console": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/dependency-injection": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/event-dispatcher": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/http-kernel": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/config": "^4.4.20||^5.0.11||^6.0",
"symfony/console": "^4.4.20||^5.0.11||^6.0",
"symfony/dependency-injection": "^4.4.20||^5.0.11||^6.0",
"symfony/event-dispatcher": "^4.4.20||^5.0.11||^6.0",
"symfony/http-kernel": "^4.4.20||^5.0.11||^6.0",
"symfony/polyfill-php80": "^1.22",
"symfony/psr-http-message-bridge": "^1.2||^2.0",
"symfony/security-core": "^3.4.44||^4.4.20||^5.0.11||^6.0"
"symfony/security-core": "^4.4.20||^5.0.11||^6.0"
},
"require-dev": {
"doctrine/dbal": "^2.13||^3.0",
Expand All @@ -50,16 +50,16 @@
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^8.5.14||^9.3.9",
"symfony/browser-kit": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/cache": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/dom-crawler": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/framework-bundle": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/browser-kit": "^4.4.20||^5.0.11||^6.0",
"symfony/cache": "^4.4.20||^5.0.11||^6.0",
"symfony/dom-crawler": "^4.4.20||^5.0.11||^6.0",
"symfony/framework-bundle": "^4.4.20||^5.0.11||^6.0",
"symfony/messenger": "^4.4.20||^5.0.11||^6.0",
"symfony/monolog-bundle": "^3.4",
"symfony/phpunit-bridge": "^5.2.6||^6.0",
"symfony/process": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/twig-bundle": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/yaml": "^3.4.44||^4.4.20||^5.0.11||^6.0",
"symfony/process": "^4.4.20||^5.0.11||^6.0",
"symfony/twig-bundle": "^4.4.20||^5.0.11||^6.0",
"symfony/yaml": "^4.4.20||^5.0.11||^6.0",
"vimeo/psalm": "^4.3"
},
"suggest": {
Expand Down
30 changes: 0 additions & 30 deletions phpstan-baseline.neon
Expand Up @@ -60,11 +60,6 @@ parameters:
count: 3
path: src/DependencyInjection/SentryExtension.php

-
message: "#^Class Symfony\\\\Component\\\\Debug\\\\Exception\\\\FatalErrorException not found\\.$#"
count: 1
path: src/DependencyInjection/SentryExtension.php

-
message: "#^Parameter \\#1 \\$array of function array_filter expects array, mixed given\\.$#"
count: 1
Expand Down Expand Up @@ -150,11 +145,6 @@ parameters:
count: 1
path: src/EventListener/ConsoleCommandListener.php

-
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
count: 1
path: src/EventListener/ErrorListener.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\KernelEvent\\:\\:isMasterRequest\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -270,11 +260,6 @@ parameters:
count: 1
path: tests/DependencyInjection/SentryExtensionTest.php

-
message: "#^Class Symfony\\\\Component\\\\Debug\\\\Exception\\\\FatalErrorException not found\\.$#"
count: 1
path: tests/DependencyInjection/SentryExtensionTest.php

-
message: "#^Class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Client not found\\.$#"
count: 1
Expand Down Expand Up @@ -315,21 +300,11 @@ parameters:
count: 1
path: tests/EventListener/RequestListenerTest.php

-
message: "#^Instantiated class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\FilterControllerEvent not found\\.$#"
count: 3
path: tests/EventListener/RequestListenerTest.php

-
message: "#^Instantiated class Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\GetResponseEvent not found\\.$#"
count: 9
path: tests/EventListener/RequestListenerTest.php

-
message: "#^Parameter \\#1 \\$event of method Sentry\\\\SentryBundle\\\\EventListener\\\\RequestListener\\:\\:handleKernelControllerEvent\\(\\) expects Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\ControllerEvent, Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\ControllerEvent\\|Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\FilterControllerEvent given\\.$#"
count: 1
path: tests/EventListener/RequestListenerTest.php

-
message: "#^Parameter \\#1 \\$event of method Sentry\\\\SentryBundle\\\\EventListener\\\\RequestListener\\:\\:handleKernelRequestEvent\\(\\) expects Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\RequestEvent, Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\GetResponseEvent\\|Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\RequestEvent given\\.$#"
count: 1
Expand All @@ -340,11 +315,6 @@ parameters:
count: 1
path: tests/EventListener/RequestListenerTest.php

-
message: "#^Parameter \\$controllerEvent of method Sentry\\\\SentryBundle\\\\Tests\\\\EventListener\\\\RequestListenerTest\\:\\:testHandleKernelControllerEvent\\(\\) has invalid type Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\FilterControllerEvent\\.$#"
count: 1
path: tests/EventListener/RequestListenerTest.php

-
message: "#^Parameter \\$requestEvent of method Sentry\\\\SentryBundle\\\\Tests\\\\EventListener\\\\RequestListenerTest\\:\\:testHandleKernelRequestEvent\\(\\) has invalid type Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\GetResponseEvent\\.$#"
count: 1
Expand Down
2 changes: 0 additions & 2 deletions src/DependencyInjection/SentryExtension.php
Expand Up @@ -31,7 +31,6 @@
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader;
Expand Down Expand Up @@ -280,7 +279,6 @@ private function configureErrorListenerIntegration(array $integrations, bool $re
[
'ignore_exceptions' => [
FatalError::class,
FatalErrorException::class,
Jean85 marked this conversation as resolved.
Show resolved Hide resolved
],
],
]));
Expand Down
6 changes: 3 additions & 3 deletions src/EventListener/AbstractTracingRequestListener.php
Expand Up @@ -7,6 +7,7 @@
use Sentry\State\HubInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\Routing\Route;

abstract class AbstractTracingRequestListener
Expand Down Expand Up @@ -34,11 +35,10 @@ public function __construct(HubInterface $hub)
* gathering information like the HTTP status code and attaching them as
* tags of the span/transaction.
*
* @param RequestListenerResponseEvent $event The event
* @param ResponseEvent $event The event
*/
public function handleKernelResponseEvent(RequestListenerResponseEvent $event): void
public function handleKernelResponseEvent(ResponseEvent $event): void
{
/** @var Response $response */
$response = $event->getResponse();
$span = $this->hub->getSpan();

Expand Down
10 changes: 3 additions & 7 deletions src/EventListener/ErrorListener.php
Expand Up @@ -30,14 +30,10 @@ public function __construct(HubInterface $hub)
/**
* Handles an exception that happened while running the application.
*
* @param ErrorListenerExceptionEvent $event The event
* @param ExceptionEvent $event The event
*/
public function handleExceptionEvent(ErrorListenerExceptionEvent $event): void
public function handleExceptionEvent(ExceptionEvent $event): void
{
if ($event instanceof ExceptionEvent) {
$this->hub->captureException($event->getThrowable());
} else {
$this->hub->captureException($event->getException());
}
$this->hub->captureException($event->getThrowable());
}
}
10 changes: 6 additions & 4 deletions src/EventListener/RequestListener.php
Expand Up @@ -7,6 +7,8 @@
use Sentry\State\HubInterface;
use Sentry\State\Scope;
use Sentry\UserDataBag;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\User\UserInterface;
Expand Down Expand Up @@ -46,9 +48,9 @@ public function __construct(HubInterface $hub, ?TokenStorageInterface $tokenStor
* This method is called for each request handled by the framework and
* fills the Sentry scope with information about the current user.
*
* @param RequestListenerRequestEvent $event The event
* @param RequestEvent $event The event
*/
public function handleKernelRequestEvent(RequestListenerRequestEvent $event): void
public function handleKernelRequestEvent(RequestEvent $event): void
{
if (!$this->isMainRequest($event)) {
return;
Expand Down Expand Up @@ -81,9 +83,9 @@ public function handleKernelRequestEvent(RequestListenerRequestEvent $event): vo
* This method is called for each request handled by the framework and
* sets the route on the current Sentry scope.
*
* @param RequestListenerControllerEvent $event The event
* @param ControllerEvent $event The event
*/
public function handleKernelControllerEvent(RequestListenerControllerEvent $event): void
public function handleKernelControllerEvent(ControllerEvent $event): void
{
if (!$this->isMainRequest($event)) {
return;
Expand Down
5 changes: 3 additions & 2 deletions src/EventListener/SubRequestListener.php
Expand Up @@ -6,6 +6,7 @@

use Sentry\State\HubInterface;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;

/**
* This listener ensures that a new {@see \Sentry\State\Scope} is created for
Expand Down Expand Up @@ -34,9 +35,9 @@ public function __construct(HubInterface $hub)
* This method is called for each subrequest handled by the framework and
* pushes a new {@see \Sentry\State\Scope} onto the stack.
*
* @param SubRequestListenerRequestEvent $event The event
* @param RequestEvent $event The event
*/
public function handleKernelRequestEvent(SubRequestListenerRequestEvent $event): void
public function handleKernelRequestEvent(RequestEvent $event): void
{
if ($this->isMainRequest($event)) {
return;
Expand Down
10 changes: 6 additions & 4 deletions src/EventListener/TracingRequestListener.php
Expand Up @@ -7,6 +7,8 @@
use Sentry\Tracing\Transaction;
use Sentry\Tracing\TransactionContext;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\TerminateEvent;

/**
* This event listener acts on the master requests and starts a transaction
Expand All @@ -20,9 +22,9 @@ final class TracingRequestListener extends AbstractTracingRequestListener
* This method is called for each subrequest handled by the framework and
* starts a new {@see Transaction}.
*
* @param RequestListenerRequestEvent $event The event
* @param RequestEvent $event The event
*/
public function handleKernelRequestEvent(RequestListenerRequestEvent $event): void
public function handleKernelRequestEvent(RequestEvent $event): void
{
if (!$this->isMainRequest($event)) {
return;
Expand All @@ -47,9 +49,9 @@ public function handleKernelRequestEvent(RequestListenerRequestEvent $event): vo
* This method is called for each request handled by the framework and
* ends the tracing on terminate after the client received the response.
*
* @param RequestListenerTerminateEvent $event The event
* @param TerminateEvent $event The event
*/
public function handleKernelTerminateEvent(RequestListenerTerminateEvent $event): void
public function handleKernelTerminateEvent(TerminateEvent $event): void
{
$transaction = $this->hub->getTransaction();

Expand Down
5 changes: 3 additions & 2 deletions src/EventListener/TracingSubRequestListener.php
Expand Up @@ -7,6 +7,7 @@
use Sentry\Tracing\Span;
use Sentry\Tracing\SpanContext;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;

/**
* This event listener acts on the sub requests and starts a child span of the
Expand All @@ -18,9 +19,9 @@ final class TracingSubRequestListener extends AbstractTracingRequestListener
* This method is called for each subrequest handled by the framework and
* traces each by starting a new {@see Span}.
*
* @param SubRequestListenerRequestEvent $event The event
* @param RequestEvent $event The event
*/
public function handleKernelRequestEvent(SubRequestListenerRequestEvent $event): void
public function handleKernelRequestEvent(RequestEvent $event): void
{
if ($this->isMainRequest($event)) {
return;
Expand Down