Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
"symfony/event-dispatcher": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/http-kernel": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/polyfill-php80": "^1.22",
"symfony/psr-http-message-bridge": "^1.2||^2.0||^6.4||^7.0",
"symfony/security-core": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/security-http": "^4.4.20||^5.0.11||^6.0||^7.0"
"symfony/psr-http-message-bridge": "^1.2||^2.0||^6.4||^7.0"
},
"require-dev": {
"doctrine/dbal": "^2.13||^3.3||^4.0",
Expand All @@ -46,6 +44,8 @@
"symfony/monolog-bundle": "^3.4",
"symfony/phpunit-bridge": "^5.2.6||^6.0||^7.0",
"symfony/process": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/security-core": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/security-http": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/twig-bundle": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/yaml": "^4.4.20||^5.0.11||^6.0||^7.0",
"vimeo/psalm": "^4.3||^5.16.0"
Expand Down
10 changes: 9 additions & 1 deletion src/DependencyInjection/Compiler/AddLoginListenerTagPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@
*/
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition(LoginListener::class)) {
return;
}
$listenerDefinition = $container->getDefinition(LoginListener::class);

if (!class_exists(LoginSuccessEvent::class)) {
if (class_exists(LoginSuccessEvent::class)) {
$listenerDefinition->addTag('kernel.event_listener', [
'event' => LoginSuccessEvent::class,
'method' => 'handleLoginSuccessEvent',
]);

Check warning on line 29 in src/DependencyInjection/Compiler/AddLoginListenerTagPass.php

View check run for this annotation

Codecov / codecov/patch

src/DependencyInjection/Compiler/AddLoginListenerTagPass.php#L26-L29

Added lines #L26 - L29 were not covered by tests
} elseif (class_exists(AuthenticationSuccessEvent::class)) {
$listenerDefinition->addTag('kernel.event_listener', [
'event' => AuthenticationSuccessEvent::class,
'method' => 'handleAuthenticationSuccessEvent',
Expand Down
6 changes: 6 additions & 0 deletions src/DependencyInjection/SentryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Sentry\Options;
use Sentry\SentryBundle\EventListener\ConsoleListener;
use Sentry\SentryBundle\EventListener\ErrorListener;
use Sentry\SentryBundle\EventListener\LoginListener;
use Sentry\SentryBundle\EventListener\MessengerListener;
use Sentry\SentryBundle\EventListener\TracingConsoleListener;
use Sentry\SentryBundle\EventListener\TracingRequestListener;
Expand All @@ -34,6 +35,7 @@
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;

final class SentryExtension extends ConfigurableExtension
{
Expand Down Expand Up @@ -75,6 +77,10 @@ protected function loadInternal(array $mergedConfig, ContainerBuilder $container
$this->registerTwigTracingConfiguration($container, $mergedConfig['tracing']);
$this->registerCacheTracingConfiguration($container, $mergedConfig['tracing']);
$this->registerHttpClientTracingConfiguration($container, $mergedConfig['tracing']);

if (!class_exists(TokenStorageInterface::class)) {
$container->removeDefinition(LoginListener::class);
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
<argument type="service" id="security.token_storage" on-invalid="ignore" />

<tag name="kernel.event_listener" event="kernel.request" method="handleKernelRequestEvent" />
<tag name="kernel.event_listener" event="Symfony\Component\Security\Http\Event\LoginSuccessEvent" method="handleLoginSuccessEvent" />
</service>

<service id="Sentry\SentryBundle\Command\SentryTestCommand" class="Sentry\SentryBundle\Command\SentryTestCommand">
Expand Down
Loading