Debian Codegraph @

tests/phpunit/includes/debug/TestDeprecatedClass.php

raw symbols SCIP
1 <?php
2
3 use MediaWiki\Debug\DeprecationHelper;
4
5 #[\AllowDynamicProperties]
6 class TestDeprecatedClass {
7
8 use DeprecationHelper;
9
10 /** @var int */
11 protected $protectedDeprecated = 1;
12 /** @var int */
13 protected $protectedNonDeprecated = 1;
14 /** @var int */
15 private $privateDeprecated = 1;
16 /** @var int */
17 private $privateNonDeprecated = 1;
18 /** @var int */
19 private $fallbackDeprecated = 1;
20
21 /** @var string */
22 private $foo = 'FOO';
23
24 public function __construct() {
25 $this->deprecatePublicProperty( 'protectedDeprecated', '1.23' );
26 $this->deprecatePublicProperty( 'privateDeprecated', '1.24' );
27
28 $this->deprecatePublicPropertyFallback( 'fallbackDeprecated', '1.25',
29 function () {
30 return $this->fallbackDeprecated;
31 },
32 function ( $value ) {
33 $this->fallbackDeprecated = $value;
34 }
35 );
36 $this->deprecatePublicPropertyFallback( 'fallbackDeprecatedMethodName', '1.26',
37 'getFoo',
38 'setFoo'
39 );
40 $this->deprecatePublicPropertyFallback( 'fallbackGetterOnly', '1.25',
41 static function () {
42 return 1;
43 }
44 );
45 }
46
47 public function setThings( $prod, $prond, $prid, $prind ) {
48 $this->protectedDeprecated = $prod;
49 $this->protectedNonDeprecated = $prond;
50 $this->privateDeprecated = $prid;
51 $this->privateNonDeprecated = $prind;
52 }
53
54 public function getThings() {
55 return [
56 'prod' => $this->protectedDeprecated,
57 'prond' => $this->protectedNonDeprecated,
58 'prid' => $this->privateDeprecated,
59 'prind' => $this->privateNonDeprecated,
60 ];
61 }
62
63 public function getFoo() {
64 return $this->foo;
65 }
66
67 public function setFoo( $foo ) {
68 $this->foo = $foo;
69 }
70 }