2020-11-05 17:04:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
2024-02-16 22:07:23 +00:00
|
|
|
namespace Wikimedia\Tests\Reflection;
|
|
|
|
|
|
|
|
|
|
use Wikimedia\Reflection\GhostFieldAccessTrait;
|
2024-04-24 04:42:59 +00:00
|
|
|
use Wikimedia\Reflection\GhostFieldTestClass as OldGhostFieldTestClass;
|
2020-11-05 17:04:37 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This class used to contain a $privateField, $protectedField and $publicField.
|
|
|
|
|
* This is used to test that unserialized instances still have the values of
|
|
|
|
|
* these ghost fields and the values can be accessed with GhostFieldAccessTrait.
|
2024-02-16 22:07:23 +00:00
|
|
|
*
|
2020-11-05 17:04:37 +00:00
|
|
|
*/
|
2023-01-06 02:04:49 +00:00
|
|
|
#[\AllowDynamicProperties]
|
2020-11-05 17:04:37 +00:00
|
|
|
class GhostFieldTestClass {
|
|
|
|
|
use GhostFieldAccessTrait;
|
|
|
|
|
|
|
|
|
|
public function getPrivateField() {
|
2024-04-24 04:42:59 +00:00
|
|
|
return $this->getGhostFieldValue( 'privateField', OldGhostFieldTestClass::class );
|
2020-11-05 17:04:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getProtectedField() {
|
|
|
|
|
return $this->getGhostFieldValue( 'protectedField' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getPublicField() {
|
|
|
|
|
return $this->getGhostFieldValue( 'publicField' );
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-24 04:42:59 +00:00
|
|
|
// Do not delete this alias; it is needed for GhostFieldAccessTraitTest
|
|
|
|
|
class_alias( GhostFieldTestClass::class, 'Wikimedia\\Reflection\\GhostFieldTestClass' );
|