@param  FileManipulation[] $file_replacements

@return void
179696
public static function afterFunctionCallAnalysis(
        FuncCall $expr,
        string $function_id,
        Context $context,
        StatementsSource $statements_source,
        Codebase $codebase,
        array &$file_replacements = [],
        Union &$return_type_candidate = null
    ) {
        if ($expr->name instanceof PhpParser\Node\Expr) {
            return;
        }

        try {
            $function_storage = $codebase->functions->getStorage(
                $statements_source instanceof \Psalm\Internal\Analyzer\StatementsAnalyzer
                    ? $statements_source
                    : null,
                $function_id
            );

            $function_name_parts = explode('\\', $function_storage->cased_name);

            if (end($function_name_parts) !== end($expr->name->parts)) {
                if (\Psalm\IssueBuffer::accepts(
                    new IncorrectFunctionCasing(
                        'Function is incorrectly cased, expecting ' . $function_storage->cased_name,
                        new CodeLocation($statements_source, $expr->name)
                    ),
                    $statements_source->getSuppressedIssues()
                )) {
                    // fall through
                }
            }
        } catch (\Exception $e) {
            // can throw if storage is missing
        }
    }
1224249
protected void copyOtherFiles(File projectDir, File srcDir, File outDir, Replacement replaceFn, Set<String> extraIgnorefiles) throws IOException {
        if (archetypeUtils.isValidFileToCopy(projectDir, srcDir, extraIgnorefiles)) {
            if (srcDir.isFile()) {
                copyFile(srcDir, outDir, replaceFn);
            } else {
                outDir.mkdirs();
                String[] names = srcDir.list();
                if (names != null) {
                    for (String name: names) {
                        copyOtherFiles(projectDir, new File(srcDir, name), new File(outDir, name), replaceFn, extraIgnorefiles);
                    }
                }
            }
        }
    }
1077429
private function loadList(array $fileNames): void
  {
    $this->findSourceFilesFromList($fileNames);
    $this->detectNameConflicts();
    $this->getColumnTypes();
    $this->readStoredRoutineMetadata();
    $this->getConstants();
    $this->getOldStoredRoutinesInfo();
    $this->getCorrectSqlMode();

    $this->loadStoredRoutines();

    // Write the metadata to file.
    $this->writeStoredRoutineMetadata();
  }
214716
public static function strReplaceFile(string $find, string $replace, string $file_path)
    {
        file_put_contents($file_path, str_replace($find, $replace, file_get_contents($file_path)));
    }
1315214
private function moveFiles()
    {
        // Ensure we have the file permissions not in cache as new files were installed.
        clearstatcache();
        // Now move all the files over.
        $destinationDir = $this->file->get(self::SETTING_DESTINATION_DIR);
        $ioHandler      = $this->getIO();
        $logging        = $ioHandler->isVeryVerbose();
        $this->folders  = [];
        foreach (Finder::create()->in($this->tempDir)->ignoreDotFiles(false)->ignoreVCS(false) as $file) {
            $this->moveFile($file, $destinationDir, $logging, $ioHandler);
        }

        foreach (array_reverse($this->folders) as $folder) {
            if ($logging) {
                $ioHandler->write(sprintf('remove directory %s', $folder));
            }
            rmdir($folder);
        }
    }
18603
protected void copyFile(File src, File dest, Replacement replaceFn) throws IOException {
        boolean isSource = isSourceFile(src);
        copyFile(src, dest, replaceFn, isSource);
    }
1171804
private function preparePlaceHolders(): void
  {
    $this->logVerbose('Prepare place holders.');

    foreach ($this->getResourcesInfo() as $file_info)
    {
      $this->replacePairs["'".$file_info['path_name_in_sources']."'"] = "'".$file_info['path_name_in_sources_with_hash']."'";
      $this->replacePairs['"'.$file_info['path_name_in_sources'].'"'] = '"'.$file_info['path_name_in_sources_with_hash'].'"';

      if (isset($file_info['path_name_in_sources_alternative']))
      {
        $this->replacePairs["'".$file_info['path_name_in_sources_alternative']."'"] = "'".$file_info['path_name_in_sources_with_hash']."'";
        $this->replacePairs['"'.$file_info['path_name_in_sources_alternative'].'"'] = '"'.$file_info['path_name_in_sources_with_hash'].'"';
      }
    }
  }
611937
protected function updateFile($file_id)
    {
        if (!$this->isError() && !$this->file->update($file_id, $this->getSubmitted())) {
            $this->errorAndExit($this->text('Unexpected result'));
        }
    }
26502
protected function updateFilenames(): void
    {
        $this->files->setFlags(\FilesystemIterator::KEY_AS_FILENAME
            | \FilesystemIterator::CURRENT_AS_FILEINFO
            | \FilesystemIterator::SKIP_DOTS);
        $this->filenames = array_keys(iterator_to_array($this->files));
    }
1318951
private function resolveFile(\DirectoryIterator $file, array &$files)
    {
        if ($file->isDir() && !$file->isDot()) {
            $files = Tools::resolvePath($files, $this->getFileNames());
        }

        if ($file->isFile() && !$file->isLink() && $file->isReadable()) {
            $files = Tools::resolvePath($files, $file->getRealPath());
        }
    }
843578
public function setFiles($filenames)
    {
        if ($this->isReference()) {
            throw $this->tooManyAttributes();
        }
        if (!empty($filenames)) {
            $tok = strtok($filenames, ", \t\n\r");
            while ($tok !== false) {
                $fname = trim($tok);
                if ($fname !== "") {
                    $this->filenames[] = $tok;
                }
                $tok = strtok(", \t\n\r");
            }
        }
    }
1151899
private function replaceDummyInFile($filePath)
    {
        $fileSource = File::get($filePath);
        $fileContent = str_replace(array_keys($this->dummyReplacements), array_values($this->dummyReplacements), $fileSource);
        $writeFile = File::put($filePath, $fileContent);
        if ($writeFile === false) {
            throw new \Exception("Error writing to file " . $filePath);
        }
    }
269738
public function input($file_content)
    {
        $this->file_content = $file_content;

        $this->parsed_content = json_decode($this->file_content, true);
    }
640324
public static void copyFiles(File[] files, File[] destinationFiles) throws IOException {
        int length = Integer.min(files.length, destinationFiles.length);
        for (int i = 0; i < length; i++) {
            copyFile(files[i], destinationFiles[i]);
        }
    }
1230528
private function replaceToken(): void
    {
        $file = $this->getFile();

        $file->fixer->beginChangeset();
        $file->fixer->replaceToken($this->getStackPos(), '===');
        $file->fixer->endChangeset();
    }
1194653
protected function rotateFiles()
    {
        $file = $this->logFile;
        for ($i = $this->maxLogFiles; $i >= 0; --$i) {
            // $i == 0 is the original log file
            $rotateFile = $file . ($i === 0 ? '' : '.' . $i);
            if (is_file($rotateFile)) {
                // suppress errors because it's possible multiple processes enter into this section
                if ($i === $this->maxLogFiles) {
                    @unlink($rotateFile);
                } else {
                    if ($this->rotateByCopy) {
                        @copy($rotateFile, $file . '.' . ($i + 1));
                        if ($fp = @fopen($rotateFile, 'a')) {
                            @ftruncate($fp, 0);
                            @fclose($fp);
                        }
                    } else {
                        @rename($rotateFile, $file . '.' . ($i + 1));
                    }
                }
            }
        }
    }
1131385
protected function copyExtras($files): void
    {
        foreach ($files as $source => $target) {
            $this->copy(
                $this->vendorPath . DS . $source,
                PATH_ROOT . DS . $target
            );
        }
    }