Skip to content

Commit

Permalink
Expand code a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jun 28, 2024
1 parent 4bfbba8 commit b56faa6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Monolog/LogRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ public function offsetUnset(mixed $offset): void

public function &offsetGet(mixed $offset): mixed
{
if ($offset === 'level_name' || $offset === 'level') {
// handle special cases for the level enum
if ($offset === 'level_name') {
// avoid returning readonly props by ref as this is illegal
if ($offset === 'level_name') {
$copy = $this->level->getName();
} else {
$copy = $this->level->value;
}
$copy = $this->level->getName();

return $copy;
}
if ($offset === 'level') {
// avoid returning readonly props by ref as this is illegal
$copy = $this->level->value;

return $copy;
}
Expand Down

0 comments on commit b56faa6

Please sign in to comment.