Skip to content

Commit e20fce6

Browse files
committed
fix: style
1 parent 7f206d6 commit e20fce6

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/Utils/Test/src/Fluent/SpanEventAssertion.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function withAttribute(string $key, $value): self
141141
* @param array $attributes The expected attributes
142142
* @throws TraceAssertionFailedException
143143
* @return self
144+
* @psalm-suppress PossiblyUnusedMethod
144145
*/
145146
public function withAttributes(array $attributes): self
146147
{
@@ -176,10 +177,11 @@ private function formatValue($value): string
176177
} elseif (null === $value) {
177178
return 'null';
178179
} elseif (is_array($value)) {
179-
return json_encode($value);
180+
$json = json_encode($value);
181+
182+
return $json === false ? '[unable to encode]' : $json;
180183
}
181184

182185
return (string) $value;
183-
184186
}
185187
}

src/Utils/Test/src/Fluent/TraceAssertion.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function __construct($spans, bool $strict = false)
4242
* Enable strict mode for all assertions.
4343
*
4444
* @return self
45+
* @psalm-suppress PossiblyUnusedMethod
4546
*/
4647
public function inStrictMode(): self
4748
{
@@ -63,8 +64,7 @@ public function hasRootSpan($name): SpanAssertion
6364
$rootSpans = [];
6465
$spanMap = $this->buildSpanMap($this->spans);
6566

66-
/** @psalm-suppress UnusedVariable */
67-
foreach ($spanMap as $spanId => $data) {
67+
foreach ($spanMap as $_ => $data) {
6868
$span = $data['span'];
6969
$parentSpanId = $span->getParentSpanId();
7070

@@ -152,8 +152,7 @@ public function hasRootSpans(int $count): self
152152
$rootSpans = [];
153153
$spanMap = $this->buildSpanMap($this->spans);
154154

155-
/** @psalm-suppress UnusedVariable */
156-
foreach ($spanMap as $spanId => $data) {
155+
foreach ($spanMap as $_ => $data) {
157156
$span = $data['span'];
158157
$parentSpanId = $span->getParentSpanId();
159158

@@ -213,6 +212,7 @@ public function getSpans(): array
213212
* Check if strict mode is enabled.
214213
*
215214
* @return bool
215+
* @psalm-suppress PossiblyUnusedMethod
216216
*/
217217
public function isStrict(): bool
218218
{

src/Utils/Test/src/Fluent/TraceAssertionFailedException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/**
1010
* Exception thrown when a trace assertion fails.
11+
* @psalm-suppress InternalClass
1112
*/
1213
class TraceAssertionFailedException extends AssertionFailedError
1314
{
@@ -21,6 +22,7 @@ class TraceAssertionFailedException extends AssertionFailedError
2122
* @param string $message The error message
2223
* @param array $expectedStructure The expected structure
2324
* @param array $actualStructure The actual structure
25+
* @psalm-suppress InternalMethod
2426
*/
2527
public function __construct(string $message, array $expectedStructure, array $actualStructure)
2628
{

0 commit comments

Comments
 (0)