src/CodeGeneration/PostProcessor/FileOverrider.php
public function createNewOverride(string $pathToFileInProject): string
    {
        $relativePathToFileInProject = $this->getRelativePathToFile($pathToFileInProject);
        if (null !== $this->getOverrideForPath($relativePathToFileInProject)) {
            throw new \RuntimeException('Override already exists for path ' . $relativePathToFileInProject);
        }
        $overridePath        =
            $this->getOverrideDirectoryForFile($relativePathToFileInProject) .
            '/' . $this->getFileNameNoExtensionForPathInProject($relativePathToFileInProject) .
            '.' . $this->getProjectFileHash($relativePathToFileInProject) .
            '.php.override';
        $pathToFileInProject = $this->pathToProjectRoot . '/' . $relativePathToFileInProject;
        if (false === is_file($pathToFileInProject)) {
            throw new \RuntimeException('path ' . $pathToFileInProject . ' is not a file');
        }
        copy($pathToFileInProject, $overridePath);

        return $this->getRelativePathToFile($overridePath);
    }
public function createNewOverride(string $pathToFileInProject): string
    {
        $relativePathToFileInProject = $this->getRelativePathToFile($pathToFileInProject);
        if (null !== $this->getOverrideForPath($relativePathToFileInProject)) {
            throw new \RuntimeException('Override already exists for path ' . $relativePathToFileInProject);
        }
        $overridePath        =
            $this->getOverrideDirectoryForFile($relativePathToFileInProject) .
            '/' . $this->getFileNameNoExtensionForPathInProject($relativePathToFileInProject) .
            '.' . $this->getProjectFileHash($relativePathToFileInProject) .
            '.php.override';
        $pathToFileInProject = $this->pathToProjectRoot . '/' . $relativePathToFileInProject;
        if (false === is_file($pathToFileInProject)) {
            throw new \RuntimeException('path ' . $pathToFileInProject . ' is not a file');
        }
        copy($pathToFileInProject, $overridePath);

        return $this->getRelativePathToFile($overridePath);
    }
public function createNewOverride ( string $ pathToFileInProject ) : string { $ relativePathToFileInProject = $ this -> getRelativePathToFile ( $ pathToFileInProject ) ; if ( null !== $ this -> getOverrideForPath ( $ relativePathToFileInProject ) ) { throw new \ RuntimeException ( 'Override already exists for path ' . $ relativePathToFileInProject ) ; } $ overridePath = $ this -> getOverrideDirectoryForFile ( $ relativePathToFileInProject ) . '/' . $ this -> getFileNameNoExtensionForPathInProject ( $ relativePathToFileInProject ) . '.' . $ this -> getProjectFileHash ( $ relativePathToFileInProject ) . '.php.override' ; $ pathToFileInProject = $ this -> pathToProjectRoot . '/' . $ relativePathToFileInProject ; if ( false === is_file ( $ pathToFileInProject ) ) { throw new \ RuntimeException ( 'path ' . $ pathToFileInProject . ' is not a file' ) ; } copy ( $ pathToFileInProject , $ overridePath ) ; return $ this -> getRelativePathToFile ( $ overridePath ) ; }
Create a new Override File by copying the file from the project into the project's overrides directory

@param string $pathToFileInProject

@return string
Create a new Override File by copying the file from the project into the project s overrides directory