@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $expected, |
236 | 236 | string $expectedException = null |
237 | 237 | ): void { |
238 | - if ($expectedException !== null) { |
|
238 | + if ($expectedException !== null){ |
|
239 | 239 | $this->expectException($expectedException); |
240 | 240 | } |
241 | 241 | |
@@ -297,15 +297,15 @@ discard block |
||
297 | 297 | private function paginatorInput(int $page = null, int $limit = null): array |
298 | 298 | { |
299 | 299 | $result = []; |
300 | - if ($page === null && $limit === null) { |
|
300 | + if ($page === null && $limit === null){ |
|
301 | 301 | return $result; |
302 | 302 | } |
303 | 303 | |
304 | - if ($page !== null) { |
|
304 | + if ($page !== null){ |
|
305 | 305 | $result['page'] = $page; |
306 | 306 | } |
307 | 307 | |
308 | - if ($limit !== null) { |
|
308 | + if ($limit !== null){ |
|
309 | 309 | $result['limit'] = $limit; |
310 | 310 | } |
311 | 311 |
@@ -235,7 +235,8 @@ discard block |
||
235 | 235 | $expected, |
236 | 236 | string $expectedException = null |
237 | 237 | ): void { |
238 | - if ($expectedException !== null) { |
|
238 | + if ($expectedException !== null) |
|
239 | + { |
|
239 | 240 | $this->expectException($expectedException); |
240 | 241 | } |
241 | 242 | |
@@ -297,15 +298,18 @@ discard block |
||
297 | 298 | private function paginatorInput(int $page = null, int $limit = null): array |
298 | 299 | { |
299 | 300 | $result = []; |
300 | - if ($page === null && $limit === null) { |
|
301 | + if ($page === null && $limit === null) |
|
302 | + { |
|
301 | 303 | return $result; |
302 | 304 | } |
303 | 305 | |
304 | - if ($page !== null) { |
|
306 | + if ($page !== null) |
|
307 | + { |
|
305 | 308 | $result['page'] = $page; |
306 | 309 | } |
307 | 310 | |
308 | - if ($limit !== null) { |
|
311 | + if ($limit !== null) |
|
312 | + { |
|
309 | 313 | $result['limit'] = $limit; |
310 | 314 | } |
311 | 315 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $grid = $grid->withView('ucfirst'); |
57 | 57 | |
58 | 58 | $iterated = []; |
59 | - foreach ($grid->getIterator() as $value) { |
|
59 | + foreach ($grid->getIterator() as $value){ |
|
60 | 60 | $iterated[] = $value; |
61 | 61 | } |
62 | 62 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $grid = $grid->withSource(['a', 'b', 'c', 'hello']); |
73 | 73 | |
74 | 74 | $iterated = []; |
75 | - foreach ($grid->getIterator() as $value) { |
|
75 | + foreach ($grid->getIterator() as $value){ |
|
76 | 76 | $iterated[] = $value; |
77 | 77 | } |
78 | 78 |
@@ -56,7 +56,8 @@ discard block |
||
56 | 56 | $grid = $grid->withView('ucfirst'); |
57 | 57 | |
58 | 58 | $iterated = []; |
59 | - foreach ($grid->getIterator() as $value) { |
|
59 | + foreach ($grid->getIterator() as $value) |
|
60 | + { |
|
60 | 61 | $iterated[] = $value; |
61 | 62 | } |
62 | 63 | |
@@ -72,7 +73,8 @@ discard block |
||
72 | 73 | $grid = $grid->withSource(['a', 'b', 'c', 'hello']); |
73 | 74 | |
74 | 75 | $iterated = []; |
75 | - foreach ($grid->getIterator() as $value) { |
|
76 | + foreach ($grid->getIterator() as $value) |
|
77 | + { |
|
76 | 78 | $iterated[] = $value; |
77 | 79 | } |
78 | 80 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function fullName(): string |
33 | 33 | { |
34 | 34 | $name = $this->name; |
35 | - if ($this->sequence > 0) { |
|
35 | + if ($this->sequence > 0){ |
|
36 | 36 | $name .= $this->sequence; |
37 | 37 | } |
38 | 38 |
@@ -32,7 +32,8 @@ |
||
32 | 32 | public function fullName(): string |
33 | 33 | { |
34 | 34 | $name = $this->name; |
35 | - if ($this->sequence > 0) { |
|
35 | + if ($this->sequence > 0) |
|
36 | + { |
|
36 | 37 | $name .= $this->sequence; |
37 | 38 | } |
38 | 39 |
@@ -24,21 +24,21 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function find(array $sequences, int $originSequence): int |
26 | 26 | { |
27 | - if (empty($sequences) || $originSequence > max($sequences)) { |
|
27 | + if (empty($sequences) || $originSequence > max($sequences)){ |
|
28 | 28 | return $originSequence; |
29 | 29 | } |
30 | 30 | |
31 | 31 | $gaps = $this->skippedSequences($sequences); |
32 | 32 | |
33 | - if (isset($gaps[$originSequence])) { |
|
33 | + if (isset($gaps[$originSequence])){ |
|
34 | 34 | return $originSequence; |
35 | 35 | } |
36 | 36 | |
37 | 37 | //we do not add "1" as postfix: $var, $var2, $var3, etc |
38 | 38 | unset($gaps[1]); |
39 | - if (empty($gaps)) { |
|
39 | + if (empty($gaps)){ |
|
40 | 40 | $max = max($sequences); |
41 | - if ($max === 0) { |
|
41 | + if ($max === 0){ |
|
42 | 42 | return 2; |
43 | 43 | } |
44 | 44 | |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | { |
57 | 57 | $skipped = []; |
58 | 58 | $max = max($sequences); |
59 | - for ($i = 0; $i < $max; $i++) { |
|
60 | - if (!in_array($i, $sequences, true)) { |
|
59 | + for ($i = 0; $i < $max; $i++){ |
|
60 | + if (!in_array($i, $sequences, true)){ |
|
61 | 61 | $skipped[$i] = $i; |
62 | 62 | } |
63 | 63 | } |
@@ -24,21 +24,25 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function find(array $sequences, int $originSequence): int |
26 | 26 | { |
27 | - if (empty($sequences) || $originSequence > max($sequences)) { |
|
27 | + if (empty($sequences) || $originSequence > max($sequences)) |
|
28 | + { |
|
28 | 29 | return $originSequence; |
29 | 30 | } |
30 | 31 | |
31 | 32 | $gaps = $this->skippedSequences($sequences); |
32 | 33 | |
33 | - if (isset($gaps[$originSequence])) { |
|
34 | + if (isset($gaps[$originSequence])) |
|
35 | + { |
|
34 | 36 | return $originSequence; |
35 | 37 | } |
36 | 38 | |
37 | 39 | //we do not add "1" as postfix: $var, $var2, $var3, etc |
38 | 40 | unset($gaps[1]); |
39 | - if (empty($gaps)) { |
|
41 | + if (empty($gaps)) |
|
42 | + { |
|
40 | 43 | $max = max($sequences); |
41 | - if ($max === 0) { |
|
44 | + if ($max === 0) |
|
45 | + { |
|
42 | 46 | return 2; |
43 | 47 | } |
44 | 48 | |
@@ -56,8 +60,10 @@ discard block |
||
56 | 60 | { |
57 | 61 | $skipped = []; |
58 | 62 | $max = max($sequences); |
59 | - for ($i = 0; $i < $max; $i++) { |
|
60 | - if (!in_array($i, $sequences, true)) { |
|
63 | + for ($i = 0; $i < $max; $i++) |
|
64 | + { |
|
65 | + if (!in_array($i, $sequences, true)) |
|
66 | + { |
|
61 | 67 | $skipped[$i] = $i; |
62 | 68 | } |
63 | 69 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $type = new self(); |
34 | 34 | |
35 | 35 | $fullName = null; |
36 | - if ($type->hasShortName($name)) { |
|
36 | + if ($type->hasShortName($name)){ |
|
37 | 37 | $fullName = $name; |
38 | 38 | $name = Utils::shortName($name); |
39 | 39 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function getSlashedShortName(bool $builtIn): string |
60 | 60 | { |
61 | 61 | $type = $this->shortName; |
62 | - if (!$builtIn && !$this->fullName) { |
|
62 | + if (!$builtIn && !$this->fullName){ |
|
63 | 63 | $type = "\\$type"; |
64 | 64 | } |
65 | 65 |
@@ -33,7 +33,8 @@ discard block |
||
33 | 33 | $type = new self(); |
34 | 34 | |
35 | 35 | $fullName = null; |
36 | - if ($type->hasShortName($name)) { |
|
36 | + if ($type->hasShortName($name)) |
|
37 | + { |
|
37 | 38 | $fullName = $name; |
38 | 39 | $name = Utils::shortName($name); |
39 | 40 | } |
@@ -59,7 +60,8 @@ discard block |
||
59 | 60 | public function getSlashedShortName(bool $builtIn): string |
60 | 61 | { |
61 | 62 | $type = $this->shortName; |
62 | - if (!$builtIn && !$this->fullName) { |
|
63 | + if (!$builtIn && !$this->fullName) |
|
64 | + { |
|
63 | 65 | $type = "\\$type"; |
64 | 66 | } |
65 | 67 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $prototypeBootloader->initAnnotations($this->container, true); |
34 | 34 | |
35 | 35 | $dependencies = $this->registry->getPropertyBindings(); |
36 | - if ($dependencies === []) { |
|
36 | + if ($dependencies === []){ |
|
37 | 37 | $this->writeln('<comment>No prototyped shortcuts found.</comment>'); |
38 | 38 | return; |
39 | 39 | } |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | |
43 | 43 | $trait = new \ReflectionClass(PrototypeTrait::class); |
44 | 44 | $docComment = $trait->getDocComment(); |
45 | - if ($docComment === false) { |
|
45 | + if ($docComment === false){ |
|
46 | 46 | $this->write('<fg=reg>DOCComment is missing</fg=red>'); |
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | 50 | $filename = $trait->getFileName(); |
51 | 51 | |
52 | - try { |
|
52 | + try{ |
|
53 | 53 | file_put_contents( |
54 | 54 | $filename, |
55 | 55 | str_replace( |
@@ -58,17 +58,17 @@ discard block |
||
58 | 58 | file_get_contents($filename) |
59 | 59 | ) |
60 | 60 | ); |
61 | - } catch (\Throwable $e) { |
|
62 | - $this->write('<fg=red>' . $e->getMessage() . "</fg=red>\n"); |
|
61 | + }catch (\Throwable $e){ |
|
62 | + $this->write('<fg=red>'.$e->getMessage()."</fg=red>\n"); |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $this->write("<fg=green>complete</fg=green>\n"); |
67 | 67 | |
68 | - if ($this->isVerbose()) { |
|
68 | + if ($this->isVerbose()){ |
|
69 | 69 | $grid = $this->table(['Property:', 'Target:']); |
70 | 70 | |
71 | - foreach ($dependencies as $dependency) { |
|
71 | + foreach ($dependencies as $dependency){ |
|
72 | 72 | $grid->addRow([$dependency->var, $dependency->type->fullName]); |
73 | 73 | } |
74 | 74 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ); |
89 | 89 | $an->lines[] = new Annotation\Line(''); |
90 | 90 | |
91 | - foreach ($dependencies as $dependency) { |
|
91 | + foreach ($dependencies as $dependency){ |
|
92 | 92 | $an->lines[] = new Annotation\Line( |
93 | 93 | sprintf('\\%s $%s', $dependency->type->fullName, $dependency->var), |
94 | 94 | 'property' |
@@ -33,7 +33,8 @@ discard block |
||
33 | 33 | $prototypeBootloader->initAnnotations($this->container, true); |
34 | 34 | |
35 | 35 | $dependencies = $this->registry->getPropertyBindings(); |
36 | - if ($dependencies === []) { |
|
36 | + if ($dependencies === []) |
|
37 | + { |
|
37 | 38 | $this->writeln('<comment>No prototyped shortcuts found.</comment>'); |
38 | 39 | return; |
39 | 40 | } |
@@ -42,14 +43,16 @@ discard block |
||
42 | 43 | |
43 | 44 | $trait = new \ReflectionClass(PrototypeTrait::class); |
44 | 45 | $docComment = $trait->getDocComment(); |
45 | - if ($docComment === false) { |
|
46 | + if ($docComment === false) |
|
47 | + { |
|
46 | 48 | $this->write('<fg=reg>DOCComment is missing</fg=red>'); |
47 | 49 | return; |
48 | 50 | } |
49 | 51 | |
50 | 52 | $filename = $trait->getFileName(); |
51 | 53 | |
52 | - try { |
|
54 | + try |
|
55 | + { |
|
53 | 56 | file_put_contents( |
54 | 57 | $filename, |
55 | 58 | str_replace( |
@@ -58,17 +61,21 @@ discard block |
||
58 | 61 | file_get_contents($filename) |
59 | 62 | ) |
60 | 63 | ); |
61 | - } catch (\Throwable $e) { |
|
64 | + } |
|
65 | + catch (\Throwable $e) |
|
66 | + { |
|
62 | 67 | $this->write('<fg=red>' . $e->getMessage() . "</fg=red>\n"); |
63 | 68 | return; |
64 | 69 | } |
65 | 70 | |
66 | 71 | $this->write("<fg=green>complete</fg=green>\n"); |
67 | 72 | |
68 | - if ($this->isVerbose()) { |
|
73 | + if ($this->isVerbose()) |
|
74 | + { |
|
69 | 75 | $grid = $this->table(['Property:', 'Target:']); |
70 | 76 | |
71 | - foreach ($dependencies as $dependency) { |
|
77 | + foreach ($dependencies as $dependency) |
|
78 | + { |
|
72 | 79 | $grid->addRow([$dependency->var, $dependency->type->fullName]); |
73 | 80 | } |
74 | 81 | |
@@ -88,7 +95,8 @@ discard block |
||
88 | 95 | ); |
89 | 96 | $an->lines[] = new Annotation\Line(''); |
90 | 97 | |
91 | - foreach ($dependencies as $dependency) { |
|
98 | + foreach ($dependencies as $dependency) |
|
99 | + { |
|
92 | 100 | $an->lines[] = new Annotation\Line( |
93 | 101 | sprintf('\\%s $%s', $dependency->type->fullName, $dependency->var), |
94 | 102 | 'property' |
@@ -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 |