Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / nikic / php-parser / test / bootstrap.php
1 <?php
2
3 namespace PhpParser;
4
5 require __DIR__ . '/../vendor/autoload.php';
6
7 function canonicalize($str) {
8     // normalize EOL style
9     $str = str_replace("\r\n", "\n", $str);
10
11     // trim newlines at end
12     $str = rtrim($str, "\n");
13
14     // remove trailing whitespace on all lines
15     $lines = explode("\n", $str);
16     $lines = array_map(function($line) {
17         return rtrim($line, " \t");
18     }, $lines);
19     return implode("\n", $lines);
20 }
21
22 function filesInDir($directory, $fileExtension) {
23     $directory = realpath($directory);
24     $it = new \RecursiveDirectoryIterator($directory);
25     $it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::LEAVES_ONLY);
26     $it = new \RegexIterator($it, '(\.' . preg_quote($fileExtension) . '$)');
27     foreach ($it as $file) {
28         $fileName = $file->getPathname();
29         yield $fileName => file_get_contents($fileName);
30     }
31 }