From d649660de57de152f6a8d798ac93b1e40bcc2a89 Mon Sep 17 00:00:00 2001
From: Matthieu Marcillaud <marcimat@rezo.net>
Date: Tue, 14 Dec 2021 23:27:50 +0100
Subject: [PATCH] =?UTF-8?q?PHP=208.1=20#4968=20:=20Deprecated--=20les=20cl?=
 =?UTF-8?q?asses=20(ici=20d=E2=80=99it=C3=A9rateurs)=20qui=20=C3=A9tendent?=
 =?UTF-8?q?=20certaines=20m=C3=A9thodes=20doivent=20avoir=20une=20signatur?=
 =?UTF-8?q?e=20=C3=A9quivalente=20=C3=A0=20la=20m=C3=A9thode=20=C3=A9tendu?=
 =?UTF-8?q?e.=20On=20ne=20peut=20pas=20utiliser=20le=20type=20'mixed'=20(i?=
 =?UTF-8?q?ntroduit=20en=20PHP=208.0)=20en=20PHP=207.4=E2=80=A6=20donc=20#?=
 =?UTF-8?q?[\ReturnTypeWillChange]=20est=20temporairement=20utilis=C3=A9.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/iterateur/data.php   | 12 +++++++-----
 ecrire/iterateur/sql.php    | 14 ++++++++------
 ecrire/public/iterateur.php |  6 +++---
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/ecrire/iterateur/data.php b/ecrire/iterateur/data.php
index 0432a03d8e..55ddf530a2 100644
--- a/ecrire/iterateur/data.php
+++ b/ecrire/iterateur/data.php
@@ -125,7 +125,7 @@ class IterateurDATA implements Iterator {
 	 *
 	 * @return void
 	 */
-	public function rewind() {
+	public function rewind() : void {
 		reset($this->tableau);
 		$this->cle = key($this->tableau);
 		$this->valeur = current($this->tableau);
@@ -531,15 +531,16 @@ class IterateurDATA implements Iterator {
 	 *
 	 * @return bool
 	 */
-	public function valid() {
+	public function valid() : bool {
 		return !is_null($this->cle);
 	}
 
 	/**
 	 * Retourner la valeur
 	 *
-	 * @return null
+	 * @return mixed
 	 */
+	#[\ReturnTypeWillChange]
 	public function current() {
 		return $this->valeur;
 	}
@@ -547,8 +548,9 @@ class IterateurDATA implements Iterator {
 	/**
 	 * Retourner la cle
 	 *
-	 * @return null
+	 * @return mixed
 	 */
+	#[\ReturnTypeWillChange]
 	public function key() {
 		return $this->cle;
 	}
@@ -558,7 +560,7 @@ class IterateurDATA implements Iterator {
 	 *
 	 * @return void
 	 */
-	public function next() {
+	public function next() : void {
 		if ($this->valid()) {
 			$this->cle = key($this->tableau);
 			$this->valeur = current($this->tableau);
diff --git a/ecrire/iterateur/sql.php b/ecrire/iterateur/sql.php
index d8574e407d..907f24d587 100644
--- a/ecrire/iterateur/sql.php
+++ b/ecrire/iterateur/sql.php
@@ -105,10 +105,10 @@ class IterateurSQL implements Iterator {
 	 *
 	 * @return bool
 	 */
-	public function rewind() {
-		return ($this->pos > 0)
-			? $this->seek(0)
-			: true;
+	public function rewind() : void {
+		if ($this->pos > 0) {
+			$this->seek(0);
+		}
 	}
 
 	/**
@@ -116,7 +116,7 @@ class IterateurSQL implements Iterator {
 	 *
 	 * @return bool
 	 */
-	public function valid() {
+	public function valid() : bool {
 		if ($this->err) {
 			return false;
 		}
@@ -132,10 +132,12 @@ class IterateurSQL implements Iterator {
 	 *
 	 * @return array
 	 */
+	#[\ReturnTypeWillChange]
 	public function current() {
 		return $this->row;
 	}
 
+	#[\ReturnTypeWillChange]
 	public function key() {
 		return $this->pos;
 	}
@@ -172,7 +174,7 @@ class IterateurSQL implements Iterator {
 	 *
 	 * @return void
 	 */
-	public function next() {
+	public function next() : void {
 		$this->row = sql_fetch($this->sqlresult, $this->command['connect']);
 		$this->pos++;
 		$this->firstseek |= true;
diff --git a/ecrire/public/iterateur.php b/ecrire/public/iterateur.php
index 37fc20e045..e468bd5d8e 100644
--- a/ecrire/public/iterateur.php
+++ b/ecrire/public/iterateur.php
@@ -443,7 +443,7 @@ class IterDecorator extends FilterIterator {
 	}
 
 
-	public function next() {
+	public function next() : void {
 		$this->pos++;
 		parent::next();
 	}
@@ -453,7 +453,7 @@ class IterDecorator extends FilterIterator {
 	 *
 	 * @return void
 	 */
-	public function rewind() {
+	public function rewind() : void {
 		$this->pos = 0;
 		$this->fetched = 0;
 		parent::rewind();
@@ -635,7 +635,7 @@ class IterDecorator extends FilterIterator {
 	 * Accepte-t-on l'entree courante lue ?
 	 * On execute les filtres pour le savoir.
 	 **/
-	public function accept() {
+	public function accept() : bool {
 		if ($f = $this->func_filtre) {
 			return $f();
 		}
-- 
GitLab