Skip to content

Commit

Permalink
Merge pull request #223 from nocive/2.8-backport
Browse files Browse the repository at this point in the history
Symfony 2.8 support
  • Loading branch information
Jean85 authored Jul 2, 2019
2 parents b1df97d + 565e865 commit 0a12cde
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
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);
}
}
}

0 comments on commit 0a12cde

Please sign in to comment.