1
0
Fork 0

More php8.1 deprecation fixes, refs #10008

pull/10016/head
Jordi Boggiano 2021-07-22 11:48:30 +02:00
parent 47cf602f9e
commit a7efb27338
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
4 changed files with 15 additions and 2 deletions

View File

@ -142,31 +142,37 @@ class Decisions implements \Iterator, \Countable
array_pop($this->decisionQueue); array_pop($this->decisionQueue);
} }
#[\ReturnTypeWillChange]
public function count() public function count()
{ {
return \count($this->decisionQueue); return \count($this->decisionQueue);
} }
#[\ReturnTypeWillChange]
public function rewind() public function rewind()
{ {
end($this->decisionQueue); end($this->decisionQueue);
} }
#[\ReturnTypeWillChange]
public function current() public function current()
{ {
return current($this->decisionQueue); return current($this->decisionQueue);
} }
#[\ReturnTypeWillChange]
public function key() public function key()
{ {
return key($this->decisionQueue); return key($this->decisionQueue);
} }
#[\ReturnTypeWillChange]
public function next() public function next()
{ {
prev($this->decisionQueue); prev($this->decisionQueue);
} }
#[\ReturnTypeWillChange]
public function valid() public function valid()
{ {
return false !== current($this->decisionQueue); return false !== current($this->decisionQueue);

View File

@ -98,6 +98,7 @@ class RuleSet implements \IteratorAggregate, \Countable
} }
} }
#[\ReturnTypeWillChange]
public function count() public function count()
{ {
return $this->nextRuleId; return $this->nextRuleId;
@ -116,6 +117,7 @@ class RuleSet implements \IteratorAggregate, \Countable
/** /**
* @return RuleSetIterator * @return RuleSetIterator
*/ */
#[\ReturnTypeWillChange]
public function getIterator() public function getIterator()
{ {
return new RuleSetIterator($this->getRules()); return new RuleSetIterator($this->getRules());

View File

@ -33,16 +33,19 @@ class RuleSetIterator implements \Iterator
$this->rewind(); $this->rewind();
} }
#[\ReturnTypeWillChange]
public function current() public function current()
{ {
return $this->rules[$this->currentType][$this->currentOffset]; return $this->rules[$this->currentType][$this->currentOffset];
} }
#[\ReturnTypeWillChange]
public function key() public function key()
{ {
return $this->currentType; return $this->currentType;
} }
#[\ReturnTypeWillChange]
public function next() public function next()
{ {
$this->currentOffset++; $this->currentOffset++;
@ -67,6 +70,7 @@ class RuleSetIterator implements \Iterator
} }
} }
#[\ReturnTypeWillChange]
public function rewind() public function rewind()
{ {
$this->currentOffset = 0; $this->currentOffset = 0;
@ -86,6 +90,7 @@ class RuleSetIterator implements \Iterator
} while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType])); } while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType]));
} }
#[\ReturnTypeWillChange]
public function valid() public function valid()
{ {
return isset($this->rules[$this->currentType], $this->rules[$this->currentType][$this->currentOffset]); return isset($this->rules[$this->currentType], $this->rules[$this->currentType][$this->currentOffset]);

View File

@ -52,8 +52,8 @@ class ErrorHandler
} }
if (self::$io) { if (self::$io) {
// ignore symfony/console deprecation warning // ignore symfony/* deprecation warnings about return types
if (0 === strpos($message, 'Return type of Symfony\\Component\\Console\\Helper\\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator')) { if (preg_match('{^Return type of Symfony\\Component\\.*ReturnTypeWillChange}', $message)) {
return true; return true;
} }