@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function __get(string $name) |
34 | 34 | { |
35 | 35 | $container = ContainerScope::getContainer(); |
36 | - if ($container === null || !$container->has(PrototypeRegistry::class)) { |
|
36 | + if ($container === null || !$container->has(PrototypeRegistry::class)){ |
|
37 | 37 | throw new ScopeException( |
38 | 38 | "Unable to resolve prototyped dependency `{$name}`, invalid container scope" |
39 | 39 | ); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $target === null || |
48 | 48 | $target instanceof \Throwable || |
49 | 49 | $target->type->fullName === null |
50 | - ) { |
|
50 | + ){ |
|
51 | 51 | throw new PrototypeException( |
52 | 52 | "Undefined prototype property `{$name}`", |
53 | 53 | 0, |
@@ -33,7 +33,8 @@ |
||
33 | 33 | public function __get(string $name) |
34 | 34 | { |
35 | 35 | $container = ContainerScope::getContainer(); |
36 | - if ($container === null || !$container->has(PrototypeRegistry::class)) { |
|
36 | + if ($container === null || !$container->has(PrototypeRegistry::class)) |
|
37 | + { |
|
37 | 38 | throw new ScopeException( |
38 | 39 | "Unable to resolve prototyped dependency `{$name}`, invalid container scope" |
39 | 40 | ); |
@@ -64,15 +64,15 @@ |
||
64 | 64 | public function resolveProperty(string $name) |
65 | 65 | { |
66 | 66 | $dependency = $this->dependencies[$name] ?? null; |
67 | - if ($dependency === null) { |
|
67 | + if ($dependency === null){ |
|
68 | 68 | return null; |
69 | 69 | } |
70 | 70 | |
71 | - try { |
|
71 | + try{ |
|
72 | 72 | $this->container->get($dependency->type->name()); |
73 | 73 | |
74 | 74 | return $dependency; |
75 | - } catch (ContainerExceptionInterface $e) { |
|
75 | + }catch (ContainerExceptionInterface $e){ |
|
76 | 76 | return $e; |
77 | 77 | } |
78 | 78 | } |
@@ -64,15 +64,19 @@ |
||
64 | 64 | public function resolveProperty(string $name) |
65 | 65 | { |
66 | 66 | $dependency = $this->dependencies[$name] ?? null; |
67 | - if ($dependency === null) { |
|
67 | + if ($dependency === null) |
|
68 | + { |
|
68 | 69 | return null; |
69 | 70 | } |
70 | 71 | |
71 | - try { |
|
72 | + try |
|
73 | + { |
|
72 | 74 | $this->container->get($dependency->type->name()); |
73 | 75 | |
74 | 76 | return $dependency; |
75 | - } catch (ContainerExceptionInterface $e) { |
|
77 | + } |
|
78 | + catch (ContainerExceptionInterface $e) |
|
79 | + { |
|
76 | 80 | return $e; |
77 | 81 | } |
78 | 82 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public static function shortName(string $name): string |
26 | 26 | { |
27 | 27 | $pos = mb_strrpos($name, '\\'); |
28 | - if ($pos === false) { |
|
28 | + if ($pos === false){ |
|
29 | 29 | return $name; |
30 | 30 | } |
31 | 31 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public static function trimTrailingDigits(string $name, int $number): string |
59 | 59 | { |
60 | 60 | $pos = mb_strripos($name, (string)$number); |
61 | - if ($pos === false) { |
|
61 | + if ($pos === false){ |
|
62 | 62 | return $name; |
63 | 63 | } |
64 | 64 |
@@ -25,7 +25,8 @@ discard block |
||
25 | 25 | public static function shortName(string $name): string |
26 | 26 | { |
27 | 27 | $pos = mb_strrpos($name, '\\'); |
28 | - if ($pos === false) { |
|
28 | + if ($pos === false) |
|
29 | + { |
|
29 | 30 | return $name; |
30 | 31 | } |
31 | 32 | |
@@ -58,7 +59,8 @@ discard block |
||
58 | 59 | public static function trimTrailingDigits(string $name, int $number): string |
59 | 60 | { |
60 | 61 | $pos = mb_strripos($name, (string)$number); |
61 | - if ($pos === false) { |
|
62 | + if ($pos === false) |
|
63 | + { |
|
62 | 64 | return $name; |
63 | 65 | } |
64 | 66 |
@@ -57,7 +57,7 @@ |
||
57 | 57 | private function traverse(string $code, NodeVisitor ...$visitors): void |
58 | 58 | { |
59 | 59 | $tr = new NodeTraverser(); |
60 | - foreach ($visitors as $visitor) { |
|
60 | + foreach ($visitors as $visitor){ |
|
61 | 61 | $tr->addVisitor($visitor); |
62 | 62 | } |
63 | 63 |
@@ -57,7 +57,8 @@ |
||
57 | 57 | private function traverse(string $code, NodeVisitor ...$visitors): void |
58 | 58 | { |
59 | 59 | $tr = new NodeTraverser(); |
60 | - foreach ($visitors as $visitor) { |
|
60 | + foreach ($visitors as $visitor) |
|
61 | + { |
|
61 | 62 | $tr->addVisitor($visitor); |
62 | 63 | } |
63 | 64 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $e = new PropertyExtractor(); |
22 | 22 | |
23 | 23 | $expected = ['test', 'test2', 'test3', 'testClass']; |
24 | - $prototypes = $e->getPrototypeProperties(file_get_contents(__DIR__ . '/Fixtures/TestClass.php')); |
|
24 | + $prototypes = $e->getPrototypeProperties(file_get_contents(__DIR__.'/Fixtures/TestClass.php')); |
|
25 | 25 | sort($prototypes); |
26 | 26 | $this->assertSame($expected, $prototypes); |
27 | 27 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $e = new PropertyExtractor(); |
32 | 32 | $this->assertSame( |
33 | 33 | [], |
34 | - $e->getPrototypeProperties(file_get_contents(__DIR__ . '/Fixtures/HydratedClass.php')) |
|
34 | + $e->getPrototypeProperties(file_get_contents(__DIR__.'/Fixtures/HydratedClass.php')) |
|
35 | 35 | ); |
36 | 36 | } |
37 | 37 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function testNoClass(): void |
19 | 19 | { |
20 | 20 | $this->expectException(ClassNotDeclaredException::class); |
21 | - $this->getExtractor()->extract(dirname(__DIR__) . '/Fixtures/noClass.php', []); |
|
21 | + $this->getExtractor()->extract(dirname(__DIR__).'/Fixtures/noClass.php', []); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | private function getExtractor(): NodeExtractor |
@@ -28,15 +28,15 @@ |
||
28 | 28 | // empty input |
29 | 29 | [[], 5, 5], |
30 | 30 | // in the gap (not taken) |
31 | - [[3, 4, 8, 9,], 6, 6], |
|
32 | - [[3, 4, 8, 9,], 1, 1], |
|
31 | + [[3, 4, 8, 9, ], 6, 6], |
|
32 | + [[3, 4, 8, 9, ], 1, 1], |
|
33 | 33 | // in the sequence (taken) |
34 | - [[3, 4, 8, 9,], 4, 0], |
|
35 | - [[0, 1, 4, 5,], 5, 2], |
|
34 | + [[3, 4, 8, 9, ], 4, 0], |
|
35 | + [[0, 1, 4, 5, ], 5, 2], |
|
36 | 36 | // do not use "1" |
37 | - [[0, 3, 4, 8,], 4, 2], |
|
37 | + [[0, 3, 4, 8, ], 4, 2], |
|
38 | 38 | // full sequence, take next |
39 | - [[0, 1, 2, 3,], 3, 4], |
|
39 | + [[0, 1, 2, 3, ], 3, 4], |
|
40 | 40 | [[0], 0, 2], |
41 | 41 | ]; |
42 | 42 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | ?int $int = 123, |
21 | 21 | \StdClass $nullableClass2 = null, |
22 | 22 | string ...$variadicVar |
23 | - ) { |
|
23 | + ){ |
|
24 | 24 | $var2 = new ATest3(); |
25 | 25 | } |
26 | 26 | } |
@@ -13,12 +13,12 @@ |
||
13 | 13 | */ |
14 | 14 | public static function getParams(string $method): array |
15 | 15 | { |
16 | - try { |
|
16 | + try{ |
|
17 | 17 | $rc = new \ReflectionClass(self::class); |
18 | 18 | $method = $rc->getMethod($method); |
19 | 19 | |
20 | 20 | return $method->getParameters(); |
21 | - } catch (\ReflectionException $e) { |
|
21 | + }catch (\ReflectionException $e){ |
|
22 | 22 | return []; |
23 | 23 | } |
24 | 24 | } |
@@ -13,12 +13,15 @@ |
||
13 | 13 | */ |
14 | 14 | public static function getParams(string $method): array |
15 | 15 | { |
16 | - try { |
|
16 | + try |
|
17 | + { |
|
17 | 18 | $rc = new \ReflectionClass(self::class); |
18 | 19 | $method = $rc->getMethod($method); |
19 | 20 | |
20 | 21 | return $method->getParameters(); |
21 | - } catch (\ReflectionException $e) { |
|
22 | + } |
|
23 | + catch (\ReflectionException $e) |
|
24 | + { |
|
22 | 25 | return []; |
23 | 26 | } |
24 | 27 | } |