Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6100028
JsonSerializableCodec.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
JsonSerializableCodec.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
* @ingroup Json
*/
namespace
MediaWiki\Json
;
use
JsonException
;
use
JsonSerializable
;
use
Wikimedia\JsonCodec\JsonClassCodec
;
/**
* A JsonClassCodec for objects implementing the JsonSerializable interface.
*
* NOTE that this is for compatibility only and does NOT deserialize!
*
* @see JsonSerializable
* @see JsonClassCodec
* @since 1.43
* @internal
*/
class
JsonSerializableCodec
implements
JsonClassCodec
{
/** @inheritDoc */
public
function
toJsonArray
(
$obj
):
array
{
return
$obj
->
jsonSerialize
();
}
/** @return never */
public
function
newFromJsonArray
(
string
$className
,
array
$json
):
never
{
throw
new
JsonException
(
"Cannot deserialize: {$className}"
);
}
/** @inheritDoc */
public
function
jsonClassHintFor
(
string
$className
,
string
$keyName
)
{
return
null
;
}
public
static
function
getInstance
():
JsonSerializableCodec
{
static
$instance
=
null
;
if
(
$instance
===
null
)
{
$instance
=
new
JsonSerializableCodec
();
}
return
$instance
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 6 2026, 07:29 (6 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
82/03/ef9b479415d5449eab84c00db301
Default Alt Text
JsonSerializableCodec.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment