current(); } public function current() { /** @var RecursiveDirectoryIterator $innerIterator */ $innerIterator = $this->getInnerIterator(); /** @var \SplFileInfo $current */ $current = parent::current(); $subPath = $innerIterator->getSubPath(); return $subPath === '' ? $current->getFilename() : str_replace(DIRECTORY_SEPARATOR, '/', $subPath) . '/' . $current->getFilename(); } }