MediaWiki
REL1_39
JsonUnserializableTrait.php
Go to the documentation of this file.
1
<?php
22
namespace
MediaWiki\Json
;
23
24
trait JsonUnserializableTrait {
25
26
public
function
jsonSerialize(): array {
27
return
$this->annotateJsonForDeserialization(
28
$this->toJsonArray()
29
);
30
}
31
38
private
function
annotateJsonForDeserialization( array $json ): array {
39
$json[
JsonConstants::TYPE_ANNOTATION
] = get_class( $this );
40
return
$json;
41
}
42
49
abstract
protected
function
toJsonArray(): array;
50
}
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
includes
json
JsonUnserializableTrait.php
Generated on Mon Nov 25 2024 06:55:49 for MediaWiki by
1.10.0