MediaWiki  master
DeprecatedGlobal.php
Go to the documentation of this file.
1 <?php
24 
30  protected $version;
31 
37  public function __construct( $name, $callback, $version = false ) {
38  parent::__construct( $name, $callback );
39  $this->version = $version;
40  }
41 
42  // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
43  public function _newObject() {
44  /*
45  * Put the caller offset for wfDeprecated as 6, as
46  * that gives the function that uses this object, since:
47  *
48  * 1 = this function ( _newObject )
49  * 2 = MediaWiki\StubObject\StubObject::_unstub
50  * 3 = MediaWiki\StubObject\StubObject::_call
51  * 4 = MediaWiki\StubObject\StubObject::__call
52  * 5 = MediaWiki\StubObject\DeprecatedGlobal::<method of global called>
53  * 6 = Actual function using the global.
54  * (the same applies to _get/__get or _set/__set instead of _call/__call)
55  *
56  * Of course its theoretically possible to have other call
57  * sequences for this method, but that seems to be
58  * rather unlikely.
59  */
60  wfDeprecated( '$' . $this->global, $this->version, false, 6 );
61  return parent::_newObject();
62  }
63 }
64 
65 class_alias( DeprecatedGlobal::class, 'DeprecatedGlobal' );
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Logs a warning that a deprecated feature was used.
Class to allow throwing wfDeprecated warnings when people use globals that we do not want them to.
__construct( $name, $callback, $version=false)
_newObject()
Create a new object to replace this stub object.
Class to implement stub globals, which are globals that delay loading the their associated module cod...
Definition: StubObject.php:55