code: private function filterNestedPaths(Finder $finder, string $prepend): array
      {
          $parents = [];
          $files = iterator_to_array($finder);
  
          foreach ($files as $key => $file) {
              $path = rtrim(strtr($prepend.'/'.$file->getRelativePath(), '\\', '/'), '/');
  
              if (!empty($parents)) {
                  $parent = \dirname($path);
  
                  while (false !== strpos($parent, '/')) {
                      if (\in_array($parent, $parents, true)) {
                          $this->rows[] = [
                              sprintf(
                                  '<fg=yellow;options=bold>%s</>',
                                  '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!'
                              ),
                              $this->webDir.'/'.$path,
                              sprintf('<comment>Skipped because %s will be symlinked.</comment>', $parent),
                          ];
  
                          unset($files[$key]);
                          break;
                      }
  
                      $parent = \dirname($parent);
                  }
              }
  
              $parents[] = $path;
          }
  
          return array_values($files);
      }
docs: Filters nested paths so only the top folder is symlinked.
  
  @return SplFileInfo[]