1
0
Fork 0

Get rid of RetutnTypeWillChange where possible, fixes #10014

pull/10343/head
Jordi Boggiano 2022-01-01 15:38:47 +01:00
parent 0b3adc84da
commit 7e27a25070
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
10 changed files with 18 additions and 79 deletions

View File

@ -205,20 +205,12 @@ class Decisions implements \Iterator, \Countable
array_pop($this->decisionQueue);
}
/**
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
public function count(): int
{
return \count($this->decisionQueue);
}
/**
* @return void
*/
#[\ReturnTypeWillChange]
public function rewind()
public function rewind(): void
{
end($this->decisionQueue);
}
@ -232,29 +224,17 @@ class Decisions implements \Iterator, \Countable
return current($this->decisionQueue);
}
/**
* @return ?int
*/
#[\ReturnTypeWillChange]
public function key()
public function key(): ?int
{
return key($this->decisionQueue);
}
/**
* @return void
*/
#[\ReturnTypeWillChange]
public function next()
public function next(): void
{
prev($this->decisionQueue);
}
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
public function valid(): bool
{
return false !== current($this->decisionQueue);
}

View File

@ -129,10 +129,8 @@ class Pool implements \Countable
/**
* Returns how many packages have been loaded into the pool
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
public function count(): int
{
return \count($this->packages);
}

View File

@ -103,11 +103,7 @@ class RuleSet implements \IteratorAggregate, \Countable
}
}
/**
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
public function count(): int
{
return $this->nextRuleId;
}
@ -127,11 +123,7 @@ class RuleSet implements \IteratorAggregate, \Countable
return $this->rules;
}
/**
* @return RuleSetIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
public function getIterator(): RuleSetIterator
{
return new RuleSetIterator($this->getRules());
}

View File

@ -42,11 +42,7 @@ class RuleSetIterator implements \Iterator
$this->rewind();
}
/**
* @return Rule
*/
#[\ReturnTypeWillChange]
public function current()
public function current(): Rule
{
return $this->rules[$this->currentType][$this->currentOffset];
}
@ -54,17 +50,12 @@ class RuleSetIterator implements \Iterator
/**
* @return RuleSet::TYPE_*|-1
*/
#[\ReturnTypeWillChange]
public function key()
public function key(): int
{
return $this->currentType;
}
/**
* @return void
*/
#[\ReturnTypeWillChange]
public function next()
public function next(): void
{
$this->currentOffset++;
@ -88,11 +79,7 @@ class RuleSetIterator implements \Iterator
}
}
/**
* @return void
*/
#[\ReturnTypeWillChange]
public function rewind()
public function rewind(): void
{
$this->currentOffset = 0;
@ -111,11 +98,7 @@ class RuleSetIterator implements \Iterator
} while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType]));
}
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
public function valid(): bool
{
return isset($this->rules[$this->currentType], $this->rules[$this->currentType][$this->currentOffset]);
}

View File

@ -23,8 +23,7 @@ class ArchivableFilesFilter extends FilterIterator
/**
* @return bool true if the current element is acceptable, otherwise false.
*/
#[\ReturnTypeWillChange]
public function accept()
public function accept(): bool
{
$file = $this->getInnerIterator()->current();
if ($file->isDir()) {

View File

@ -90,8 +90,7 @@ class ArchivableFilesFinder extends \FilterIterator
parent::__construct($this->finder->getIterator());
}
#[\ReturnTypeWillChange]
public function accept()
public function accept(): bool
{
/** @var SplFileInfo $current */
$current = $this->getInnerIterator()->current();

View File

@ -322,8 +322,7 @@ class ArrayRepository implements RepositoryInterface
*
* @return int Number of packages
*/
#[\ReturnTypeWillChange]
public function count()
public function count(): int
{
if (null === $this->packages) {
$this->initialize();

View File

@ -178,8 +178,7 @@ class CompositeRepository implements RepositoryInterface
/**
* @inheritDoc
*/
#[\ReturnTypeWillChange]
public function count()
public function count(): int
{
$total = 0;
foreach ($this->repositories as $repository) {

View File

@ -181,8 +181,7 @@ class FilterRepository implements RepositoryInterface
/**
* @inheritDoc
*/
#[\ReturnTypeWillChange]
public function count()
public function count(): int
{
if ($this->repo->count() > 0) {
return count($this->getPackages());

View File

@ -54,15 +54,6 @@ class ErrorHandler
}
if (self::$io) {
// ignore symfony/* deprecation warnings
// TODO remove in 2.3
if (Preg::isMatch('{^Return type of Symfony\\\\.*ReturnTypeWillChange}is', $message)) {
return true;
}
if (strpos(strtr($file, '\\', '/'), 'vendor/symfony/') !== false) {
return true;
}
self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
if (self::$io->isVerbose()) {
self::$io->writeError('<warning>Stack trace:</warning>');