Skip to content

Commit

Permalink
Merge pull request #4 from JeanBaptisteRenard/patch-1
Browse files Browse the repository at this point in the history
PHP 8.2 Compatibility : casting record to string
  • Loading branch information
colinodell authored Nov 29, 2023
2 parents b1f66a3 + 8f17ac8 commit b36384d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/TestLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function hasRecord(string|array $record, string|int|null $level = null):
}

return $this->hasRecordThatPasses(static function (array $rec) use ($record) {
if ($rec['message'] !== $record['message']) {
if ((string) $rec['message'] !== (string) $record['message']) {
return false;
}

Expand All @@ -116,14 +116,14 @@ public function hasRecord(string|array $record, string|int|null $level = null):
public function hasRecordThatContains(string $message, string|int|null $level = null): bool
{
return $this->hasRecordThatPasses(static function (array $rec) use ($message) {
return \str_contains($rec['message'], $message);
return \str_contains((string) $rec['message'], $message);
}, $level);
}

public function hasRecordThatMatches(string $regex, string|int|null $level = null): bool
{
return $this->hasRecordThatPasses(static function ($rec) use ($regex) {
return \preg_match($regex, $rec['message']) > 0;
return \preg_match($regex, (string) $rec['message']) > 0;
}, $level);
}

Expand Down

0 comments on commit b36384d

Please sign in to comment.