protected function DeprecationAnalyzer::createModifiedNeonFile in Upgrade Status 8.2
Same name and namespace in other branches
- 8.3 src/DeprecationAnalyzer.php \Drupal\upgrade_status\DeprecationAnalyzer::createModifiedNeonFile()
Creates the final config file in the temporary directory.
Throws
\Exception If the PHPStan configuration file cannot be written.
1 call to DeprecationAnalyzer::createModifiedNeonFile()
- DeprecationAnalyzer::initEnvironment in src/
DeprecationAnalyzer.php - Initialize the external environment.
File
- src/
DeprecationAnalyzer.php, line 486
Class
Namespace
Drupal\upgrade_statusCode
protected function createModifiedNeonFile() {
$module_path = DRUPAL_ROOT . '/' . drupal_get_path('module', 'upgrade_status');
$config = file_get_contents($module_path . '/deprecation_testing.neon');
$config = str_replace('parameters:', "parameters:\n\ttmpDir: '" . $this->temporaryDirectory . '/phpstan' . "'\n" . "\tdrupal:\n\t\tdrupal_root: '" . DRUPAL_ROOT . "'", $config);
$config .= "\nincludes:\n\t- '" . $this->vendorPath . "/mglaman/phpstan-drupal/extension.neon'\n\t- '" . $this->vendorPath . "/phpstan/phpstan-deprecation-rules/rules.neon'\n";
$success = file_put_contents($this->phpstanNeonPath, $config);
if (!$success) {
throw new \Exception('Unable to write configuration for PHPStan to ' . $this->phpstanNeonPath);
}
}