How to get the .gitignore file with the finder class in symfony

26 Views Asked by At

How to get the .gitignore file with the Symfony-Finder class? I'm trying following, but I'm always getting an empty array/result:

    $finder = new Finder();
    $finder
        //  ->depth('== 0')            // i tried all of these methods
        //  ->files()                  // i tried all of these methods
        //  ->ignoreUnreadableDirs()   // i tried all of these methods
        //  ->ignoreVCSIgnored(false)  // i tried all of these methods
        //  ->path('.gitignore')       // i tried all of these methods
         ->name('.gitignore')
         ->in('/var/www/myproject/');
0

There are 0 best solutions below