Skip to content

Commit

Permalink
Align FilterIterator::accept() method signatures
Browse files Browse the repository at this point in the history
Fixes theseer#11.
  • Loading branch information
dereckson committed May 8, 2022
1 parent 4cdce31 commit 0eefe3c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
5 changes: 1 addition & 4 deletions src/filesonlyfilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

namespace TheSeer\DirectoryScanner {

use ReturnTypeWillChange;

/**
* FilterIterator to accept on files from a directory iterator
*
Expand All @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/includeexcludefilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

namespace TheSeer\DirectoryScanner {

use ReturnTypeWillChange;

/**
* FilterIterator to accept Items based on include/exclude conditions
*
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 1 addition & 4 deletions src/phpfilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

namespace TheSeer\DirectoryScanner {

use ReturnTypeWillChange;

/**
* FilterIterator to accept only php source files based on content
*
Expand All @@ -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;
}
Expand Down

0 comments on commit 0eefe3c

Please sign in to comment.