Skip to content

Commit

Permalink
Remove @anonymous postfix (#116)
Browse files Browse the repository at this point in the history
* Remove @anonymous postfix

* Add changelog

* Rename method
  • Loading branch information
xepozz authored Jul 1, 2024
1 parent a960ba5 commit 18d3707
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 3.2.2 under development

- Enh #116: Remove @anonymous postfix (@xepozz)
- Bug #114: Stop `click` event on text selection (@xepozz)
- Enh #114: Show full argument by click (@xepozz)
- Enh #113: Simplify error log (@xepozz)
Expand Down
9 changes: 8 additions & 1 deletion src/Renderer/HtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public function argumentsToString(array $args, bool $truncate = true): string
}

if (is_object($value)) {
$args[$key] = '<span class="title">' . $this->htmlEncode($value::class) . '</span>';
$args[$key] = '<span class="title">' . $this->htmlEncode($this->removeAnonymous($value::class)) . '</span>';
} elseif (is_bool($value)) {
$args[$key] = '<span class="keyword">' . ($value ? 'true' : 'false') . '</span>';
} elseif (is_string($value)) {
Expand Down Expand Up @@ -622,4 +622,11 @@ private function getVendorPaths(): array
$this->vendorPaths = [];
return $this->vendorPaths;
}

public function removeAnonymous(string $value): string
{
$anonymousPosition = strpos($value, '@anonymous');

return $anonymousPosition !== false ? substr($value, 0, $anonymousPosition) : $value;
}
}
2 changes: 1 addition & 1 deletion templates/_call-stack-item.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<span class="function-info">
<?php
echo $file === null ? "{$index}." : '&mdash;&nbsp;';
$function = $class === null ? $function : "$class::$function";
$function = $class === null ? $function : "{$this->removeAnonymous($class)}::$function";

echo '<span class="function">' . $this->htmlEncode($function) . '</span>';
echo '<span class="arguments">(';
Expand Down

0 comments on commit 18d3707

Please sign in to comment.