@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public static function create( |
24 | 24 | \ReflectionClass $type, |
25 | - \Stringable|string|null $context, |
|
25 | + \Stringable | string | null $context, |
|
26 | 26 | \Spiral\Core\Attribute\Proxy $attribute, |
27 | 27 | ): object { |
28 | 28 | $interface = $type->getName(); |
@@ -37,19 +37,19 @@ discard block |
||
37 | 37 | $attribute->proxyOverloads ? '[magic-calls]' : '', |
38 | 38 | ); |
39 | 39 | |
40 | - if (!\array_key_exists($cacheKey, self::$classes)) { |
|
40 | + if (!\array_key_exists($cacheKey, self::$classes)){ |
|
41 | 41 | $n = 0; |
42 | - do { |
|
42 | + do{ |
|
43 | 43 | $className = \sprintf( |
44 | 44 | '%s\%s SCOPED PROXY%s', |
45 | 45 | $type->getNamespaceName(), |
46 | 46 | $type->getShortName(), |
47 | 47 | $n++ > 0 ? " {$n}" : '' |
48 | 48 | ); |
49 | - } while (\class_exists($className)); |
|
49 | + }while (\class_exists($className)); |
|
50 | 50 | |
51 | 51 | /** @var class-string<TClass> $className */ |
52 | - try { |
|
52 | + try{ |
|
53 | 53 | $classString = ProxyClassRenderer::renderClass( |
54 | 54 | $type, |
55 | 55 | $className, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ); |
59 | 59 | |
60 | 60 | eval($classString); |
61 | - } catch (\Throwable $e) { |
|
61 | + }catch (\Throwable $e){ |
|
62 | 62 | throw new \Error("Unable to create proxy for `{$interface}`: {$e->getMessage()}", 0, $e); |
63 | 63 | } |
64 | 64 | |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | |
68 | 68 | // Store in cache without context |
69 | 69 | self::$classes[$cacheKey] = $className; |
70 | - } else { |
|
70 | + }else{ |
|
71 | 71 | /** @var TClass $instance */ |
72 | 72 | $instance = new (self::$classes[$cacheKey])(); |
73 | 73 | } |
74 | 74 | |
75 | - if ($context !== null || $attachContainer) { |
|
75 | + if ($context !== null || $attachContainer){ |
|
76 | 76 | (static function () use ($instance, $context, $attachContainer): void { |
77 | 77 | // Set the Current Context |
78 | 78 | /** @see \Spiral\Core\Internal\Proxy\ProxyTrait::$__container_proxy_context */ |
@@ -37,9 +37,11 @@ discard block |
||
37 | 37 | $attribute->proxyOverloads ? '[magic-calls]' : '', |
38 | 38 | ); |
39 | 39 | |
40 | - if (!\array_key_exists($cacheKey, self::$classes)) { |
|
40 | + if (!\array_key_exists($cacheKey, self::$classes)) |
|
41 | + { |
|
41 | 42 | $n = 0; |
42 | - do { |
|
43 | + do |
|
44 | + { |
|
43 | 45 | $className = \sprintf( |
44 | 46 | '%s\%s SCOPED PROXY%s', |
45 | 47 | $type->getNamespaceName(), |
@@ -49,7 +51,8 @@ discard block |
||
49 | 51 | } while (\class_exists($className)); |
50 | 52 | |
51 | 53 | /** @var class-string<TClass> $className */ |
52 | - try { |
|
54 | + try |
|
55 | + { |
|
53 | 56 | $classString = ProxyClassRenderer::renderClass( |
54 | 57 | $type, |
55 | 58 | $className, |
@@ -58,7 +61,9 @@ discard block |
||
58 | 61 | ); |
59 | 62 | |
60 | 63 | eval($classString); |
61 | - } catch (\Throwable $e) { |
|
64 | + } |
|
65 | + catch (\Throwable $e) |
|
66 | + { |
|
62 | 67 | throw new \Error("Unable to create proxy for `{$interface}`: {$e->getMessage()}", 0, $e); |
63 | 68 | } |
64 | 69 | |
@@ -67,12 +72,15 @@ discard block |
||
67 | 72 | |
68 | 73 | // Store in cache without context |
69 | 74 | self::$classes[$cacheKey] = $className; |
70 | - } else { |
|
75 | + } |
|
76 | + else |
|
77 | + { |
|
71 | 78 | /** @var TClass $instance */ |
72 | 79 | $instance = new (self::$classes[$cacheKey])(); |
73 | 80 | } |
74 | 81 | |
75 | - if ($context !== null || $attachContainer) { |
|
82 | + if ($context !== null || $attachContainer) |
|
83 | + { |
|
76 | 84 | (static function () use ($instance, $context, $attachContainer): void { |
77 | 85 | // Set the Current Context |
78 | 86 | /** @see \Spiral\Core\Internal\Proxy\ProxyTrait::$__container_proxy_context */ |