@@ -13,20 +13,20 @@ |
||
| 13 | 13 | { |
| 14 | 14 | public function __construct( |
| 15 | 15 | private readonly ContainerInterface $container, |
| 16 | - ) {} |
|
| 16 | + ){} |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @psalm-suppress InvalidReturnType |
| 20 | 20 | * @psalm-suppress InvalidReturnStatement |
| 21 | 21 | */ |
| 22 | - public function __invoke(LogRecord|array $record): array|LogRecord |
|
| 22 | + public function __invoke(LogRecord | array $record): array | LogRecord |
|
| 23 | 23 | { |
| 24 | 24 | $tracer = $this->container->get(TracerInterface::class); |
| 25 | 25 | \assert($tracer instanceof TracerInterface); |
| 26 | 26 | |
| 27 | 27 | $context = $tracer->getContext(); |
| 28 | 28 | |
| 29 | - if (!empty($context)) { |
|
| 29 | + if (!empty($context)){ |
|
| 30 | 30 | $record['extra']['telemetry'] = $context; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -13,7 +13,8 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | public function __construct( |
| 15 | 15 | private readonly ContainerInterface $container, |
| 16 | - ) {} |
|
| 16 | + ) { |
|
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | /** |
| 19 | 20 | * @psalm-suppress InvalidReturnType |
@@ -26,7 +27,8 @@ discard block |
||
| 26 | 27 | |
| 27 | 28 | $context = $tracer->getContext(); |
| 28 | 29 | |
| 29 | - if (!empty($context)) { |
|
| 30 | + if (!empty($context)) |
|
| 31 | + { |
|
| 30 | 32 | $record['extra']['telemetry'] = $context; |
| 31 | 33 | } |
| 32 | 34 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | |
| 51 | 51 | $result = $tracer->trace( |
| 52 | 52 | 'foo', |
| 53 | - static function (ContainerInterface $container) { |
|
| 53 | + static function (ContainerInterface $container){ |
|
| 54 | 54 | /** @var TracerInterface $tracer */ |
| 55 | 55 | $tracer = $container->get(TracerInterface::class); |
| 56 | 56 | |
@@ -50,7 +50,8 @@ |
||
| 50 | 50 | |
| 51 | 51 | $result = $tracer->trace( |
| 52 | 52 | 'foo', |
| 53 | - static function (ContainerInterface $container) { |
|
| 53 | + static function (ContainerInterface $container) |
|
| 54 | + { |
|
| 54 | 55 | /** @var TracerInterface $tracer */ |
| 55 | 56 | $tracer = $container->get(TracerInterface::class); |
| 56 | 57 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function __construct( |
| 35 | 35 | private readonly ConfiguratorInterface $config, |
| 36 | - ) {} |
|
| 36 | + ){} |
|
| 37 | 37 | |
| 38 | 38 | public function init(BinderInterface $binder, EnvironmentInterface $env): void |
| 39 | 39 | { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @param class-string<TracerFactoryInterface>|TracerFactoryInterface|Autowire $driver |
| 52 | 52 | */ |
| 53 | - public function registerTracer(string $name, string|TracerFactoryInterface|Autowire $driver): void |
|
| 53 | + public function registerTracer(string $name, string | TracerFactoryInterface | Autowire $driver): void |
|
| 54 | 54 | { |
| 55 | 55 | $this->config->modify( |
| 56 | 56 | TelemetryConfig::CONFIG, |
@@ -33,7 +33,8 @@ |
||
| 33 | 33 | |
| 34 | 34 | public function __construct( |
| 35 | 35 | private readonly ConfiguratorInterface $config, |
| 36 | - ) {} |
|
| 36 | + ) { |
|
| 37 | +} |
|
| 37 | 38 | |
| 38 | 39 | public function init(BinderInterface $binder, EnvironmentInterface $env): void |
| 39 | 40 | { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | public function __construct( |
| 22 | 22 | private readonly ?ScopeInterface $scope = new Container(), |
| 23 | - ) {} |
|
| 23 | + ){} |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @throws \Throwable |
@@ -28,18 +28,18 @@ discard block |
||
| 28 | 28 | final protected function runScope(SpanInterface $span, callable $callback): mixed |
| 29 | 29 | { |
| 30 | 30 | $container = ContainerScope::getContainer(); |
| 31 | - if ($container === null) { |
|
| 31 | + if ($container === null){ |
|
| 32 | 32 | return $this->scope->runScope([ |
| 33 | 33 | SpanInterface::class => $span, |
| 34 | 34 | TracerInterface::class => $this, |
| 35 | 35 | ], static fn(InvokerInterface $invoker): mixed => $invoker->invoke($callback)); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if ($container instanceof Container) { |
|
| 38 | + if ($container instanceof Container){ |
|
| 39 | 39 | $invoker = $container; |
| 40 | 40 | $binder = $container; |
| 41 | 41 | $scope = $container; |
| 42 | - } else { |
|
| 42 | + }else{ |
|
| 43 | 43 | /** @var ScopeInterface $scope */ |
| 44 | 44 | $scope = $container->get(ScopeInterface::class); |
| 45 | 45 | /** @var InvokerInterface $invoker */ |
@@ -48,26 +48,26 @@ discard block |
||
| 48 | 48 | $binder = $container->get(BinderInterface::class); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - try { |
|
| 51 | + try{ |
|
| 52 | 52 | $prevSpan = $container->get(SpanInterface::class); |
| 53 | - } catch (\Throwable) { |
|
| 53 | + }catch (\Throwable){ |
|
| 54 | 54 | $prevSpan = null; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $binder->bindSingleton(SpanInterface::class, $span, true); |
| 58 | 58 | |
| 59 | - try { |
|
| 59 | + try{ |
|
| 60 | 60 | return $prevSpan === null |
| 61 | 61 | ? $scope->runScope( |
| 62 | 62 | new Scope( |
| 63 | - bindings: [ |
|
| 63 | + bindings : [ |
|
| 64 | 64 | TracerInterface::class => $this, |
| 65 | 65 | ], |
| 66 | 66 | ), |
| 67 | - static fn(InvokerInterface $invoker): mixed => $invoker->invoke($callback), |
|
| 67 | + static fn(InvokerInterface $invoker) : mixed => $invoker->invoke($callback), |
|
| 68 | 68 | ) |
| 69 | 69 | : $invoker->invoke($callback); |
| 70 | - } finally { |
|
| 70 | + }finally{ |
|
| 71 | 71 | $prevSpan === null |
| 72 | 72 | ? $binder->removeBinding(SpanInterface::class) |
| 73 | 73 | : $binder->bindSingleton(SpanInterface::class, $prevSpan); |
@@ -20,7 +20,8 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | public function __construct( |
| 22 | 22 | private readonly ?ScopeInterface $scope = new Container(), |
| 23 | - ) {} |
|
| 23 | + ) { |
|
| 24 | +} |
|
| 24 | 25 | |
| 25 | 26 | /** |
| 26 | 27 | * @throws \Throwable |
@@ -28,18 +29,22 @@ discard block |
||
| 28 | 29 | final protected function runScope(SpanInterface $span, callable $callback): mixed |
| 29 | 30 | { |
| 30 | 31 | $container = ContainerScope::getContainer(); |
| 31 | - if ($container === null) { |
|
| 32 | + if ($container === null) |
|
| 33 | + { |
|
| 32 | 34 | return $this->scope->runScope([ |
| 33 | 35 | SpanInterface::class => $span, |
| 34 | 36 | TracerInterface::class => $this, |
| 35 | 37 | ], static fn(InvokerInterface $invoker): mixed => $invoker->invoke($callback)); |
| 36 | 38 | } |
| 37 | 39 | |
| 38 | - if ($container instanceof Container) { |
|
| 40 | + if ($container instanceof Container) |
|
| 41 | + { |
|
| 39 | 42 | $invoker = $container; |
| 40 | 43 | $binder = $container; |
| 41 | 44 | $scope = $container; |
| 42 | - } else { |
|
| 45 | + } |
|
| 46 | + else |
|
| 47 | + { |
|
| 43 | 48 | /** @var ScopeInterface $scope */ |
| 44 | 49 | $scope = $container->get(ScopeInterface::class); |
| 45 | 50 | /** @var InvokerInterface $invoker */ |
@@ -48,15 +53,19 @@ discard block |
||
| 48 | 53 | $binder = $container->get(BinderInterface::class); |
| 49 | 54 | } |
| 50 | 55 | |
| 51 | - try { |
|
| 56 | + try |
|
| 57 | + { |
|
| 52 | 58 | $prevSpan = $container->get(SpanInterface::class); |
| 53 | - } catch (\Throwable) { |
|
| 59 | + } |
|
| 60 | + catch (\Throwable) |
|
| 61 | + { |
|
| 54 | 62 | $prevSpan = null; |
| 55 | 63 | } |
| 56 | 64 | |
| 57 | 65 | $binder->bindSingleton(SpanInterface::class, $span, true); |
| 58 | 66 | |
| 59 | - try { |
|
| 67 | + try |
|
| 68 | + { |
|
| 60 | 69 | return $prevSpan === null |
| 61 | 70 | ? $scope->runScope( |
| 62 | 71 | new Scope( |
@@ -67,7 +76,9 @@ discard block |
||
| 67 | 76 | static fn(InvokerInterface $invoker): mixed => $invoker->invoke($callback), |
| 68 | 77 | ) |
| 69 | 78 | : $invoker->invoke($callback); |
| 70 | - } finally { |
|
| 79 | + } |
|
| 80 | + finally |
|
| 81 | + { |
|
| 71 | 82 | $prevSpan === null |
| 72 | 83 | ? $binder->removeBinding(SpanInterface::class) |
| 73 | 84 | : $binder->bindSingleton(SpanInterface::class, $prevSpan); |