Skip to content

Symfony 2.8 support #223

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

Merged
merged 5 commits into from
Jul 2, 2019
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
...

## 3.1.0 - 2019-07-02
- Add support for Symfony 2.8 (#233, thanks to @nocive)
- Fix handling of ESI requests (#213, thanks to @franmomu)

## 3.0.0 - 2019-05-10
- Add the `sentry:test` command, to test if the Sentry SDK is functioning properly.

Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"php": "^7.1",
"jean85/pretty-package-versions": "^1.0",
"sentry/sdk": "^2.0",
"symfony/config": "^3.0||^4.0",
"symfony/console": "^3.0||^4.0",
"symfony/dependency-injection": "^3.0||^4.0",
"symfony/event-dispatcher": "^3.0||^4.0",
"symfony/http-kernel": "^3.0||^4.0",
"symfony/security-core": "^3.0||^4.0"
"symfony/config": "^2.8||^3.0||^4.0",
"symfony/console": "^2.8||^3.0||^4.0",
"symfony/dependency-injection": "^2.8||^3.0||^4.0",
"symfony/event-dispatcher": "^2.8||^3.0||^4.0",
"symfony/http-kernel": "^2.8||^3.0||^4.0",
"symfony/security-core": "^2.8||^3.0||^4.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.8",
Expand All @@ -37,7 +37,7 @@
"phpstan/phpstan-phpunit": "^0.11",
"phpunit/phpunit": "^7.5",
"scrutinizer/ocular": "^1.4",
"symfony/expression-language": "^3.0||^4.0"
"symfony/expression-language": "^2.8||^3.0||^4.0"
},
"autoload": {
"psr-4" : {
Expand Down
20 changes: 20 additions & 0 deletions src/DependencyInjection/SentryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

use Sentry\ClientBuilderInterface;
use Sentry\Options;
use Sentry\SentryBundle\Command\SentryTestCommand;
use Sentry\SentryBundle\ErrorTypesParser;
use Sentry\SentryBundle\EventListener\ConsoleListener;
use Sentry\SentryBundle\EventListener\ErrorListener;
use Sentry\SentryBundle\EventListener\RequestListener;
use Sentry\SentryBundle\EventListener\SubRequestListener;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Console\ConsoleEvents;
Expand All @@ -14,6 +18,7 @@
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\Kernel;

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

$this->tagConsoleErrorListener($container);
$this->setLegacyVisibilities($container);
}

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

$listener->addTag('kernel.event_listener', $tagAttributes);
}

/**
* BC layer for symfony < 3.3, listeners and commands must be public
*/
private function setLegacyVisibilities(ContainerBuilder $container): void
{
if (Kernel::VERSION_ID < 30300) {
$container->getDefinition(SentryTestCommand::class)->setPublic(true);
$container->getDefinition(ConsoleListener::class)->setPublic(true);
$container->getDefinition(ErrorListener::class)->setPublic(true);
$container->getDefinition(RequestListener::class)->setPublic(true);
$container->getDefinition(SubRequestListener::class)->setPublic(true);
}
}
}