@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

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

+5
+1
src/applications/fact/extract/PhabricatorFactUpdateIterator.php
··· 33 33 } 34 34 } 35 35 36 + #[\ReturnTypeWillChange] 36 37 public function key() { 37 38 return $this->getCursorFromObject($this->current()); 38 39 }
+1
src/applications/harbormaster/storage/build/HarbormasterBuildLogChunkIterator.php
··· 18 18 $this->cursor = $this->min; 19 19 } 20 20 21 + #[\ReturnTypeWillChange] 21 22 public function key() { 22 23 return $this->current()->getID(); 23 24 }
+1
src/infrastructure/storage/lisk/LiskMigrationIterator.php
··· 26 26 $this->cursor = 0; 27 27 } 28 28 29 + #[\ReturnTypeWillChange] 29 30 public function key() { 30 31 return $this->current()->getID(); 31 32 }
+1
src/infrastructure/storage/lisk/LiskRawMigrationIterator.php
··· 16 16 $this->cursor = 0; 17 17 } 18 18 19 + #[\ReturnTypeWillChange] 19 20 public function key() { 20 21 return idx($this->current(), $this->column); 21 22 }
+1
src/infrastructure/storage/lisk/PhabricatorQueryIterator.php
··· 18 18 $this->pager = $pager; 19 19 } 20 20 21 + #[\ReturnTypeWillChange] 21 22 public function key() { 22 23 return $this->current()->getID(); 23 24 }