Skip to content

document of class DOMXPath constructor expects DOMDocument, DOMDocument|null given. in HasXPath:106 #99

@pscheit

Description

@pscheit
        if ($node instanceof \DOMDocument) {
            $xpathDocument = new \DOMXPath($node);

            return $xpathDocument->evaluate($this->_xpath);
        } else {
            $xpathDocument = new \DOMXPath($node->ownerDocument);

            return $xpathDocument->evaluate($this->_xpath, $node);
        }

This error is detected by phpstan and was written to the baseline in #88

 ------ ------------------------------------------------------------------------------------------------------------------------------------------
  Line   hamcrest/Hamcrest/Xml/HasXPath.php
 ------ ------------------------------------------------------------------------------------------------------------------------------------------
  106    Parameter #1 $document of class DOMXPath constructor expects DOMDocument, DOMDocument|null given.
         🪪  argument.type
         ✏️  hamcrest/Hamcrest/Xml/HasXPath.php
  120    Method Hamcrest\Xml\HasXPath::matchesContent() has parameter $nodes with generic class DOMNodeList but does not specify its types: TNode
         🪪  missingType.generics
         ✏️  hamcrest/Hamcrest/Xml/HasXPath.php
 ------ ------------------------------------------------------------------------------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions