@@ -19,13 +19,13 @@ |
||
19 | 19 | |
20 | 20 | public function __construct( |
21 | 21 | private readonly Handler $coreHandler |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** @inheritdoc */ |
26 | 26 | public function push(string $name, array $payload = [], OptionsInterface $options = null): string |
27 | 27 | { |
28 | - if ($options !== null && $options->getDelay()) { |
|
28 | + if ($options !== null && $options->getDelay()){ |
|
29 | 29 | \sleep($options->getDelay()); |
30 | 30 | } |
31 | 31 |
@@ -25,7 +25,8 @@ |
||
25 | 25 | /** @inheritdoc */ |
26 | 26 | public function push(string $name, array $payload = [], OptionsInterface $options = null): string |
27 | 27 | { |
28 | - if ($options !== null && $options->getDelay()) { |
|
28 | + if ($options !== null && $options->getDelay()) |
|
29 | + { |
|
29 | 30 | \sleep($options->getDelay()); |
30 | 31 | } |
31 | 32 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public function __construct( |
24 | 24 | private readonly HandlerRegistryInterface $registry, |
25 | 25 | private readonly ?EventDispatcherInterface $dispatcher = null |
26 | - ) { |
|
26 | + ){ |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -13,16 +13,16 @@ |
||
13 | 13 | { |
14 | 14 | public function __construct( |
15 | 15 | private readonly FailedJobHandlerInterface $handler |
16 | - ) { |
|
16 | + ){ |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** @psalm-suppress ParamNameMismatch */ |
20 | 20 | public function process(string $name, string $action, array $parameters, CoreInterface $core): mixed |
21 | 21 | { |
22 | - try { |
|
22 | + try{ |
|
23 | 23 | return $core->callAction($name, $action, $parameters); |
24 | - } catch (\Throwable $e) { |
|
25 | - if (!$e instanceof StateException) { |
|
24 | + }catch (\Throwable $e){ |
|
25 | + if (!$e instanceof StateException){ |
|
26 | 26 | $this->handler->handle( |
27 | 27 | $parameters['driver'], |
28 | 28 | $parameters['queue'], |
@@ -19,10 +19,14 @@ |
||
19 | 19 | /** @psalm-suppress ParamNameMismatch */ |
20 | 20 | public function process(string $name, string $action, array $parameters, CoreInterface $core): mixed |
21 | 21 | { |
22 | - try { |
|
22 | + try |
|
23 | + { |
|
23 | 24 | return $core->callAction($name, $action, $parameters); |
24 | - } catch (\Throwable $e) { |
|
25 | - if (!$e instanceof StateException) { |
|
25 | + } |
|
26 | + catch (\Throwable $e) |
|
27 | + { |
|
28 | + if (!$e instanceof StateException) |
|
29 | + { |
|
26 | 30 | $this->handler->handle( |
27 | 31 | $parameters['driver'], |
28 | 32 | $parameters['queue'], |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public function __construct( |
12 | 12 | private readonly CoreInterface $core |
13 | - ) { |
|
13 | + ){ |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | /** |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | |
30 | 30 | public function __construct($name = null, array $data = [], $dataName = '') |
31 | 31 | { |
32 | - $this->storage = new Storage($this->dir() . '/Fixtures/'); |
|
32 | + $this->storage = new Storage($this->dir().'/Fixtures/'); |
|
33 | 33 | parent::__construct($name, $data, $dataName); |
34 | 34 | } |
35 | 35 | |
36 | 36 | public function setUp(): void |
37 | 37 | { |
38 | - if (!\class_exists(Kernel::class)) { |
|
38 | + if (!\class_exists(Kernel::class)){ |
|
39 | 39 | $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests'); |
40 | 40 | } |
41 | 41 | |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | 'cache' => sys_get_temp_dir() |
47 | 47 | ], false)->run(); |
48 | 48 | |
49 | - foreach (static::STORE as $name) { |
|
49 | + foreach (static::STORE as $name){ |
|
50 | 50 | $this->storage->store($name); |
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | 54 | public function tearDown(): void |
55 | 55 | { |
56 | - foreach (static::STORE as $name) { |
|
56 | + foreach (static::STORE as $name){ |
|
57 | 57 | $this->storage->restore($name); |
58 | 58 | } |
59 | 59 | } |
@@ -35,7 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | public function setUp(): void |
37 | 37 | { |
38 | - if (!\class_exists(Kernel::class)) { |
|
38 | + if (!\class_exists(Kernel::class)) |
|
39 | + { |
|
39 | 40 | $this->markTestSkipped('A "spiral/framework" dependency is required to run these tests'); |
40 | 41 | } |
41 | 42 | |
@@ -46,14 +47,16 @@ discard block |
||
46 | 47 | 'cache' => sys_get_temp_dir() |
47 | 48 | ], false)->run(); |
48 | 49 | |
49 | - foreach (static::STORE as $name) { |
|
50 | + foreach (static::STORE as $name) |
|
51 | + { |
|
50 | 52 | $this->storage->store($name); |
51 | 53 | } |
52 | 54 | } |
53 | 55 | |
54 | 56 | public function tearDown(): void |
55 | 57 | { |
56 | - foreach (static::STORE as $name) { |
|
58 | + foreach (static::STORE as $name) |
|
59 | + { |
|
57 | 60 | $this->storage->restore($name); |
58 | 61 | } |
59 | 62 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function __construct( |
13 | 13 | private readonly ScopedClassesInterface $classes |
14 | - ) { |
|
14 | + ){ |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | private readonly ConflictResolver\Names $namesResolver, |
26 | 26 | private readonly ConflictResolver\Namespaces $namespacesResolver, |
27 | 27 | Parser $parser = null |
28 | - ) { |
|
28 | + ){ |
|
29 | 29 | $this->parser = $parser ?? (new ParserFactory())->create(ParserFactory::ONLY_PHP7); |
30 | 30 | } |
31 | 31 | |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | $declarator = new DeclareClass(); |
59 | 59 | $this->traverse($filename, $declarator); |
60 | 60 | |
61 | - if (empty($declarator->getClass())) { |
|
61 | + if (empty($declarator->getClass())){ |
|
62 | 62 | throw new ClassNotDeclaredException($filename); |
63 | 63 | } |
64 | 64 | |
65 | - if ($declarator->getNamespace()) { |
|
65 | + if ($declarator->getNamespace()){ |
|
66 | 66 | return ClassNode::createWithNamespace($declarator->getClass(), $declarator->getNamespace()); |
67 | 67 | } |
68 | 68 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $tr = new NodeTraverser(); |
75 | 75 | |
76 | - foreach ($visitors as $visitor) { |
|
76 | + foreach ($visitors as $visitor){ |
|
77 | 77 | $tr->addVisitor($visitor); |
78 | 78 | } |
79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | private function fillStmts(ClassNode $definition, array $imports): void |
84 | 84 | { |
85 | - foreach ($imports as $import) { |
|
85 | + foreach ($imports as $import){ |
|
86 | 86 | $definition->addImportUsage($import['name'], $import['alias']); |
87 | 87 | } |
88 | 88 | } |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | $reflection = new \ReflectionClass(\sprintf('%s\%s', $definition->namespace, $definition->class)); |
96 | 96 | |
97 | 97 | $constructor = $reflection->getConstructor(); |
98 | - if ($constructor !== null) { |
|
98 | + if ($constructor !== null){ |
|
99 | 99 | $definition->hasConstructor = $constructor->getDeclaringClass()->getName() === $reflection->getName(); |
100 | 100 | |
101 | - foreach ($reflection->getConstructor()->getParameters() as $parameter) { |
|
101 | + foreach ($reflection->getConstructor()->getParameters() as $parameter){ |
|
102 | 102 | $definition->addParam($parameter); |
103 | 103 | } |
104 | 104 | } |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | */ |
111 | 111 | private function fillConstructorVars(array $vars, ClassNode $definition): void |
112 | 112 | { |
113 | - foreach ($vars as $k => $var) { |
|
114 | - if (isset($definition->constructorParams[$var])) { |
|
113 | + foreach ($vars as $k => $var){ |
|
114 | + if (isset($definition->constructorParams[$var])){ |
|
115 | 115 | unset($vars[$k]); |
116 | 116 | } |
117 | 117 | } |
@@ -58,11 +58,13 @@ discard block |
||
58 | 58 | $declarator = new DeclareClass(); |
59 | 59 | $this->traverse($filename, $declarator); |
60 | 60 | |
61 | - if (empty($declarator->getClass())) { |
|
61 | + if (empty($declarator->getClass())) |
|
62 | + { |
|
62 | 63 | throw new ClassNotDeclaredException($filename); |
63 | 64 | } |
64 | 65 | |
65 | - if ($declarator->getNamespace()) { |
|
66 | + if ($declarator->getNamespace()) |
|
67 | + { |
|
66 | 68 | return ClassNode::createWithNamespace($declarator->getClass(), $declarator->getNamespace()); |
67 | 69 | } |
68 | 70 | |
@@ -73,7 +75,8 @@ discard block |
||
73 | 75 | { |
74 | 76 | $tr = new NodeTraverser(); |
75 | 77 | |
76 | - foreach ($visitors as $visitor) { |
|
78 | + foreach ($visitors as $visitor) |
|
79 | + { |
|
77 | 80 | $tr->addVisitor($visitor); |
78 | 81 | } |
79 | 82 | |
@@ -82,7 +85,8 @@ discard block |
||
82 | 85 | |
83 | 86 | private function fillStmts(ClassNode $definition, array $imports): void |
84 | 87 | { |
85 | - foreach ($imports as $import) { |
|
88 | + foreach ($imports as $import) |
|
89 | + { |
|
86 | 90 | $definition->addImportUsage($import['name'], $import['alias']); |
87 | 91 | } |
88 | 92 | } |
@@ -95,10 +99,12 @@ discard block |
||
95 | 99 | $reflection = new \ReflectionClass(\sprintf('%s\%s', $definition->namespace, $definition->class)); |
96 | 100 | |
97 | 101 | $constructor = $reflection->getConstructor(); |
98 | - if ($constructor !== null) { |
|
102 | + if ($constructor !== null) |
|
103 | + { |
|
99 | 104 | $definition->hasConstructor = $constructor->getDeclaringClass()->getName() === $reflection->getName(); |
100 | 105 | |
101 | - foreach ($reflection->getConstructor()->getParameters() as $parameter) { |
|
106 | + foreach ($reflection->getConstructor()->getParameters() as $parameter) |
|
107 | + { |
|
102 | 108 | $definition->addParam($parameter); |
103 | 109 | } |
104 | 110 | } |
@@ -110,8 +116,10 @@ discard block |
||
110 | 116 | */ |
111 | 117 | private function fillConstructorVars(array $vars, ClassNode $definition): void |
112 | 118 | { |
113 | - foreach ($vars as $k => $var) { |
|
114 | - if (isset($definition->constructorParams[$var])) { |
|
119 | + foreach ($vars as $k => $var) |
|
120 | + { |
|
121 | + if (isset($definition->constructorParams[$var])) |
|
122 | + { |
|
115 | 123 | unset($vars[$k]); |
116 | 124 | } |
117 | 125 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function __construct( |
30 | 30 | Lexer $lexer = null, |
31 | 31 | private readonly PrettyPrinterAbstract $printer = new Standard() |
32 | - ) { |
|
32 | + ){ |
|
33 | 33 | $this->lexer = $lexer ?? new Lexer\Emulative([ |
34 | 34 | 'usedAttributes' => [ |
35 | 35 | 'comments', |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | bool $useTypedProperties = false, |
58 | 58 | bool $noPhpDoc = false |
59 | 59 | ): string { |
60 | - if (empty($node->dependencies)) { |
|
61 | - if ($removeTrait) { |
|
60 | + if (empty($node->dependencies)){ |
|
61 | + if ($removeTrait){ |
|
62 | 62 | $tr = new NodeTraverser(); |
63 | 63 | $tr->addVisitor(new RemoveUse()); |
64 | 64 | $tr->addVisitor(new RemoveTrait()); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $tr = new NodeTraverser(); |
73 | 73 | $tr->addVisitor(new AddUse($node)); |
74 | 74 | |
75 | - if ($removeTrait) { |
|
75 | + if ($removeTrait){ |
|
76 | 76 | $tr->addVisitor(new RemoveUse()); |
77 | 77 | $tr->addVisitor(new RemoveTrait()); |
78 | 78 | } |
@@ -57,8 +57,10 @@ discard block |
||
57 | 57 | bool $useTypedProperties = false, |
58 | 58 | bool $noPhpDoc = false |
59 | 59 | ): string { |
60 | - if (empty($node->dependencies)) { |
|
61 | - if ($removeTrait) { |
|
60 | + if (empty($node->dependencies)) |
|
61 | + { |
|
62 | + if ($removeTrait) |
|
63 | + { |
|
62 | 64 | $tr = new NodeTraverser(); |
63 | 65 | $tr->addVisitor(new RemoveUse()); |
64 | 66 | $tr->addVisitor(new RemoveTrait()); |
@@ -72,7 +74,8 @@ discard block |
||
72 | 74 | $tr = new NodeTraverser(); |
73 | 75 | $tr->addVisitor(new AddUse($node)); |
74 | 76 | |
75 | - if ($removeTrait) { |
|
77 | + if ($removeTrait) |
|
78 | + { |
|
76 | 79 | $tr->addVisitor(new RemoveUse()); |
77 | 80 | $tr->addVisitor(new RemoveTrait()); |
78 | 81 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public static function shortName(string $name): string |
21 | 21 | { |
22 | 22 | $pos = \mb_strrpos($name, '\\'); |
23 | - if ($pos === false) { |
|
23 | + if ($pos === false){ |
|
24 | 24 | return $name; |
25 | 25 | } |
26 | 26 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public static function trimTrailingDigits(string $name, int $number): string |
45 | 45 | { |
46 | 46 | $pos = \mb_strripos($name, (string)$number); |
47 | - if ($pos === false) { |
|
47 | + if ($pos === false){ |
|
48 | 48 | return $name; |
49 | 49 | } |
50 | 50 |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | public static function shortName(string $name): string |
21 | 21 | { |
22 | 22 | $pos = \mb_strrpos($name, '\\'); |
23 | - if ($pos === false) { |
|
23 | + if ($pos === false) |
|
24 | + { |
|
24 | 25 | return $name; |
25 | 26 | } |
26 | 27 | |
@@ -44,7 +45,8 @@ discard block |
||
44 | 45 | public static function trimTrailingDigits(string $name, int $number): string |
45 | 46 | { |
46 | 47 | $pos = \mb_strripos($name, (string)$number); |
47 | - if ($pos === false) { |
|
48 | + if ($pos === false) |
|
49 | + { |
|
48 | 50 | return $name; |
49 | 51 | } |
50 | 52 |