From 7ef26cf5f02308d30fbcb525bbb09cf456ca86d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Demonchaux?= Date: Mon, 13 Dec 2021 12:11:29 +0100 Subject: [PATCH 1/2] fix deprecation message for php 8.1 + drop php 7.3 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Demonchaux --- composer.json | 2 +- composer.lock | 4 ++-- src/Document/NodeList.php | 11 +++++++++++ src/NodeList.php | 11 +++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 23c1bb6..9867aad 100644 --- a/composer.json +++ b/composer.json @@ -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": "*" }, diff --git a/composer.lock b/composer.lock index a5ef642..c9a54cb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "629002840c5df2385995d1ec510b38f8", + "content-hash": "61ed005470be135ea8274a6185dadfc6", "packages": [], "packages-dev": [ { @@ -2451,7 +2451,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.3 || ~8.0.0 || ~8.1.0", + "php": "^7.4 || ~8.0.0 || ~8.1.0", "ext-dom": "*", "ext-libxml": "*" }, diff --git a/src/Document/NodeList.php b/src/Document/NodeList.php index 081d372..d343c5d 100644 --- a/src/Document/NodeList.php +++ b/src/Document/NodeList.php @@ -10,6 +10,7 @@ use DOMNodeList; use Iterator; use Laminas\Dom\Exception; +use ReturnTypeWillChange; /** * DOMNodeList wrapper for Laminas\Dom\Document\Query results @@ -39,6 +40,7 @@ public function __construct(DOMNodeList $list) * * @return DOMNode */ + #[ReturnTypeWillChange] public function rewind() { $this->position = 0; @@ -51,6 +53,7 @@ public function rewind() * * @return bool */ + #[ReturnTypeWillChange] public function valid() { return $this->offsetExists($this->position); @@ -61,6 +64,7 @@ public function valid() * * @return DOMNode */ + #[ReturnTypeWillChange] public function current() { return $this->list->item($this->position); @@ -71,6 +75,7 @@ public function current() * * @return int */ + #[ReturnTypeWillChange] public function key() { return $this->position; @@ -81,6 +86,7 @@ public function key() * * @return DOMNode */ + #[ReturnTypeWillChange] public function next() { ++$this->position; @@ -93,6 +99,7 @@ public function next() * * @return int */ + #[ReturnTypeWillChange] public function count() { return $this->list->length; @@ -104,6 +111,7 @@ public function count() * @param int $key * @return bool */ + #[ReturnTypeWillChange] public function offsetExists($key) { // DOMNodeList return `null` if item not exists. @@ -116,6 +124,7 @@ public function offsetExists($key) * @param int $key * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($key) { return $this->list->item($key); @@ -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'); @@ -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'); diff --git a/src/NodeList.php b/src/NodeList.php index 22059f2..84ef9ca 100644 --- a/src/NodeList.php +++ b/src/NodeList.php @@ -10,6 +10,7 @@ use DOMNode; use DOMNodeList; use Iterator; +use ReturnTypeWillChange; use function in_array; use function range; @@ -118,6 +119,7 @@ public function getContextNode() * * @return DOMNode */ + #[ReturnTypeWillChange] public function rewind() { $this->position = 0; @@ -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) { @@ -144,6 +147,7 @@ public function valid() * * @return DOMNode */ + #[ReturnTypeWillChange] public function current() { return $this->nodeList->item($this->position); @@ -154,6 +158,7 @@ public function current() * * @return int */ + #[ReturnTypeWillChange] public function key() { return $this->position; @@ -164,6 +169,7 @@ public function key() * * @return DOMNode */ + #[ReturnTypeWillChange] public function next() { ++$this->position; @@ -176,6 +182,7 @@ public function next() * * @return int */ + #[ReturnTypeWillChange] public function count() { return $this->nodeList->length; @@ -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) { @@ -201,6 +209,7 @@ public function offsetExists($key) * @param int $key * @return mixed */ + #[ReturnTypeWillChange] public function offsetGet($key) { return $this->nodeList->item($key); @@ -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'); @@ -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'); From fae3e5296a8aa14c2f1e75e2729516e86655d557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Demonchaux?= Date: Mon, 13 Dec 2021 15:51:12 +0100 Subject: [PATCH 2/2] Add attibut on phpunit.xml --- phpunit.xml.dist | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 93d33cc..01e7552 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,6 +2,9 @@