mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix ownerDocument type
This commit is contained in:
parent
04ba9358e3
commit
6aa2ddfe1c
@ -113,6 +113,7 @@ return [
|
|||||||
'formatOutput' => 'bool',
|
'formatOutput' => 'bool',
|
||||||
'implementation' => 'DOMImplementation',
|
'implementation' => 'DOMImplementation',
|
||||||
'lastElementChild' => 'DOMElement|null',
|
'lastElementChild' => 'DOMElement|null',
|
||||||
|
'ownerDocument' => 'null',
|
||||||
'preserveWhiteSpace' => 'bool',
|
'preserveWhiteSpace' => 'bool',
|
||||||
'recover' => 'bool',
|
'recover' => 'bool',
|
||||||
'resolveExternals' => 'bool',
|
'resolveExternals' => 'bool',
|
||||||
@ -173,7 +174,7 @@ return [
|
|||||||
'nodeName' => 'string',
|
'nodeName' => 'string',
|
||||||
'nodeType' => 'int',
|
'nodeType' => 'int',
|
||||||
'nodeValue' => 'string|null',
|
'nodeValue' => 'string|null',
|
||||||
'ownerDocument' => 'DOMDocument|null',
|
'ownerDocument' => 'DOMDocument',
|
||||||
'parentNode' => 'DOMNode|null',
|
'parentNode' => 'DOMNode|null',
|
||||||
'prefix' => 'string',
|
'prefix' => 'string',
|
||||||
'previousSibling' => 'DOMNode|null',
|
'previousSibling' => 'DOMNode|null',
|
||||||
|
@ -154,7 +154,7 @@ class DOMNode
|
|||||||
*/
|
*/
|
||||||
public ?DOMNamedNodeMap $attributes;
|
public ?DOMNamedNodeMap $attributes;
|
||||||
/** @readonly */
|
/** @readonly */
|
||||||
public ?DOMDocument $ownerDocument;
|
public DOMDocument $ownerDocument;
|
||||||
/** @readonly */
|
/** @readonly */
|
||||||
public ?string $namespaceURI;
|
public ?string $namespaceURI;
|
||||||
public string $prefix;
|
public string $prefix;
|
||||||
@ -242,7 +242,7 @@ class DOMNameSpaceNode
|
|||||||
/** @readonly */
|
/** @readonly */
|
||||||
public ?string $namespaceURI;
|
public ?string $namespaceURI;
|
||||||
/** @readonly */
|
/** @readonly */
|
||||||
public ?DOMDocument $ownerDocument;
|
public DOMDocument $ownerDocument;
|
||||||
/** @readonly */
|
/** @readonly */
|
||||||
public ?DOMNode $parentNode;
|
public ?DOMNode $parentNode;
|
||||||
}
|
}
|
||||||
@ -281,6 +281,8 @@ class DOMDocument extends DOMNode implements DOMParentNode
|
|||||||
public DOMImplementation $implementation;
|
public DOMImplementation $implementation;
|
||||||
/** @readonly */
|
/** @readonly */
|
||||||
public ?DOMElement $documentElement;
|
public ?DOMElement $documentElement;
|
||||||
|
/** @readonly */
|
||||||
|
public null $ownerDocument;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
@ -424,6 +424,20 @@ class CoreStubsTest extends TestCase
|
|||||||
$globBrace = glob('abc', GLOB_BRACE);
|
$globBrace = glob('abc', GLOB_BRACE);
|
||||||
PHP,
|
PHP,
|
||||||
];
|
];
|
||||||
|
yield "ownerDocument's type is non-nullable DOMDocument and always null on DOMDocument itself" => [
|
||||||
|
'code' => '<?php
|
||||||
|
$a = (new DOMDocument())->ownerDocument;
|
||||||
|
$b = (new DOMNode())->ownerDocument;
|
||||||
|
$c = (new DOMElement("p"))->ownerDocument;
|
||||||
|
$d = (new DOMNameSpaceNode())->ownerDocument;
|
||||||
|
',
|
||||||
|
'assertions' => [
|
||||||
|
'$a===' => 'null',
|
||||||
|
'$b===' => 'DOMDocument',
|
||||||
|
'$c===' => 'DOMDocument',
|
||||||
|
'$d===' => 'DOMDocument',
|
||||||
|
],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function providerInvalidCodeParse(): iterable
|
public function providerInvalidCodeParse(): iterable
|
||||||
|
@ -718,7 +718,7 @@ class PropertyTypeTest extends TestCase
|
|||||||
$a = new DOMElement("foo");
|
$a = new DOMElement("foo");
|
||||||
$owner = $a->ownerDocument;',
|
$owner = $a->ownerDocument;',
|
||||||
'assertions' => [
|
'assertions' => [
|
||||||
'$owner' => 'DOMDocument|null',
|
'$owner' => 'DOMDocument',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'propertyMapHydration' => [
|
'propertyMapHydration' => [
|
||||||
|
Loading…
Reference in New Issue
Block a user