mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
Assorted fixes after running PHP parser tests in different modes
* Fixes crashers, notices emitted during parser test runs. Change-Id: I0e337f22594f6cd36a7dff21afaa7a9dc9c862cf
This commit is contained in:
parent
d76ac30440
commit
8757e89e21
|
@ -3,7 +3,6 @@ declare( strict_types = 1 );
|
|||
|
||||
namespace Parsoid\Ext\Cite;
|
||||
|
||||
use DOMDocument;
|
||||
use DOMElement;
|
||||
use DOMNode;
|
||||
use Exception;
|
||||
|
@ -22,12 +21,12 @@ use Parsoid\Utils\WTUtils;
|
|||
class Ref extends ExtensionTag {
|
||||
|
||||
/** @inheritDoc */
|
||||
public function toDOM( ParsoidExtensionAPI $extApi, string $txt, array $extExtArgs ): DOMDocument {
|
||||
public function toDOM( ParsoidExtensionAPI $extApi, string $txt, array $extExtArgs ) {
|
||||
// Drop nested refs entirely, unless we've explicitly allowed them
|
||||
if ( ( $extApi->parseContext['extTag'] ?? null ) === 'ref' &&
|
||||
empty( $extApi->parseContext['extTagOpts']['allowNestedRef'] )
|
||||
) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// The one supported case for nested refs is from the {{#tag:ref}} parser
|
||||
|
|
|
@ -138,7 +138,7 @@ class References extends ExtensionTag {
|
|||
// FIXME(SSS): Need to clarify semantics here.
|
||||
// If both the containing <references> elt as well as the nested <ref>
|
||||
// elt has a group attribute, what takes precedence?
|
||||
$group = $refDmw->attrs->group ?? $referencesGroup ?? null;
|
||||
$group = $refDmw->attrs->group ?? $referencesGroup ?? '';
|
||||
$refName = $refDmw->attrs->name ?? '';
|
||||
$ref = $refsData->add( $env, $group, $refName, $about, $nestedInReferences );
|
||||
|
||||
|
|
Loading…
Reference in a new issue