Skip to content
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
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$finder = Finder::create()
->in(__DIR__)
Expand All @@ -24,4 +25,5 @@
'import_functions' => true,
]
])
->setParallelConfig(ParallelConfigFactory::detect())
->setFinder($finder);
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parameters:

type_coverage:
return: 100
param: 90
param: 100
property: 100
declare: 100
constant: 0
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function stackTraceToArray(Throwable $throwable): array
// Exception object `getTrace` does not return file and line number for the first line
// http://php.net/manual/en/exception.gettrace.php#107563

$inApp = function ($file): bool {
$inApp = function (string $file): bool {
return !str_contains($file, 'vendor') &&
!str_contains($file, 'index.php') &&
!str_contains($file, 'web/core'); // Drupal
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function only(array $keys): array

public function jsonSerialize(): array
{
return array_filter($this->getProperties(), fn ($value): bool|int =>
return array_filter($this->getProperties(), fn (mixed $value): bool|int =>
// remove NULL, FALSE, empty strings and empty arrays, but keep values of 0 (zero)
is_array($value) || is_object($value) ? !empty($value) : strlen((string) ($value ?? '')));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function setType(string $type): Transaction
*
* @param integer|string $id
*/
public function withUser($id, ?string $name = null, ?string $email = null): Transaction
public function withUser(int|string $id, ?string $name = null, ?string $email = null): Transaction
{
$this->user = new User($id, $name, $email);
return $this;
Expand Down
5 changes: 3 additions & 2 deletions tests/AgentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ public function testCallbackReturn(): void

public function testAddSegmentWithInput(): void
{
$this->inspector->addSegment(function ($segment): void {
$this->inspector->addSegment(function (Segment $segment): void {
$this->assertInstanceOf(Segment::class, $segment);
}, 'callback', 'test callback', true);
}

public function testAddSegmentWithInputContext(): void
{
$segment = $this->inspector->addSegment(fn ($segment) => $segment->setContext(['foo' => 'bar']), 'callback', 'test callback', true);
$segment = $this->inspector
->addSegment(fn (Segment $segment) => $segment->setContext(['foo' => 'bar']), 'callback', 'test callback', true);

$this->assertEquals(['foo' => 'bar'], $segment->getContext());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/NestedSegmentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function testMixedStartAndAddSegment(): void

$this->inspector->startSegment('parent', 'parent-operation');

$result = $this->inspector->addSegment(function ($segment): string {
$result = $this->inspector->addSegment(function (Segment $segment): string {
$this->assertEquals($this->inspector->getOpenSegments()[0]['hash'], $segment->parent_hash);

// Start another segment inside the callback
Expand Down Expand Up @@ -273,7 +273,7 @@ public function testAddSegmentWithExceptionHandling(): void
$this->inspector->startSegment('parent', 'parent-operation');

// Test with throw = false
$result = $this->inspector->addSegment(function ($segment): void {
$result = $this->inspector->addSegment(function (): void {
throw new Exception('Test exception');
}, 'child', 'child-operation', false);

Expand Down
Loading