Skip to content

Commit

Permalink
Merge pull request #55 from jcchavezs/fix_onKernelException
Browse files Browse the repository at this point in the history
fix: fixes the typehint for onKernelException.
  • Loading branch information
jcchavezs committed Apr 1, 2020
2 parents c2c82d5 + 3c14f0f commit eb4f83a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
17 changes: 13 additions & 4 deletions .travis.yml
@@ -1,12 +1,21 @@
language: php

php:
- "7.1"
- "7.2"
- "7.3"
jobs:
include:
- php: "7.0"
env: SYMFONY_VERSION=3.4
- php: "7.1"
env: SYMFONY_VERSION=3.4
- php: "7.1"
env: SYMFONY_VERSION=4.4
- php: "7.2"
env: SYMFONY_VERSION=4.4
- php: "7.3"
env: SYMFONY_VERSION=4.4

install:
- composer install
- composer require symfony/config:"^$SYMFONY_VERSION" symfony/http-kernel:"^$SYMFONY_VERSION" symfony/routing:"^$SYMFONY_VERSION" symfony/dependency-injection:"^$SYMFONY_VERSION"

script:
- composer lint
Expand Down
8 changes: 3 additions & 5 deletions src/ZipkinBundle/Middleware.php
Expand Up @@ -15,8 +15,6 @@
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\KernelEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;

final class Middleware
{
Expand Down Expand Up @@ -112,7 +110,7 @@ public function onKernelController(KernelEvent $event)
/**
* @see https://symfony.com/doc/4.4/reference/events.html#kernel-exception
*/
public function onKernelException(RequestEvent $event)
public function onKernelException(KernelEvent $event)
{
if (!$event->isMasterRequest()) {
return;
Expand All @@ -122,12 +120,12 @@ public function onKernelException(RequestEvent $event)
if ($span !== null) {
if ($this->usesDeprecatedEvents) {
/**
* @var GetResponseForExceptionEvent $event
* @var Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event
*/
$errorMessage = $event->getException()->getMessage();
} else {
/**
* @var ExceptionEvent $event
* @var Symfony\Component\HttpKernel\Event\ExceptionEvent $event
*/
$errorMessage = $event->getThrowable()->getMessage();
}
Expand Down
3 changes: 1 addition & 2 deletions tests/Unit/MiddlewareTest.php
Expand Up @@ -10,7 +10,6 @@
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
use Zipkin\Reporters\InMemory;
use Zipkin\Samplers\BinarySampler;
use Zipkin\TracingBuilder;
use ZipkinBundle\Middleware;
Expand All @@ -24,7 +23,7 @@ class MiddlewareTest extends PHPUnit_Framework_TestCase
const TAG_KEY = 'key';
const TAG_VALUE = 'value';
const EXCEPTION_MESSAGE = 'message';

public function testSpanIsNotCreatedOnNonMasterRequest()
{
$tracing = TracingBuilder::create()->build();
Expand Down

0 comments on commit eb4f83a

Please sign in to comment.