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); array_pop($this->decisionQueue);
} }
/** public function count(): int
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{ {
return \count($this->decisionQueue); return \count($this->decisionQueue);
} }
/** public function rewind(): void
* @return void
*/
#[\ReturnTypeWillChange]
public function rewind()
{ {
end($this->decisionQueue); end($this->decisionQueue);
} }
@ -232,29 +224,17 @@ class Decisions implements \Iterator, \Countable
return current($this->decisionQueue); return current($this->decisionQueue);
} }
/** public function key(): ?int
* @return ?int
*/
#[\ReturnTypeWillChange]
public function key()
{ {
return key($this->decisionQueue); return key($this->decisionQueue);
} }
/** public function next(): void
* @return void
*/
#[\ReturnTypeWillChange]
public function next()
{ {
prev($this->decisionQueue); prev($this->decisionQueue);
} }
/** public function valid(): bool
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{ {
return false !== current($this->decisionQueue); 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 * Returns how many packages have been loaded into the pool
* @return int
*/ */
#[\ReturnTypeWillChange] public function count(): int
public function count()
{ {
return \count($this->packages); return \count($this->packages);
} }

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -54,15 +54,6 @@ class ErrorHandler
} }
if (self::$io) { 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>'); self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
if (self::$io->isVerbose()) { if (self::$io->isVerbose()) {
self::$io->writeError('<warning>Stack trace:</warning>'); self::$io->writeError('<warning>Stack trace:</warning>');