src/CodeGeneration/PostProcessor/FileOverrider.php
private function getOverridesIterator(): \Generator
    {
        try {
            $recursiveIterator = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator(
                    $this->getPathToOverridesDirectory(),
                    \RecursiveDirectoryIterator::SKIP_DOTS
                ),
                \RecursiveIteratorIterator::SELF_FIRST
            );
            foreach ($recursiveIterator as $fileInfo) {
                /**
                 * @var \SplFileInfo $fileInfo
                 */
                if ($fileInfo->isFile()) {
                    if (self::OVERRIDE_EXTENSION !== substr(
                        $fileInfo->getFilename(),
                        -strlen(self::OVERRIDE_EXTENSION)
                    )
                    ) {
                        continue;
                    }
                    yield $fileInfo->getPathname();
                }
            }
        } finally {
            $recursiveIterator = null;
            unset($recursiveIterator);
        }
    }
private function getOverridesIterator(): \Generator
    {
        try {
            $recursiveIterator = new \RecursiveIteratorIterator(
                new \RecursiveDirectoryIterator(
                    $this->getPathToOverridesDirectory(),
                    \RecursiveDirectoryIterator::SKIP_DOTS
                ),
                \RecursiveIteratorIterator::SELF_FIRST
            );
            foreach ($recursiveIterator as $fileInfo) {
                /**
                 * @var \SplFileInfo $fileInfo
                 */
                if ($fileInfo->isFile()) {
                    if (self::OVERRIDE_EXTENSION !== substr(
                        $fileInfo->getFilename(),
                        -strlen(self::OVERRIDE_EXTENSION)
                    )
                    ) {
                        continue;
                    }
                    yield $fileInfo->getPathname();
                }
            }
        } finally {
            $recursiveIterator = null;
            unset($recursiveIterator);
        }
    }
private function getOverridesIterator ( ) : \ Generator { try { $ recursiveIterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ this -> getPathToOverridesDirectory ( ) , \ RecursiveDirectoryIterator :: SKIP_DOTS ) , \ RecursiveIteratorIterator :: SELF_FIRST ) ; foreach ( $ recursiveIterator as $ fileInfo ) { /**
                 * @var \SplFileInfo $fileInfo
                 */ if ( $ fileInfo -> isFile ( ) ) { if ( self :: OVERRIDE_EXTENSION !== substr ( $ fileInfo -> getFilename ( ) , - strlen ( self :: OVERRIDE_EXTENSION ) ) ) { continue ; } yield $ fileInfo -> getPathname ( ) ; } } } finally { $ recursiveIterator = null ; unset ( $ recursiveIterator ) ; } }
Yield file paths in the override folder

@return \Generator|string[]
Yield file paths in the override folder