Skip to content

Commit 0a12cde

Browse files
authored
Merge pull request #223 from nocive/2.8-backport
Symfony 2.8 support
2 parents b1df97d + 565e865 commit 0a12cde

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [Unreleased]
88
...
99

10+
## 3.1.0 - 2019-07-02
11+
- Add support for Symfony 2.8 (#233, thanks to @nocive)
12+
- Fix handling of ESI requests (#213, thanks to @franmomu)
13+
1014
## 3.0.0 - 2019-05-10
1115
- Add the `sentry:test` command, to test if the Sentry SDK is functioning properly.
1216

composer.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
"php": "^7.1",
2323
"jean85/pretty-package-versions": "^1.0",
2424
"sentry/sdk": "^2.0",
25-
"symfony/config": "^3.0||^4.0",
26-
"symfony/console": "^3.0||^4.0",
27-
"symfony/dependency-injection": "^3.0||^4.0",
28-
"symfony/event-dispatcher": "^3.0||^4.0",
29-
"symfony/http-kernel": "^3.0||^4.0",
30-
"symfony/security-core": "^3.0||^4.0"
25+
"symfony/config": "^2.8||^3.0||^4.0",
26+
"symfony/console": "^2.8||^3.0||^4.0",
27+
"symfony/dependency-injection": "^2.8||^3.0||^4.0",
28+
"symfony/event-dispatcher": "^2.8||^3.0||^4.0",
29+
"symfony/http-kernel": "^2.8||^3.0||^4.0",
30+
"symfony/security-core": "^2.8||^3.0||^4.0"
3131
},
3232
"require-dev": {
3333
"friendsofphp/php-cs-fixer": "^2.8",
@@ -37,7 +37,7 @@
3737
"phpstan/phpstan-phpunit": "^0.11",
3838
"phpunit/phpunit": "^7.5",
3939
"scrutinizer/ocular": "^1.4",
40-
"symfony/expression-language": "^3.0||^4.0"
40+
"symfony/expression-language": "^2.8||^3.0||^4.0"
4141
},
4242
"autoload": {
4343
"psr-4" : {

src/DependencyInjection/SentryExtension.php

+20
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
use Sentry\ClientBuilderInterface;
66
use Sentry\Options;
7+
use Sentry\SentryBundle\Command\SentryTestCommand;
78
use Sentry\SentryBundle\ErrorTypesParser;
9+
use Sentry\SentryBundle\EventListener\ConsoleListener;
810
use Sentry\SentryBundle\EventListener\ErrorListener;
11+
use Sentry\SentryBundle\EventListener\RequestListener;
12+
use Sentry\SentryBundle\EventListener\SubRequestListener;
913
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
1014
use Symfony\Component\Config\FileLocator;
1115
use Symfony\Component\Console\ConsoleEvents;
@@ -14,6 +18,7 @@
1418
use Symfony\Component\DependencyInjection\Loader;
1519
use Symfony\Component\DependencyInjection\Reference;
1620
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
21+
use Symfony\Component\HttpKernel\Kernel;
1722

1823
/**
1924
* This is the class that loads and manages your bundle configuration
@@ -44,6 +49,7 @@ public function load(array $configs, ContainerBuilder $container)
4449
}
4550

4651
$this->tagConsoleErrorListener($container);
52+
$this->setLegacyVisibilities($container);
4753
}
4854

4955
private function passConfigurationToOptions(ContainerBuilder $container, array $processedConfiguration): void
@@ -147,4 +153,18 @@ private function tagConsoleErrorListener(ContainerBuilder $container): void
147153

148154
$listener->addTag('kernel.event_listener', $tagAttributes);
149155
}
156+
157+
/**
158+
* BC layer for symfony < 3.3, listeners and commands must be public
159+
*/
160+
private function setLegacyVisibilities(ContainerBuilder $container): void
161+
{
162+
if (Kernel::VERSION_ID < 30300) {
163+
$container->getDefinition(SentryTestCommand::class)->setPublic(true);
164+
$container->getDefinition(ConsoleListener::class)->setPublic(true);
165+
$container->getDefinition(ErrorListener::class)->setPublic(true);
166+
$container->getDefinition(RequestListener::class)->setPublic(true);
167+
$container->getDefinition(SubRequestListener::class)->setPublic(true);
168+
}
169+
}
150170
}

0 commit comments

Comments
 (0)