Skip to content

Commit

Permalink
More php8.1 deprecation fixes, refs #10008
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Jul 22, 2021
1 parent 47cf602 commit a7efb27
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/Composer/DependencyResolver/Decisions.php
Expand Up @@ -142,31 +142,37 @@ public function revertLast()
array_pop($this->decisionQueue);
}

#[\ReturnTypeWillChange]
public function count()
{
return \count($this->decisionQueue);
}

#[\ReturnTypeWillChange]
public function rewind()
{
end($this->decisionQueue);
}

#[\ReturnTypeWillChange]
public function current()
{
return current($this->decisionQueue);
}

#[\ReturnTypeWillChange]
public function key()
{
return key($this->decisionQueue);
}

#[\ReturnTypeWillChange]
public function next()
{
prev($this->decisionQueue);
}

#[\ReturnTypeWillChange]
public function valid()
{
return false !== current($this->decisionQueue);
Expand Down
2 changes: 2 additions & 0 deletions src/Composer/DependencyResolver/RuleSet.php
Expand Up @@ -98,6 +98,7 @@ public function add(Rule $rule, $type)
}
}

#[\ReturnTypeWillChange]
public function count()
{
return $this->nextRuleId;
Expand All @@ -116,6 +117,7 @@ public function getRules()
/**
* @return RuleSetIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new RuleSetIterator($this->getRules());
Expand Down
5 changes: 5 additions & 0 deletions src/Composer/DependencyResolver/RuleSetIterator.php
Expand Up @@ -33,16 +33,19 @@ public function __construct(array $rules)
$this->rewind();
}

#[\ReturnTypeWillChange]
public function current()
{
return $this->rules[$this->currentType][$this->currentOffset];
}

#[\ReturnTypeWillChange]
public function key()
{
return $this->currentType;
}

#[\ReturnTypeWillChange]
public function next()
{
$this->currentOffset++;
Expand All @@ -67,6 +70,7 @@ public function next()
}
}

#[\ReturnTypeWillChange]
public function rewind()
{
$this->currentOffset = 0;
Expand All @@ -86,6 +90,7 @@ public function rewind()
} while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType]));
}

#[\ReturnTypeWillChange]
public function valid()
{
return isset($this->rules[$this->currentType], $this->rules[$this->currentType][$this->currentOffset]);
Expand Down
4 changes: 2 additions & 2 deletions src/Composer/Util/ErrorHandler.php
Expand Up @@ -52,8 +52,8 @@ public static function handle($level, $message, $file, $line)
}

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

Expand Down

0 comments on commit a7efb27

Please sign in to comment.