Skip to content
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

PHP 8.1: prevent deprecation notices about missing return types #3400

Merged
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
7 changes: 7 additions & 0 deletions src/Files/FileList.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use PHP_CodeSniffer\Ruleset;
use PHP_CodeSniffer\Config;
use PHP_CodeSniffer\Exceptions\DeepExitException;
use ReturnTypeWillChange;

class FileList implements \Iterator, \Countable
{
Expand Down Expand Up @@ -169,6 +170,7 @@ private function getFilterClass()
*
* @return void
*/
#[ReturnTypeWillChange]
public function rewind()
{
reset($this->files);
Expand All @@ -181,6 +183,7 @@ public function rewind()
*
* @return \PHP_CodeSniffer\Files\File
*/
#[ReturnTypeWillChange]
public function current()
{
$path = key($this->files);
Expand All @@ -198,6 +201,7 @@ public function current()
*
* @return void
*/
#[ReturnTypeWillChange]
public function key()
{
return key($this->files);
Expand All @@ -210,6 +214,7 @@ public function key()
*
* @return void
*/
#[ReturnTypeWillChange]
public function next()
{
next($this->files);
Expand All @@ -222,6 +227,7 @@ public function next()
*
* @return boolean
*/
#[ReturnTypeWillChange]
public function valid()
{
if (current($this->files) === false) {
Expand All @@ -238,6 +244,7 @@ public function valid()
*
* @return integer
*/
#[ReturnTypeWillChange]
public function count()
{
return $this->numFiles;
Expand Down
3 changes: 3 additions & 0 deletions src/Filters/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use PHP_CodeSniffer\Util;
use PHP_CodeSniffer\Ruleset;
use PHP_CodeSniffer\Config;
use ReturnTypeWillChange;

class Filter extends \RecursiveFilterIterator
{
Expand Down Expand Up @@ -89,6 +90,7 @@ public function __construct($iterator, $basedir, Config $config, Ruleset $rulese
*
* @return bool
*/
#[ReturnTypeWillChange]
public function accept()
{
$filePath = $this->current();
Expand Down Expand Up @@ -130,6 +132,7 @@ public function accept()
*
* @return \RecursiveIterator
*/
#[ReturnTypeWillChange]
public function getChildren()
{
$filterClass = get_called_class();
Expand Down