Nette\Utils\Finder potential bug in filter()

Notice: This thread is very old.
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();
Artur
Member | 4
+
0
-

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

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