3 * Class to allow throwing wfDeprecated warnings
4 * when people use globals that we do not want them to.
5 * (For example like $wgArticle)
8 class DeprecatedGlobal
extends StubObject
{
9 // The m's are to stay consistent with parent class.
10 protected $mRealValue, $mVersion;
12 function __construct( $name, $realValue, $version = false ) {
13 parent
::__construct( $name );
14 $this->mRealValue
= $realValue;
15 $this->mVersion
= $version;
18 function _newObject() {
19 /* Put the caller offset for wfDeprecated as 6, as
20 * that gives the function that uses this object, since:
21 * 1 = this function ( _newObject )
22 * 2 = StubObject::_unstub
23 * 3 = StubObject::_call
24 * 4 = StubObject::__call
25 * 5 = DeprecatedGlobal::<method of global called>
26 * 6 = Actual function using the global.
27 * Of course its theoretically possible to have other call
28 * sequences for this method, but that seems to be
31 wfDeprecated( '$' . $this->mGlobal
, $this->mVersion
, false, 6 );
32 return $this->mRealValue
;