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
17 lines
344 B
PHP
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 );
|
|
}
|
|
}
|