Skip to content

Commit

Permalink
[DependencyInjection] Use more clear message when unused environment …
Browse files Browse the repository at this point in the history
…variables detected
  • Loading branch information
voronkovich authored and fabpot committed Jun 3, 2017
1 parent 17deeaf commit 6dbdb1b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Expand Up @@ -166,7 +166,7 @@ public function dump(array $options = array())
}
}
if ($unusedEnvs) {
throw new EnvParameterException($unusedEnvs);
throw new EnvParameterException($unusedEnvs, null, 'Environment variables "%s" are never used. Please, check your container\'s configuration.');
}

return $code;
Expand Down
Expand Up @@ -18,8 +18,8 @@
*/
class EnvParameterException extends InvalidArgumentException
{
public function __construct(array $usedEnvs, \Exception $previous = null)
public function __construct(array $envs, \Exception $previous = null, $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.')
{
parent::__construct(sprintf('Incompatible use of dynamic environment variables "%s" found in parameters.', implode('", "', $usedEnvs)), 0, $previous);
parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous);
}
}
Expand Up @@ -302,7 +302,7 @@ public function testEnvParameter()

/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\EnvParameterException
* @expectedExceptionMessage Incompatible use of dynamic environment variables "FOO" found in parameters.
* @expectedExceptionMessage Environment variables "FOO" are never used. Please, check your container's configuration.
*/
public function testUnusedEnvParameter()
{
Expand Down

0 comments on commit 6dbdb1b

Please sign in to comment.