Skip to content

Commit 18d3707

Browse files
authored
Remove @anonymous postfix (#116)
* Remove @anonymous postfix * Add changelog * Rename method
1 parent a960ba5 commit 18d3707

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 3.2.2 under development
44

5+
- Enh #116: Remove @anonymous postfix (@xepozz)
56
- Bug #114: Stop `click` event on text selection (@xepozz)
67
- Enh #114: Show full argument by click (@xepozz)
78
- Enh #113: Simplify error log (@xepozz)

src/Renderer/HtmlRenderer.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public function argumentsToString(array $args, bool $truncate = true): string
302302
}
303303

304304
if (is_object($value)) {
305-
$args[$key] = '<span class="title">' . $this->htmlEncode($value::class) . '</span>';
305+
$args[$key] = '<span class="title">' . $this->htmlEncode($this->removeAnonymous($value::class)) . '</span>';
306306
} elseif (is_bool($value)) {
307307
$args[$key] = '<span class="keyword">' . ($value ? 'true' : 'false') . '</span>';
308308
} elseif (is_string($value)) {
@@ -622,4 +622,11 @@ private function getVendorPaths(): array
622622
$this->vendorPaths = [];
623623
return $this->vendorPaths;
624624
}
625+
626+
public function removeAnonymous(string $value): string
627+
{
628+
$anonymousPosition = strpos($value, '@anonymous');
629+
630+
return $anonymousPosition !== false ? substr($value, 0, $anonymousPosition) : $value;
631+
}
625632
}

templates/_call-stack-item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<span class="function-info">
3636
<?php
3737
echo $file === null ? "{$index}." : '&mdash;&nbsp;';
38-
$function = $class === null ? $function : "$class::$function";
38+
$function = $class === null ? $function : "{$this->removeAnonymous($class)}::$function";
3939

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

0 commit comments

Comments
 (0)