Skip to content

Commit

Permalink
Update get-debug-type.xml (php#3703)
Browse files Browse the repository at this point in the history
Adds more examples to `get_debug_type` output in cases of anonymous classes that extend another class and/or implement an interface.
  • Loading branch information
patrickkusebauch authored Sep 11, 2024
1 parent 5499acf commit 3672010
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion reference/var/functions/get-debug-type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<row>
<entry>Objects from Anonymous Classes</entry>
<entry>
<literal>"class@anonymous"</literal>
<literal>"class@anonymous"</literal> or parent class name/interface name if the class extends another class or implements an interface e.g. <literal>"Foo\Bar@anonymous"</literal>
</entry>
<entry>
Anonymous classes are those created through the $x = new class { ... } syntax
Expand Down Expand Up @@ -157,6 +157,13 @@ echo get_debug_type($fp) . PHP_EOL;
echo get_debug_type(new stdClass) . PHP_EOL;
echo get_debug_type(new class {}) . PHP_EOL;
namespace Foo;
echo get_debug_type(new class implements A {}) . PHP_EOL;
echo get_debug_type(new class implements A,B {}) . PHP_EOL;
echo get_debug_type(new class extends C {}) . PHP_EOL;
echo get_debug_type(new class extends C implements A {}) . PHP_EOL;
?>
]]>
</programlisting>
Expand All @@ -173,6 +180,10 @@ resource (stream)
resource (closed)
stdClass
class@anonymous
Foo\A@anonymous
Foo\A@anonymous
Foo\C@anonymous
Foo\C@anonymous
]]>
</screen>
</example>
Expand Down

0 comments on commit 3672010

Please sign in to comment.