Skip to content

Commit

Permalink
fix to long string in error context transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBadura committed Jan 17, 2025
1 parent 0498a7a commit c2b495e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Subscription/ThrowableToErrorContextTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ private static function flattenArgs(array $args, int $level = 0, int &$count = 0
} elseif (is_resource($value)) {
$result[$key] = ['resource', get_resource_type($value)];
} else {
$result[$key] = ['string', (string)$value];
if (mb_strlen((string)$value) > 1_000) {

Check failure on line 115 in src/Subscription/ThrowableToErrorContextTransformer.php

View workflow job for this annotation

GitHub Actions / Static Analysis by PHPStan (locked, 8.3, ubuntu-latest)

Ignored error pattern #^Cannot cast mixed to string\.$# (cast.string) in path /home/runner/work/event-sourcing/event-sourcing/src/Subscription/ThrowableToErrorContextTransformer.php is expected to occur 1 time, but occurred 3 times.
$result[$key] = ['string', '*TOO LONG STRING TRUNCATED* ' . mb_substr((string)$value, 0, 1_000) . '...'];

Check failure on line 116 in src/Subscription/ThrowableToErrorContextTransformer.php

View workflow job for this annotation

GitHub Actions / Static Analysis by PHPStan (locked, 8.3, ubuntu-latest)

Cannot cast mixed to string.
} else {
$result[$key] = ['string', (string)$value];

Check failure on line 118 in src/Subscription/ThrowableToErrorContextTransformer.php

View workflow job for this annotation

GitHub Actions / Static Analysis by PHPStan (locked, 8.3, ubuntu-latest)

Cannot cast mixed to string.
}
}
}

Expand Down

0 comments on commit c2b495e

Please sign in to comment.