text: Q:
  
  Looping over multiple RecursiveDirectoryIterator
  
  I currently have the following PHP:
  $directoryIterator = new RecursiveDirectoryIterator( __DIR__ . '/tests/phpunit/' );
  
  /**
   * @var SplFileInfo $fileInfo
   */
  foreach ( new RecursiveIteratorIterator( $directoryIterator ) as $fileInfo ) {
      if ( substr( $fileInfo->getFilename(), -8 ) === 'Test.php' ) {
          $files[] = $fileInfo->getPathname();
      }
  }
  
  This creates an array with the paths to the files ending with Test.php in /tests/phpunit. Works nice and well. However now I also want to register stuff in /tests/integration. (There are more things in /tests, so I cannot simply go through that whole directory.) I could copy the code, but that’s be lame. So now I'm trying to figure out how to loop over two RecursiveDirectoryIterator instances. Is this possible in a sane way?
  
  A:
  
  To iterate over iterators you can use AppendIterator class.
  $directoryIterator = new RecursiveDirectoryIterator( __DIR__ . '/tests/phpunit/' );
  $directoryIterator1 = new RecursiveDirectoryIterator( __DIR__ . '/tests/integration/' );
  $iterator = new AppendIterator();
  $iterator->append(new RecursiveIteratorIterator( $directoryIterator ));
  $iterator->append(new RecursiveIteratorIterator( $directoryIterator1 ));
  
  /**
   * @var SplFileInfo $fileInfo
   */
  foreach ($iterator as $fileInfo) {
      if ( substr( $fileInfo->getFilename(), -8 ) === 'Test.php' ) {
          $files[] = $fileInfo->getPathname();
      }
  }
  
  