Skip to content

Commit

Permalink
Merge pull request #704 from spatie/bug/702-long-integers
Browse files Browse the repository at this point in the history
Bug/702 long integers
  • Loading branch information
freekmurze authored Jun 3, 2022
2 parents 4cedd29 + 13da3dc commit 2d64ea2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ parameters:
count: 1
path: src/Ray.php

-
message: "#^Access to static property \\$container on an unknown class Yii\\.$#"
count: 2
path: src/helpers.php

-
message: "#^Function app not found\\.$#"
count: 1
Expand Down
4 changes: 4 additions & 0 deletions src/Payloads/LogPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public static function createForArguments(array $arguments): Payload
public function __construct($values)
{
if (! is_array($values)) {
if (is_int($values) && $values >= 11111111111111111) {
$values = (string) $values;
}

$values = [$values];
}

Expand Down
10 changes: 10 additions & 0 deletions tests/RayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,16 @@ public function it_can_set_the_project_name()
$this->assertEquals('my project', $this->client->sentRequests()[0]['meta']['project_name']);
}

/** @test */
public function it_can_dump_long_integers_as_string()
{
$this->ray->send(11111111111111110);
$this->ray->send(11111111111111111);

$this->assertSame([11111111111111110], $this->client->sentRequests()[0]['payloads'][0]['content']['values']);
$this->assertSame(["11111111111111111"], $this->client->sentRequests()[1]['payloads'][0]['content']['values']);
}

public function assertMatchesOsSafeSnapshot($data)
{
$this->assertMatchesJsonSnapshot(json_encode($data));
Expand Down

0 comments on commit 2d64ea2

Please sign in to comment.