30use Wikimedia\ObjectFactory\ObjectFactory;
78 if ( is_callable(
$class ) ) {
94 return is_object( $obj ) && !$obj instanceof
self;
106 if ( $obj instanceof
self ) {
107 $obj = $obj->_unstub(
'unstub', 3 );
123 public function _call( $name, $args ) {
125 return call_user_func_array( [ $GLOBALS[$this->global], $name ], $args );
140 return ObjectFactory::getObjectFromSpec(
$params + [
141 'args' => $this->params,
142 'closure_expansion' =>
false,
155 return $this->
_call( $name, $args );
165 public function _get( $name ) {
166 $this->
_unstub(
"__get($name)", 5 );
178 return $this->
_get( $name );
188 public function _set( $name, $value ) {
189 $this->
_unstub(
"__set($name)", 5 );
200 public function __set( $name, $value ) {
201 $this->
_set( $name, $value );
217 public function _unstub( $name =
'_unstub', $level = 2 ) {
218 static $recursionLevel = 0;
220 if ( !$GLOBALS[$this->global] instanceof
self ) {
224 if ( get_class( $GLOBALS[$this->global] ) != $this->
class ) {
226 if ( ++$recursionLevel > 2 ) {
227 throw new MWException(
"Unstub loop detected on call of "
228 .
"\${$this->global}->$name from $caller\n" );
230 wfDebug(
"Unstubbing \${$this->global} on call of "
231 .
"\${$this->global}::$name from $caller" );
239class_alias( StubObject::class,
'StubObject' );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetCaller( $level=2)
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfG...