Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix properties for XML-related classes #1526

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 1 addition & 91 deletions dom/dom_c.php
Original file line number Diff line number Diff line change
Expand Up @@ -1299,96 +1299,6 @@ public function count(): int {}
public function getIterator(): Iterator {}
}

/**
* The DOMNamedNodeMap class
* @link https://php.net/manual/en/class.domnamednodemap.php
* @property-read int $length The number of nodes in the map. The range of valid child node indices is 0 to length - 1 inclusive.
*/
class DOMNamedNodeMap implements IteratorAggregate, Countable
{
/**
* Retrieves a node specified by name
* @link https://php.net/manual/en/domnamednodemap.getnameditem.php
* @param string $qualifiedName <p>
* The nodeName of the node to retrieve.
* </p>
* @return DOMNode|null A node (of any type) with the specified nodeName, or
* null if no node is found.
*/
#[TentativeType]
public function getNamedItem(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $qualifiedName): ?DOMNode {}

/**
* @param DOMNode $arg
*/
public function setNamedItem(DOMNode $arg) {}

/**
* @param $name [optional]
*/
public function removeNamedItem($name) {}

/**
* Retrieves a node specified by index
* @link https://php.net/manual/en/domnamednodemap.item.php
* @param int $index <p>
* Index into this map.
* </p>
* @return DOMNode|null The node at the indexth position in the map, or null
* if that is not a valid index (greater than or equal to the number of nodes
* in this map).
*/
#[TentativeType]
public function item(
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.0')] $index = 0,
#[PhpStormStubsElementAvailable(from: '7.1')] #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $index
): ?DOMNode {}

/**
* Retrieves a node specified by local name and namespace URI
* @link https://php.net/manual/en/domnamednodemap.getnameditemns.php
* @param string $namespace <p>
* The namespace URI of the node to retrieve.
* </p>
* @param string $localName <p>
* The local name of the node to retrieve.
* </p>
* @return DOMNode|null A node (of any type) with the specified local name and namespace URI, or
* null if no node is found.
*/
#[TentativeType]
public function getNamedItemNS(
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.4')] $namespaceURI = '',
#[PhpStormStubsElementAvailable(from: '8.0')] ?string $namespace,
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.4')] $localName = '',
#[PhpStormStubsElementAvailable(from: '8.0')] string $localName
): ?DOMNode {}

/**
* @param DOMNode $arg [optional]
*/
public function setNamedItemNS(DOMNode $arg) {}

/**
* @param $namespace [optional]
* @param $localName [optional]
*/
public function removeNamedItemNS($namespace, $localName) {}

/**
* @return int<0,max>
* @since 7.2
*/
#[TentativeType]
public function count(): int {}

/**
* @return Iterator
* @since 8.0
*/
public function getIterator(): Iterator {}
}

/**
* The DOMCharacterData class represents nodes with character data.
* No nodes directly correspond to this class, but other nodes do inherit from it.
Expand Down Expand Up @@ -2157,7 +2067,7 @@ class DOMDocumentType extends DOMNode

/**
* @var DOMNamedNodeMap
* A <clasname>DOMNamedNodeMap</classname> containing the notations declared in the DTD.
* A <classname>DOMNamedNodeMap</classname> containing the notations declared in the DTD.
* @link https://php.net/manual/en/class.domdocumenttype.php#domdocumenttype.props.notations
*/
#[LanguageLevelTypeAware(['8.1' => 'DOMNamedNodeMap'], default: '')]
Expand Down
120 changes: 120 additions & 0 deletions dom/dom_domnamednodemap_81.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?php

use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware;
use JetBrains\PhpStorm\Internal\PhpStormStubsElementAvailable;
use JetBrains\PhpStorm\Internal\TentativeType;

/**
* The DOMNamedNodeMap class
* @link https://php.net/manual/en/class.domnamednodemap.php
* @see https://github.com/JetBrains/phpstorm-stubs/pull/1526#issuecomment-1419394807
*
* @since 8.1
*/
class DOMNamedNodeMap implements IteratorAggregate, Countable
{
/**
* The number of nodes in the map. The range of valid child node indices is 0 to length - 1 inclusive.
* @var int
* @readonly
*/
public $length;

/**
* Retrieves a node specified by name
* @link https://php.net/manual/en/domnamednodemap.getnameditem.php
* @param string $qualifiedName <p>
* The nodeName of the node to retrieve.
* </p>
* @return DOMNode|null A node (of any type) with the specified nodeName, or
* null if no node is found.
*/
#[TentativeType]
public function getNamedItem(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $qualifiedName): ?DOMNode
{
}

/**
* @param DOMNode $arg
*/
public function setNamedItem(DOMNode $arg)
{
}

/**
* @param $name [optional]
*/
public function removeNamedItem($name)
{
}

/**
* Retrieves a node specified by index
* @link https://php.net/manual/en/domnamednodemap.item.php
* @param int $index <p>
* Index into this map.
* </p>
* @return DOMNode|null The node at the indexth position in the map, or null
* if that is not a valid index (greater than or equal to the number of nodes
* in this map).
*/
#[TentativeType]
public function item(
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.0')] $index = 0,
#[PhpStormStubsElementAvailable(from: '7.1')] #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $index
): ?DOMNode {
}

/**
* Retrieves a node specified by local name and namespace URI
* @link https://php.net/manual/en/domnamednodemap.getnameditemns.php
* @param string $namespace <p>
* The namespace URI of the node to retrieve.
* </p>
* @param string $localName <p>
* The local name of the node to retrieve.
* </p>
* @return DOMNode|null A node (of any type) with the specified local name and namespace URI, or
* null if no node is found.
*/
#[TentativeType]
public function getNamedItemNS(
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.4')] $namespaceURI = '',
#[PhpStormStubsElementAvailable(from: '8.0')] ?string $namespace,
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.4')] $localName = '',
#[PhpStormStubsElementAvailable(from: '8.0')] string $localName
): ?DOMNode {
}

/**
* @param DOMNode $arg [optional]
*/
public function setNamedItemNS(DOMNode $arg)
{
}

/**
* @param $namespace [optional]
* @param $localName [optional]
*/
public function removeNamedItemNS($namespace, $localName)
{
}

/**
* @return int<0,max>
* @since 7.2
*/
#[TentativeType]
public function count(): int
{
}

/**
* @return Iterator
* @since 8.0
*/
public function getIterator(): Iterator
{
}
}
116 changes: 116 additions & 0 deletions dom/dom_domnamednodemap_pre81.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?php

use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware;
use JetBrains\PhpStorm\Internal\PhpStormStubsElementAvailable;
use JetBrains\PhpStorm\Internal\TentativeType;

/**
* The DOMNamedNodeMap class
* @link https://php.net/manual/en/class.domnamednodemap.php
* @see https://github.com/JetBrains/phpstorm-stubs/pull/1526#issuecomment-1419394807
*
* @since 5.3
* @removed 8.1
*
* @property-read int $length The number of nodes in the map. The range of valid child node indices is 0 to length - 1 inclusive.
*/
class DOMNamedNodeMap implements IteratorAggregate, Countable
{
/**
* Retrieves a node specified by name
* @link https://php.net/manual/en/domnamednodemap.getnameditem.php
* @param string $qualifiedName <p>
* The nodeName of the node to retrieve.
* </p>
* @return DOMNode|null A node (of any type) with the specified nodeName, or
* null if no node is found.
*/
#[TentativeType]
public function getNamedItem(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $qualifiedName): ?DOMNode
{
}

/**
* @param DOMNode $arg
*/
public function setNamedItem(DOMNode $arg)
{
}

/**
* @param $name [optional]
*/
public function removeNamedItem($name)
{
}

/**
* Retrieves a node specified by index
* @link https://php.net/manual/en/domnamednodemap.item.php
* @param int $index <p>
* Index into this map.
* </p>
* @return DOMNode|null The node at the indexth position in the map, or null
* if that is not a valid index (greater than or equal to the number of nodes
* in this map).
*/
#[TentativeType]
public function item(
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.0')] $index = 0,
#[PhpStormStubsElementAvailable(from: '7.1')] #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $index
): ?DOMNode {
}

/**
* Retrieves a node specified by local name and namespace URI
* @link https://php.net/manual/en/domnamednodemap.getnameditemns.php
* @param string $namespace <p>
* The namespace URI of the node to retrieve.
* </p>
* @param string $localName <p>
* The local name of the node to retrieve.
* </p>
* @return DOMNode|null A node (of any type) with the specified local name and namespace URI, or
* null if no node is found.
*/
#[TentativeType]
public function getNamedItemNS(
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.4')] $namespaceURI = '',
#[PhpStormStubsElementAvailable(from: '8.0')] ?string $namespace,
#[PhpStormStubsElementAvailable(from: '5.3', to: '7.4')] $localName = '',
#[PhpStormStubsElementAvailable(from: '8.0')] string $localName
): ?DOMNode {
}

/**
* @param DOMNode $arg [optional]
*/
public function setNamedItemNS(DOMNode $arg)
{
}

/**
* @param $namespace [optional]
* @param $localName [optional]
*/
public function removeNamedItemNS($namespace, $localName)
{
}

/**
* @return int<0,max>
* @since 7.2
*/
#[TentativeType]
public function count(): int
{
}

/**
* @return Iterator
* @since 8.0
*/
public function getIterator(): Iterator
{
}
}
Loading