Skip to content

Commit 8b86957

Browse files
committed
[PATCH] Do not rely on assert() in production mode.
1 parent 055756d commit 8b86957

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/CompilerPass/AddingTypesToAdjustmentClearerPass.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ public function process(ContainerBuilder $container): void
3535

3636
private function addClearerToContainerParameter(ContainerBuilder $container, string $parameterName): void
3737
{
38-
assert(1 === preg_match('/^%(.*)%$/', $parameterName, $matches));
38+
if (1 !== preg_match('/^%(.*)%$/', $parameterName, $matches)) {
39+
throw new \RuntimeException(sprintf('Could not match placeholders in parameter name %s', $parameterName));
40+
}
3941
$parameterName = $matches[1];
4042
$listOfAdjustmentsToClear = $container->getParameter($parameterName);
4143
$listOfAdjustmentsToClear[] = CustomerOptionRecalculator::CUSTOMER_OPTION_ADJUSTMENT;

0 commit comments

Comments
 (0)