Skip to content

Commit fd3aabb

Browse files
committed
Better __debugInfo
1 parent f5531d1 commit fd3aabb

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/Discord/Builders/Components/Button.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@ public function jsonSerialize(): array
652652
public function __debugInfo(): array
653653
{
654654
$vars = get_object_vars($this);
655+
$vars['class'] = $this::class;
655656
unset($vars['discord']);
656657
if (isset($vars['listener'])) {
657658
$vars['listener'] = 'object(Closure)';

src/Discord/Parts/Part.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ abstract class Part implements PartInterface, ArrayAccess, JsonSerializable
112112
public function __debugInfo(): array
113113
{
114114
$vars = get_object_vars($this);
115+
$vars['class'] = $this::class;
115116
unset(
116117
$vars['http'],
117118
$vars['factory'],

src/Discord/Repository/AbstractRepository.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,24 @@ public function __construct(protected $discord, array $vars = [])
7070
$this->cache = new LegacyCacheWrapper($discord, $this->items, $this->class);
7171
}
7272
}
73+
74+
/** @return array */
75+
public function __debugInfo(): array
76+
{
77+
$vars = get_object_vars($this);
78+
$vars['class'] = $this::class;
79+
unset(
80+
$vars['http'],
81+
$vars['factory'],
82+
$vars['discord'],
83+
$vars['visible'],
84+
$vars['hidden'],
85+
$vars['repositories'],
86+
$vars['repositories_cache'],
87+
$vars['fillable'],
88+
$vars['scriptData']
89+
);
90+
91+
return $vars;
92+
}
7393
}

0 commit comments

Comments
 (0)