Nette\Utils\Finder potential bug in filter()

about a month ago

Artur
Member | 4
+
0
-

Hi, it seems to me that filter() is not working. In both cases count() returns the number of files in the current dir.

<?php

require 'bootstrap.php';
use Nette\Utils\Finder;


$count1 = Finder::findFiles('*') //12
    ->in('.')
    ->filter(function(){ return true; })
    ->count();

$count2 = Finder::findFiles('*') //12
    ->in('.')
    ->filter(function(){ return false; })
    ->count();

about a month ago

Artur
Member | 4
+
0
-

version: “nette/utils”: “^2.4”

about a month ago

David Grudl
founder | 6692
+
+1
-
$count1 = Finder::findFiles('*')
    ->filter(function(){ return true; }) // this filter files
    ->in('.')
    ->filter(function(){ return true; }) // this filter directories (there is none)
    ->count();