Skip to content
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

Use full class names in breadcrumbs #578

Merged
merged 4 commits into from
Apr 3, 2020
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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Changelog
=========

## Unreleased
## 3.21.0 (TBC)

### Enhancements

* Use full class names in breadcrumbs
[#578](https://github.com/bugsnag/bugsnag-php/pull/578)

* Added support for getting the "original error"
[#576](https://github.com/bugsnag/bugsnag-php/pull/576)

Expand Down
8 changes: 0 additions & 8 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
use Composer\CaBundle\CaBundle;
use GuzzleHttp\Client as Guzzle;
use GuzzleHttp\ClientInterface;
use ReflectionClass;
use ReflectionException;

class Client
{
Expand Down Expand Up @@ -242,12 +240,6 @@ public function registerMiddleware(callable $middleware)
*/
public function leaveBreadcrumb($name, $type = null, array $metaData = [])
{
try {
$name = (new ReflectionClass($name))->getShortName();
} catch (ReflectionException $e) {
//
}

$type = in_array($type, Breadcrumb::getTypes(), true) ? $type : Breadcrumb::MANUAL_TYPE;

$this->recorder->record(new Breadcrumb($name, $type, $metaData));
Expand Down
6 changes: 3 additions & 3 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public function testBreadcrumbsFallback()
$this->assertFalse(isset($breadcrumbs[0]['metaData']));
}

public function testBreadcrumbsNoName()
public function testBreadcrumbsWithNoName()
{
$this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle);

Expand All @@ -372,7 +372,7 @@ public function testBreadcrumbsNoName()
$this->assertTrue(isset($breadcrumbs[0]['metaData']));
}

public function testBreadcrumbsGetShortNameClass()
public function testBreadcrumbsWithClassName()
{
$this->client = new Client($this->config = new Configuration('example-api-key'), null, $this->guzzle);

Expand All @@ -386,7 +386,7 @@ public function testBreadcrumbsGetShortNameClass()

$this->assertCount(3, $breadcrumbs[0]);
$this->assertInternalType('string', $breadcrumbs[0]['timestamp']);
$this->assertSame('Client', $breadcrumbs[0]['name']);
$this->assertSame('Bugsnag\Client', $breadcrumbs[0]['name']);
$this->assertSame('state', $breadcrumbs[0]['type']);
$this->assertFalse(isset($breadcrumbs[0]['metaData']));
}
Expand Down