MediaWiki
REL1_37
JsonUnserializableTrait.php
Go to the documentation of this file.
1
<?php
22
namespace
MediaWiki\Json
;
23
24
trait
JsonUnserializableTrait
{
25
26
#[\ReturnTypeWillChange]
27
public
function
jsonSerialize() {
28
return
$this->annotateJsonForDeserialization(
29
$this->toJsonArray()
30
);
31
}
32
39
private
function
annotateJsonForDeserialization( array $json ): array {
40
$json[
JsonConstants::TYPE_ANNOTATION
] = get_class( $this );
41
return
$json;
42
}
43
50
abstract
protected
function
toJsonArray(): array;
51
}
MediaWiki\Json\JsonConstants\TYPE_ANNOTATION
const TYPE_ANNOTATION
Name of the property where the class information is stored.
Definition
JsonConstants.php:34
MediaWiki\Json
Definition
JsonCodec.php:22
MediaWiki\Json\JsonUnserializableTrait
trait JsonUnserializableTrait
Definition
JsonUnserializableTrait.php:24
includes
json
JsonUnserializableTrait.php
Generated on Fri Apr 5 2024 23:40:24 for MediaWiki by
1.9.8