Skip to content

Commit e514c8b

Browse files
committed
refactor(sentry): remove deprecated specific options from ClientBuilderFactory
1 parent 203e978 commit e514c8b

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

src/sentry/src/Factory/ClientBuilderFactory.php

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,29 @@
1212
namespace FriendsOfHyperf\Sentry\Factory;
1313

1414
use FriendsOfHyperf\Sentry\Version;
15+
use Hyperf\Collection\Arr;
1516
use Hyperf\Contract\ConfigInterface;
1617
use Psr\Container\ContainerInterface;
1718
use Sentry\ClientBuilder;
19+
use Sentry\Options;
1820
use Sentry\Transport\TransportInterface;
1921

2022
use function Hyperf\Support\env;
2123
use function Hyperf\Tappable\tap;
2224

25+
/**
26+
* @property \Symfony\Component\OptionsResolver\OptionsResolver $resolver
27+
*/
2328
class ClientBuilderFactory
2429
{
25-
public const SPECIFIC_OPTIONS = [
26-
'breadcrumbs',
27-
'crons',
28-
'enable',
29-
'ignore_commands',
30-
'integrations',
31-
'logs_channel_level',
32-
'enable_default_metrics',
33-
'enable_command_metrics',
34-
'enable_queue_metrics',
35-
'enable_pool_metrics',
36-
'metrics_interval',
37-
'transport_channel_size',
38-
'transport_concurrent_limit',
39-
'tracing',
40-
'tracing_spans',
41-
'tracing_tags',
42-
];
43-
4430
public function __invoke(ContainerInterface $container): ClientBuilder
4531
{
4632
$userConfig = $container->get(ConfigInterface::class)->get('sentry', []);
4733
$userConfig['enable_tracing'] ??= true;
4834

49-
foreach (static::SPECIFIC_OPTIONS as $specificOptionName) {
50-
if (isset($userConfig[$specificOptionName])) {
51-
unset($userConfig[$specificOptionName]);
52-
}
53-
}
35+
/** @var null|\Symfony\Component\OptionsResolver\OptionsResolver $resolver */
36+
$resolver = (fn () => $this->resolver)->call(new Options());
37+
$userConfig = Arr::only($userConfig, $resolver?->getDefinedOptions() ?? []);
5438

5539
if (isset($userConfig['logger'])) {
5640
if (is_string($userConfig['logger']) && $container->has($userConfig['logger'])) {

0 commit comments

Comments
 (0)