Skip to content

Commit

Permalink
[dx] add validation to symfony xml/php config files
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Nov 19, 2024
1 parent 26b4d97 commit 7660eaf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Configuration/RectorConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -899,12 +899,26 @@ public function withPhpVersion(int $phpVersion): self

public function withSymfonyContainerXml(string $symfonyContainerXmlFile): self
{
if (! str_ends_with($symfonyContainerXmlFile, '.xml')) {
throw new InvalidConfigurationException(sprintf(
'Provided dumped Symfony config must have xml suffix. "%s" given',
$symfonyContainerXmlFile
));
}

$this->symfonyContainerXmlFile = $symfonyContainerXmlFile;
return $this;
}

public function withSymfonyContainerPhp(string $symfonyContainerPhpFile): self
{
if (! str_ends_with($symfonyContainerPhpFile, '.php')) {
throw new InvalidConfigurationException(sprintf(
'Provided dumped Symfony config must have php suffix. "%s" given',
$symfonyContainerPhpFile
));
}

$this->symfonyContainerPhpFile = $symfonyContainerPhpFile;
return $this;
}
Expand Down

0 comments on commit 7660eaf

Please sign in to comment.