wiki.techinc.nl/includes/libs/DebugInfo/DebugInfoTrait.php
Tim Starling 94e20db64b Add some helpers to filter properties out of var_dump()
Dumping many kinds of object with var_dump() leads to dumping the whole
address space, because a chain of references leads to MediaWikiServices.

So, introduce a trait which replaces the problematic properties with a
placeholder, if their doc comment contains @noVarDump.

Bug: T277618
Change-Id: Ifa685c26fbc5317d0359544289ec3f433ec4fedf
2022-10-12 12:42:23 -04:00

17 lines
344 B
PHP

<?php
namespace Wikimedia\DebugInfo;
/**
* A trait for automatic __debugInfo() modifications.
*
* Recursion into properties is prevented if they have a @noVarDump annotation
* in their doc comment. See T277618.
*
* @since 1.40
*/
trait DebugInfoTrait {
public function __debugInfo() {
return DumpUtils::objectToArray( $this );
}
}