@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | private function __construct( |
20 | 20 | public readonly string $shortName, |
21 | 21 | public readonly ?string $fullName = null, |
22 | - ) {} |
|
22 | + ){} |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @param non-empty-string $name |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public static function create(string $name): Type |
28 | 28 | { |
29 | 29 | $fullName = null; |
30 | - if (Utils::hasShortName($name)) { |
|
30 | + if (Utils::hasShortName($name)){ |
|
31 | 31 | $fullName = $name; |
32 | 32 | $name = Utils::shortName($name); |
33 | 33 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function getSlashedShortName(bool $builtIn): string |
50 | 50 | { |
51 | 51 | $type = $this->shortName; |
52 | - if (!$builtIn && !$this->fullName) { |
|
52 | + if (!$builtIn && !$this->fullName){ |
|
53 | 53 | $type = "\\$type"; |
54 | 54 | } |
55 | 55 |
@@ -19,7 +19,8 @@ discard block |
||
19 | 19 | private function __construct( |
20 | 20 | public readonly string $shortName, |
21 | 21 | public readonly ?string $fullName = null, |
22 | - ) {} |
|
22 | + ) { |
|
23 | +} |
|
23 | 24 | |
24 | 25 | /** |
25 | 26 | * @param non-empty-string $name |
@@ -27,7 +28,8 @@ discard block |
||
27 | 28 | public static function create(string $name): Type |
28 | 29 | { |
29 | 30 | $fullName = null; |
30 | - if (Utils::hasShortName($name)) { |
|
31 | + if (Utils::hasShortName($name)) |
|
32 | + { |
|
31 | 33 | $fullName = $name; |
32 | 34 | $name = Utils::shortName($name); |
33 | 35 | } |
@@ -49,7 +51,8 @@ discard block |
||
49 | 51 | public function getSlashedShortName(bool $builtIn): string |
50 | 52 | { |
51 | 53 | $type = $this->shortName; |
52 | - if (!$builtIn && !$this->fullName) { |
|
54 | + if (!$builtIn && !$this->fullName) |
|
55 | + { |
|
53 | 56 | $type = "\\$type"; |
54 | 57 | } |
55 | 58 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | public string $property; |
13 | 13 | public string $var; |
14 | 14 | |
15 | - private function __construct() {} |
|
15 | + private function __construct(){} |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @param non-empty-string $name |
@@ -12,7 +12,9 @@ |
||
12 | 12 | public string $property; |
13 | 13 | public string $var; |
14 | 14 | |
15 | - private function __construct() {} |
|
15 | + private function __construct() |
|
16 | + { |
|
17 | +} |
|
16 | 18 | |
17 | 19 | /** |
18 | 20 | * @param non-empty-string $name |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function __construct( |
22 | 22 | #[Proxy] |
23 | 23 | private readonly ContainerInterface $container, |
24 | - ) {} |
|
24 | + ){} |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Assign class to prototype property. |
@@ -47,18 +47,18 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param non-empty-string $name |
49 | 49 | */ |
50 | - public function resolveProperty(string $name): Dependency|ContainerExceptionInterface|null |
|
50 | + public function resolveProperty(string $name): Dependency | ContainerExceptionInterface | null |
|
51 | 51 | { |
52 | 52 | $dependency = $this->dependencies[$name] ?? null; |
53 | - if ($dependency === null) { |
|
53 | + if ($dependency === null){ |
|
54 | 54 | return null; |
55 | 55 | } |
56 | 56 | |
57 | - try { |
|
57 | + try{ |
|
58 | 58 | $this->container->get($dependency->type->name()); |
59 | 59 | |
60 | 60 | return $dependency; |
61 | - } catch (ContainerExceptionInterface $e) { |
|
61 | + }catch (ContainerExceptionInterface $e){ |
|
62 | 62 | return $e; |
63 | 63 | } |
64 | 64 | } |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | public function __construct( |
22 | 22 | #[Proxy] |
23 | 23 | private readonly ContainerInterface $container, |
24 | - ) {} |
|
24 | + ) { |
|
25 | +} |
|
25 | 26 | |
26 | 27 | /** |
27 | 28 | * Assign class to prototype property. |
@@ -50,15 +51,19 @@ discard block |
||
50 | 51 | public function resolveProperty(string $name): Dependency|ContainerExceptionInterface|null |
51 | 52 | { |
52 | 53 | $dependency = $this->dependencies[$name] ?? null; |
53 | - if ($dependency === null) { |
|
54 | + if ($dependency === null) |
|
55 | + { |
|
54 | 56 | return null; |
55 | 57 | } |
56 | 58 | |
57 | - try { |
|
59 | + try |
|
60 | + { |
|
58 | 61 | $this->container->get($dependency->type->name()); |
59 | 62 | |
60 | 63 | return $dependency; |
61 | - } catch (ContainerExceptionInterface $e) { |
|
64 | + } |
|
65 | + catch (ContainerExceptionInterface $e) |
|
66 | + { |
|
62 | 67 | return $e; |
63 | 68 | } |
64 | 69 | } |
@@ -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,28 +48,28 @@ 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 | /** @psalm-suppress TooManyArguments */ |
58 | 58 | $binder->bindSingleton(SpanInterface::class, $span, true); |
59 | 59 | |
60 | - try { |
|
60 | + try{ |
|
61 | 61 | /** @psalm-suppress InvalidArgument */ |
62 | 62 | return $prevSpan === null |
63 | 63 | ? $scope->runScope( |
64 | 64 | new Scope( |
65 | - bindings: [ |
|
65 | + bindings : [ |
|
66 | 66 | TracerInterface::class => $this, |
67 | 67 | ], |
68 | 68 | ), |
69 | - static fn(InvokerInterface $invoker): mixed => $invoker->invoke($callback), |
|
69 | + static fn(InvokerInterface $invoker) : mixed => $invoker->invoke($callback), |
|
70 | 70 | ) |
71 | 71 | : $invoker->invoke($callback); |
72 | - } finally { |
|
72 | + }finally{ |
|
73 | 73 | /** @psalm-suppress TooManyArguments */ |
74 | 74 | $prevSpan === null |
75 | 75 | ? $binder->removeBinding(SpanInterface::class) |
@@ -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,16 +53,20 @@ 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 | /** @psalm-suppress TooManyArguments */ |
58 | 66 | $binder->bindSingleton(SpanInterface::class, $span, true); |
59 | 67 | |
60 | - try { |
|
68 | + try |
|
69 | + { |
|
61 | 70 | /** @psalm-suppress InvalidArgument */ |
62 | 71 | return $prevSpan === null |
63 | 72 | ? $scope->runScope( |
@@ -69,7 +78,9 @@ discard block |
||
69 | 78 | static fn(InvokerInterface $invoker): mixed => $invoker->invoke($callback), |
70 | 79 | ) |
71 | 80 | : $invoker->invoke($callback); |
72 | - } finally { |
|
81 | + } |
|
82 | + finally |
|
83 | + { |
|
73 | 84 | /** @psalm-suppress TooManyArguments */ |
74 | 85 | $prevSpan === null |
75 | 86 | ? $binder->removeBinding(SpanInterface::class) |