Skip to content

Commit 3601807

Browse files
committed
Add deprecation notices for the old config options
1 parent eb8aa6f commit 3601807

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Sentry/SentryBundle/DependencyInjection/SentryExtension.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,16 @@ public function load(array $configs, ContainerBuilder $container)
5151
private function checkConfigurationOnForInvalidSettings(array $config, ContainerBuilder $container)
5252
{
5353
foreach ($this->getDeprecatedOptionsWithDefaults() as $option => $default) {
54-
5554
// old option is used
55+
if ($config[$option] !== $default) {
56+
$deprecationMessage = sprintf(
57+
'The usage of sentry.%s is deprecated since version 0.8.3 and will be removed in 1.0. Use sentry.options.%s instead.',
58+
$option,
59+
$option
60+
);
61+
@trigger_error($deprecationMessage, E_USER_DEPRECATED);
62+
}
63+
5664
if ($config[$option] !== $default && $config['options'][$option] === $default) {
5765
$container->setParameter('sentry.options.' . $option, $config[$option]);
5866
}
@@ -64,7 +72,11 @@ private function checkConfigurationOnForInvalidSettings(array $config, Container
6472

6573
// both are used
6674
if ($config[$option] !== $default && $config['options'][$option] !== $default) {
67-
$message = 'The configuration option sentry.' . $option . ' is deprecated. Use sentry.options.' . $option . ' instead!';
75+
$message = sprintf(
76+
'You are using both the deprecated option sentry.%s and the new sentry.options.%s, but values do not match. Drop the deprecated one or make the values identical.',
77+
$option,
78+
$option
79+
);
6880
throw new InvalidConfigurationException($message);
6981
}
7082
}

0 commit comments

Comments
 (0)