1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Suppress PHP 8.1 warnings "Return type mixed is not covariant with tentative return type mixed of method Iterator::key()"

Summary:
PHP 8.1 requires classes which implement `Iterator` to have all `Iterator` methods declared with appropriate return types or annotated with `#[\ReturnTypeWillChange]`. In my (limited) understanding we cannot declare return types while remaining backward-compatible, thus annotate.

Closes T15835

Test Plan: Run PHPStan static code analyzer, see no warnings anymore.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15835

Differential Revision: https://we.phorge.it/D25711
This commit is contained in:
Andre Klapper 2024-07-02 15:03:35 +02:00
parent 721d5ed64b
commit a110aa471e
5 changed files with 5 additions and 0 deletions

View file

@ -33,6 +33,7 @@ final class PhabricatorFactUpdateIterator extends PhutilBufferedIterator {
} }
} }
#[\ReturnTypeWillChange]
public function key() { public function key() {
return $this->getCursorFromObject($this->current()); return $this->getCursorFromObject($this->current());
} }

View file

@ -18,6 +18,7 @@ final class HarbormasterBuildLogChunkIterator
$this->cursor = $this->min; $this->cursor = $this->min;
} }
#[\ReturnTypeWillChange]
public function key() { public function key() {
return $this->current()->getID(); return $this->current()->getID();
} }

View file

@ -26,6 +26,7 @@ final class LiskMigrationIterator extends PhutilBufferedIterator {
$this->cursor = 0; $this->cursor = 0;
} }
#[\ReturnTypeWillChange]
public function key() { public function key() {
return $this->current()->getID(); return $this->current()->getID();
} }

View file

@ -16,6 +16,7 @@ final class LiskRawMigrationIterator extends PhutilBufferedIterator {
$this->cursor = 0; $this->cursor = 0;
} }
#[\ReturnTypeWillChange]
public function key() { public function key() {
return idx($this->current(), $this->column); return idx($this->current(), $this->column);
} }

View file

@ -18,6 +18,7 @@ final class PhabricatorQueryIterator extends PhutilBufferedIterator {
$this->pager = $pager; $this->pager = $pager;
} }
#[\ReturnTypeWillChange]
public function key() { public function key() {
return $this->current()->getID(); return $this->current()->getID();
} }