Proper class type for DataMw

Slowly inch toward replacing the plethora of `stdClass` in the
Parsoid port with proper types.  The new classes could use additional
documentation of the various properties, but this is a start.

Bug: T226428
Change-Id: I87e73243203145b4067e70b0fa9e30da054fe1ed
This commit is contained in:
C. Scott Ananian 2023-07-21 17:48:28 -04:00
parent 4ed31f499e
commit dadeca74b5

View file

@ -15,6 +15,7 @@ use Wikimedia\Parsoid\Ext\ExtensionTagHandler;
use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI;
use Wikimedia\Parsoid\Ext\PHPUtils;
use Wikimedia\Parsoid\Ext\WTUtils;
use Wikimedia\Parsoid\NodeData\DataMw;
use Wikimedia\Parsoid\NodeData\DataParsoid;
use Wikimedia\Parsoid\Utils\DOMCompat;
@ -81,10 +82,10 @@ class References extends ExtensionTagHandler {
'typeof' => 'mw:Extension/references',
'about' => $extApi->newAboutId()
] );
$dataMw = (object)[
$dataMw = new DataMw( [
'name' => 'references',
'attrs' => new stdClass
];
] );
// Dont emit empty keys
if ( $refsOpts['group'] ) {
$dataMw->attrs->group = $refsOpts['group'];