Symfony\Upgrade\Fixer::fix PHP Method

fix() public method

public fix ( $dryRun = false )
    public function fix($dryRun = false)
    {
        $changed = [];
        if ($this->stopwatch) {
            $this->stopwatch->openSection();
        }
        foreach ($this->finder as $file) {
            if ($file->isDir() || $file->isLink()) {
                continue;
            }
            if ($this->stopwatch) {
                $this->stopwatch->start($this->getFileRelativePathname($file));
            }
            if ($fixInfo = $this->fixFile($file, $dryRun)) {
                $changed[$this->getFileRelativePathname($file)] = $fixInfo;
            }
            if ($this->stopwatch) {
                $this->stopwatch->stop($this->getFileRelativePathname($file));
            }
        }
        if ($this->stopwatch) {
            $this->stopwatch->stopSection('fixFile');
        }
        return $changed;
    }

Usage Example

 /**
  * @dataProvider provideFixer
  */
 public function testThatFixSuccessfully(Fixer $fixer)
 {
     $fixer->addFixer(new ProgressBarFixer());
     $fixer->addFixer(new PropertyAccessFixer());
     $changed = $fixer->fix(true);
     $this->assertCount(1, $changed);
     $this->assertCount(2, $changed[$this->getPath()]);
 }