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:
Subramanya Sastry 2019-07-14 17:50:49 -05:00
parent d76ac30440
commit 8757e89e21
2 changed files with 3 additions and 4 deletions

View file

@ -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

View file

@ -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 );