Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from fezfez/deprecation-message
Browse files Browse the repository at this point in the history
fix deprecation message for php 8.1 +  drop php 7.3 support
  • Loading branch information
Ocramius authored Dec 13, 2021
2 parents 30f37a2 + fae3e52 commit 5e8571a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
},
"require": {
"php": "^7.3 || ~8.0.0 || ~8.1.0",
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"ext-dom": "*",
"ext-libxml": "*"
},
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
colors="true">
<coverage processUncoveredFiles="true">
<include>
Expand Down
11 changes: 11 additions & 0 deletions src/Document/NodeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use DOMNodeList;
use Iterator;
use Laminas\Dom\Exception;
use ReturnTypeWillChange;

/**
* DOMNodeList wrapper for Laminas\Dom\Document\Query results
Expand Down Expand Up @@ -39,6 +40,7 @@ public function __construct(DOMNodeList $list)
*
* @return DOMNode
*/
#[ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
Expand All @@ -51,6 +53,7 @@ public function rewind()
*
* @return bool
*/
#[ReturnTypeWillChange]
public function valid()
{
return $this->offsetExists($this->position);
Expand All @@ -61,6 +64,7 @@ public function valid()
*
* @return DOMNode
*/
#[ReturnTypeWillChange]
public function current()
{
return $this->list->item($this->position);
Expand All @@ -71,6 +75,7 @@ public function current()
*
* @return int
*/
#[ReturnTypeWillChange]
public function key()
{
return $this->position;
Expand All @@ -81,6 +86,7 @@ public function key()
*
* @return DOMNode
*/
#[ReturnTypeWillChange]
public function next()
{
++$this->position;
Expand All @@ -93,6 +99,7 @@ public function next()
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return $this->list->length;
Expand All @@ -104,6 +111,7 @@ public function count()
* @param int $key
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists($key)
{
// DOMNodeList return `null` if item not exists.
Expand All @@ -116,6 +124,7 @@ public function offsetExists($key)
* @param int $key
* @return mixed
*/
#[ReturnTypeWillChange]
public function offsetGet($key)
{
return $this->list->item($key);
Expand All @@ -128,6 +137,7 @@ public function offsetGet($key)
* @param mixed $value
* @throws Exception\BadMethodCallException When attempting to write to a read-only item.
*/
#[ReturnTypeWillChange]
public function offsetSet($key, $value)
{
throw new Exception\BadMethodCallException('Attempting to write to a read-only list');
Expand All @@ -139,6 +149,7 @@ public function offsetSet($key, $value)
* @param mixed $key
* @throws Exception\BadMethodCallException When attempting to unset a read-only item.
*/
#[ReturnTypeWillChange]
public function offsetUnset($key)
{
throw new Exception\BadMethodCallException('Attempting to unset on a read-only list');
Expand Down
11 changes: 11 additions & 0 deletions src/NodeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use DOMNode;
use DOMNodeList;
use Iterator;
use ReturnTypeWillChange;

use function in_array;
use function range;
Expand Down Expand Up @@ -118,6 +119,7 @@ public function getContextNode()
*
* @return DOMNode
*/
#[ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
Expand All @@ -130,6 +132,7 @@ public function rewind()
*
* @return bool
*/
#[ReturnTypeWillChange]
public function valid()
{
if (in_array($this->position, range(0, $this->nodeList->length - 1)) && $this->nodeList->length > 0) {
Expand All @@ -144,6 +147,7 @@ public function valid()
*
* @return DOMNode
*/
#[ReturnTypeWillChange]
public function current()
{
return $this->nodeList->item($this->position);
Expand All @@ -154,6 +158,7 @@ public function current()
*
* @return int
*/
#[ReturnTypeWillChange]
public function key()
{
return $this->position;
Expand All @@ -164,6 +169,7 @@ public function key()
*
* @return DOMNode
*/
#[ReturnTypeWillChange]
public function next()
{
++$this->position;
Expand All @@ -176,6 +182,7 @@ public function next()
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
{
return $this->nodeList->length;
Expand All @@ -187,6 +194,7 @@ public function count()
* @param int $key
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists($key)
{
if (in_array($key, range(0, $this->nodeList->length - 1)) && $this->nodeList->length > 0) {
Expand All @@ -201,6 +209,7 @@ public function offsetExists($key)
* @param int $key
* @return mixed
*/
#[ReturnTypeWillChange]
public function offsetGet($key)
{
return $this->nodeList->item($key);
Expand All @@ -213,6 +222,7 @@ public function offsetGet($key)
* @param mixed $value
* @throws Exception\BadMethodCallException When attempting to write to a read-only item.
*/
#[ReturnTypeWillChange]
public function offsetSet($key, $value)
{
throw new Exception\BadMethodCallException('Attempting to write to a read-only list');
Expand All @@ -224,6 +234,7 @@ public function offsetSet($key, $value)
* @param mixed $key
* @throws Exception\BadMethodCallException When attempting to unset a read-only item.
*/
#[ReturnTypeWillChange]
public function offsetUnset($key)
{
throw new Exception\BadMethodCallException('Attempting to unset on a read-only list');
Expand Down

0 comments on commit 5e8571a

Please sign in to comment.