code: public function allFiles(string $path): array
      {
          $iterator = new RecursiveIteratorIterator(
              new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)
          );
  
          return iterator_to_array($iterator);
      }
docs: @param string $path
  
  @return \SplFileInfo[]
  @throws \UnexpectedValueException