MediaWiki master
DeprecatedGlobal.php
Go to the documentation of this file.
1<?php
2
3// phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintReturn
4// phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
5
14
21 protected $version;
22
28 public function __construct( $name, $callback, $version = false ) {
29 parent::__construct( $name, $callback );
30 $this->version = $version;
31 }
32
36 public function _newObject() {
37 /*
38 * Put the caller offset for wfDeprecated as 6, as
39 * that gives the function that uses this object, since:
40 *
41 * 1 = this function ( _newObject )
42 * 2 = MediaWiki\StubObject\StubObject::_unstub
43 * 3 = MediaWiki\StubObject\StubObject::_call
44 * 4 = MediaWiki\StubObject\StubObject::__call
45 * 5 = MediaWiki\StubObject\DeprecatedGlobal::<method of global called>
46 * 6 = Actual function using the global.
47 * (the same applies to _get/__get or _set/__set instead of _call/__call)
48 *
49 * Of course its theoretically possible to have other call
50 * sequences for this method, but that seems to be
51 * rather unlikely.
52 */
53 wfDeprecated( '$' . $this->global, $this->version, false, 6 );
54 return parent::_newObject();
55 }
56}
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)
Class to implement stub globals, which are globals that delay loading the their associated module cod...