Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix return types for PHP 8.1 #42260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,10 @@ public function resultWithEmptyIterator(): array

return [
[$entity, new class() implements \Iterator {
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
derrabus marked this conversation as resolved.
Show resolved Hide resolved
public function current()
{
return null;
Expand All @@ -837,19 +841,28 @@ public function valid(): bool
return false;
}

public function next()
public function next(): void
{
}

/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function key()
{
return false;
}

public function rewind()
public function rewind(): void
{
}
}],
[$entity, new class() implements \Iterator {
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function current()
{
return false;
Expand All @@ -860,15 +873,20 @@ public function valid(): bool
return false;
}

public function next()
public function next(): void
{
}

/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function key()
{
return false;
}

public function rewind()
public function rewind(): void
{
}
}],
Expand Down
1 change: 1 addition & 0 deletions 1 src/Symfony/Bundle/TwigBundle/TemplateIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function __construct(KernelInterface $kernel, string $rootDir, array $pat
/**
* @return \Traversable
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
if (null !== $this->templates) {
Expand Down
1 change: 1 addition & 0 deletions 1 src/Symfony/Component/Config/Resource/GlobResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function __wakeup(): void
/**
* @return \Traversable
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
if (!file_exists($this->prefix) || (!$this->recursive && '' === $this->pattern)) {
Expand Down
3 changes: 2 additions & 1 deletion 3 src/Symfony/Component/Console/Helper/HelperSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ public function getCommand()
}

/**
* @return Helper[]
* @return \Traversable<Helper>
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->helpers);
Expand Down
2 changes: 2 additions & 0 deletions 2 src/Symfony/Component/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ public function getNode($position)
/**
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return \count($this->nodes);
Expand All @@ -1157,6 +1158,7 @@ public function count()
/**
* @return \ArrayIterator|\DOMNode[]
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->nodes);
Expand Down
4 changes: 4 additions & 0 deletions 4 src/Symfony/Component/DomCrawler/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ public function all()
*
* @return bool true if the field exists, false otherwise
*/
#[\ReturnTypeWillChange]
public function offsetExists($name)
{
return $this->has($name);
Expand All @@ -335,6 +336,7 @@ public function offsetExists($name)
*
* @throws \InvalidArgumentException if the field does not exist
*/
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
return $this->fields->get($name);
Expand All @@ -350,6 +352,7 @@ public function offsetGet($name)
*
* @throws \InvalidArgumentException if the field does not exist
*/
#[\ReturnTypeWillChange]
public function offsetSet($name, $value)
{
$this->fields->set($name, $value);
Expand All @@ -362,6 +365,7 @@ public function offsetSet($name, $value)
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset($name)
{
$this->fields->remove($name);
Expand Down
5 changes: 5 additions & 0 deletions 5 src/Symfony/Component/EventDispatcher/GenericEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public function hasArgument($key)
*
* @throws \InvalidArgumentException if key does not exist in $this->args
*/
#[\ReturnTypeWillChange]
public function offsetGet($key)
{
return $this->getArgument($key);
Expand All @@ -136,6 +137,7 @@ public function offsetGet($key)
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($key, $value)
{
$this->setArgument($key, $value);
Expand All @@ -148,6 +150,7 @@ public function offsetSet($key, $value)
*
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset($key)
{
if ($this->hasArgument($key)) {
Expand All @@ -162,6 +165,7 @@ public function offsetUnset($key)
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($key)
{
return $this->hasArgument($key);
Expand All @@ -172,6 +176,7 @@ public function offsetExists($key)
*
* @return \ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->arguments);
Expand Down
2 changes: 2 additions & 0 deletions 2 src/Symfony/Component/Finder/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ public function in($dirs)
*
* @throws \LogicException if the in() method has not been called
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
Expand Down Expand Up @@ -702,6 +703,7 @@ public function hasResults()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return iterator_count($this->getIterator());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function __construct(\Iterator $iterator, array $filters)
*
* @return bool true if the value should be kept, false otherwise
*/
#[\ReturnTypeWillChange]
public function accept()
{
$fileinfo = $this->current();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct(\Iterator $iterator, array $comparators)
*
* @return bool true if the value should be kept, false otherwise
*/
#[\ReturnTypeWillChange]
public function accept()
{
$fileinfo = $this->current();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct(\RecursiveIteratorIterator $iterator, int $minDepth
*
* @return bool true if the value should be kept, false otherwise
*/
#[\ReturnTypeWillChange]
public function accept()
{
return $this->getInnerIterator()->getDepth() >= $this->minDepth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function __construct(\Iterator $iterator, array $directories)
*
* @return bool True if the value should be kept, false otherwise
*/
#[\ReturnTypeWillChange]
public function accept()
{
if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
Expand All @@ -71,6 +72,7 @@ public function accept()
/**
* @return bool
*/
#[\ReturnTypeWillChange]
public function hasChildren()
{
return $this->isRecursive && $this->iterator->hasChildren();
Expand All @@ -79,6 +81,7 @@ public function hasChildren()
/**
* @return self
*/
#[\ReturnTypeWillChange]
public function getChildren()
{
$children = new self($this->iterator->getChildren(), []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct(\Iterator $iterator, int $mode)
*
* @return bool true if the value should be kept, false otherwise
*/
#[\ReturnTypeWillChange]
public function accept()
{
$fileinfo = $this->current();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class FilecontentFilterIterator extends MultiplePcreFilterIterator
*
* @return bool true if the value should be kept, false otherwise
*/
#[\ReturnTypeWillChange]
public function accept()
{
if (!$this->matchRegexps && !$this->noMatchRegexps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class FilenameFilterIterator extends MultiplePcreFilterIterator
*
* @return bool true if the value should be kept, false otherwise
*/
#[\ReturnTypeWillChange]
public function accept()
{
return $this->isAccepted($this->current()->getFilename());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class PathFilterIterator extends MultiplePcreFilterIterator
*
* @return bool true if the value should be kept, false otherwise
*/
#[\ReturnTypeWillChange]
public function accept()
{
$filename = $this->current()->getRelativePathname();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct(\Iterator $iterator, array $comparators)
*
* @return bool true if the value should be kept, false otherwise
*/
#[\ReturnTypeWillChange]
public function accept()
{
$fileinfo = $this->current();
Expand Down
1 change: 1 addition & 0 deletions 1 src/Symfony/Component/Finder/Iterator/SortableIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public function __construct(\Traversable $iterator, $sort, bool $reverseOrder =
/**
* @return \Traversable
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
if (1 === $this->sort) {
Expand Down
14 changes: 11 additions & 3 deletions 14 src/Symfony/Component/Finder/Tests/Iterator/Iterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public function __construct(array $values = [])
$this->rewind();
}

public function attach(\SplFileInfo $fileinfo)
public function attach(\SplFileInfo $fileinfo): void
{
$this->values[] = $fileinfo;
}

public function rewind()
public function rewind(): void
{
reset($this->values);
}
Expand All @@ -38,16 +38,24 @@ public function valid(): bool
return false !== $this->current();
}

public function next()
public function next(): void
{
next($this->values);
}

/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function current()
{
return current($this->values);
}

/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function key()
{
return key($this->values);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct()
{
}

public function accept()
public function accept(): bool
{
throw new \BadFunctionCallException('Not implemented');
}
Expand Down
6 changes: 6 additions & 0 deletions 6 src/Symfony/Component/Form/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __construct(FormConfigInterface $config)
*
* @return bool Always returns false
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return false;
Expand All @@ -67,6 +68,7 @@ public function offsetExists($offset)
*
* @throws BadMethodCallException
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
throw new BadMethodCallException('Buttons cannot have children.');
Expand All @@ -84,6 +86,7 @@ public function offsetGet($offset)
*
* @throws BadMethodCallException
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new BadMethodCallException('Buttons cannot have children.');
Expand All @@ -100,6 +103,7 @@ public function offsetSet($offset, $value)
*
* @throws BadMethodCallException
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
throw new BadMethodCallException('Buttons cannot have children.');
Expand Down Expand Up @@ -436,6 +440,7 @@ public function createView(FormView $parent = null)
*
* @return int Always returns 0
*/
#[\ReturnTypeWillChange]
public function count()
{
return 0;
Expand All @@ -446,6 +451,7 @@ public function count()
*
* @return \EmptyIterator Always returns an empty iterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \EmptyIterator();
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.