From 0eefe3cdd35594dd9607d9d4c009c05fc7a995de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Santoro?= Date: Sun, 8 May 2022 12:58:54 +0000 Subject: [PATCH] Align FilterIterator::accept() method signatures Fixes #11. --- src/filesonlyfilter.php | 5 +---- src/includeexcludefilter.php | 5 +---- src/phpfilter.php | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/filesonlyfilter.php b/src/filesonlyfilter.php index 6d8ebb6..210bf56 100644 --- a/src/filesonlyfilter.php +++ b/src/filesonlyfilter.php @@ -37,8 +37,6 @@ namespace TheSeer\DirectoryScanner { - use ReturnTypeWillChange; - /** * FilterIterator to accept on files from a directory iterator * @@ -54,8 +52,7 @@ class FilesOnlyFilterIterator extends \FilterIterator { * * @return boolean */ - #[ReturnTypeWillChange] - public function accept() { + public function accept() : bool { switch($this->current()->getType()) { case 'file': { return true; diff --git a/src/includeexcludefilter.php b/src/includeexcludefilter.php index 1a7df29..c990049 100644 --- a/src/includeexcludefilter.php +++ b/src/includeexcludefilter.php @@ -37,8 +37,6 @@ namespace TheSeer\DirectoryScanner { - use ReturnTypeWillChange; - /** * FilterIterator to accept Items based on include/exclude conditions * @@ -90,8 +88,7 @@ public function setExclude(array $exc = array()) { * * @return boolean */ - #[ReturnTypeWillChange] - public function accept() { + public function accept() : bool { $pathname = $this->current()->getPathname(); foreach($this->exclude as $out) { diff --git a/src/phpfilter.php b/src/phpfilter.php index 2e674b5..6f06014 100644 --- a/src/phpfilter.php +++ b/src/phpfilter.php @@ -37,8 +37,6 @@ namespace TheSeer\DirectoryScanner { - use ReturnTypeWillChange; - /** * FilterIterator to accept only php source files based on content * @@ -54,8 +52,7 @@ class PHPFilterIterator extends \FilterIterator { * * @return boolean */ - #[ReturnTypeWillChange] - public function accept() { + public function accept() : bool { $finfo = new \finfo(FILEINFO_MIME); return strpos($finfo->file($this->current()->getPathname()), 'text/x-php') === 0; }