Skip to content

Commit

Permalink
[dx] add validation to symfony xml/php config files (#6450)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored Nov 19, 2024
1 parent 37226f1 commit 4425eb5
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 container 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 container must have "php" suffix. "%s" given',
$symfonyContainerPhpFile
));
}

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

0 comments on commit 4425eb5

Please sign in to comment.