Symfony\Upgrade\Fixer::fixFile PHP Method

fixFile() private method

private fixFile ( SplFileInfo $file, $dryRun )
$file SplFileInfo
    private function fixFile(\SplFileInfo $file, $dryRun)
    {
        $new = $old = file_get_contents($file->getRealpath());
        $appliedFixers = [];
        Tokens::clearCache();
        try {
            foreach ($this->fixers as $fixer) {
                if (!$fixer->supports($file)) {
                    continue;
                }
                $newest = $fixer->fix($file, $new);
                if ($newest !== $new) {
                    $appliedFixers[] = $fixer->getName();
                }
                $new = $newest;
            }
        } catch (\Exception $e) {
            if ($this->errorsManager) {
                $this->errorsManager->report(ErrorsManager::ERROR_TYPE_EXCEPTION, $this->getFileRelativePathname($file), $e->__toString());
            }
            return;
        }
        if ($new !== $old) {
            if (!$dryRun) {
                file_put_contents($file->getRealpath(), $new);
            }
        }
        return $appliedFixers;
    }