wiki.techinc.nl/tests/phpunit/includes/debug/TestDeprecatedClass.php
Umherirrender 41f6d9eee4 tests: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: Ifc27750207edc09e94af030d882b6f1a5369cf98
2024-09-18 17:25:42 +00:00

70 lines
1.6 KiB
PHP

<?php
use MediaWiki\Debug\DeprecationHelper;
#[\AllowDynamicProperties]
class TestDeprecatedClass {
use DeprecationHelper;
/** @var int */
protected $protectedDeprecated = 1;
/** @var int */
protected $protectedNonDeprecated = 1;
/** @var int */
private $privateDeprecated = 1;
/** @var int */
private $privateNonDeprecated = 1;
/** @var int */
private $fallbackDeprecated = 1;
/** @var string */
private $foo = 'FOO';
public function __construct() {
$this->deprecatePublicProperty( 'protectedDeprecated', '1.23' );
$this->deprecatePublicProperty( 'privateDeprecated', '1.24' );
$this->deprecatePublicPropertyFallback( 'fallbackDeprecated', '1.25',
function () {
return $this->fallbackDeprecated;
},
function ( $value ) {
$this->fallbackDeprecated = $value;
}
);
$this->deprecatePublicPropertyFallback( 'fallbackDeprecatedMethodName', '1.26',
'getFoo',
'setFoo'
);
$this->deprecatePublicPropertyFallback( 'fallbackGetterOnly', '1.25',
static function () {
return 1;
}
);
}
public function setThings( $prod, $prond, $prid, $prind ) {
$this->protectedDeprecated = $prod;
$this->protectedNonDeprecated = $prond;
$this->privateDeprecated = $prid;
$this->privateNonDeprecated = $prind;
}
public function getThings() {
return [
'prod' => $this->protectedDeprecated,
'prond' => $this->protectedNonDeprecated,
'prid' => $this->privateDeprecated,
'prind' => $this->privateNonDeprecated,
];
}
public function getFoo() {
return $this->foo;
}
public function setFoo( $foo ) {
$this->foo = $foo;
}
}