function FileOutput::__construct

Constructs a FileOutput.

Parameters

string $filePath: The path to the output file.

\PHPStan\Command\OutputStyle $outputStyle: The output style.

File

core/tests/PHPStan/ErrorFormatter/FileOutput.php, line 30

Class

FileOutput
Output implementation that writes to a file.

Namespace

Drupal\PHPStan\ErrorFormatter

Code

public function __construct(string $filePath, private OutputStyle $outputStyle) {
  $directory = dirname($filePath);
  if ($directory && $directory !== 'php:' && !is_dir($directory)) {
    mkdir($directory, 0777, TRUE);
  }
  $this->handle = new \SplFileObject($filePath, 'w');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.