@@ -26,11 +26,11 @@ |
||
26 | 26 | */ |
27 | 27 | public function enterNode(Node $node) |
28 | 28 | { |
29 | - if ($node instanceof Node\Stmt\Namespace_) { |
|
29 | + if ($node instanceof Node\Stmt\Namespace_){ |
|
30 | 30 | $this->namespace = implode('\\', $node->name->parts); |
31 | 31 | } |
32 | 32 | |
33 | - if ($node instanceof Node\Stmt\Class_) { |
|
33 | + if ($node instanceof Node\Stmt\Class_){ |
|
34 | 34 | $this->class = $node->name->name; |
35 | 35 | |
36 | 36 | return NodeTraverser::STOP_TRAVERSAL; |
@@ -26,11 +26,13 @@ |
||
26 | 26 | */ |
27 | 27 | public function enterNode(Node $node) |
28 | 28 | { |
29 | - if ($node instanceof Node\Stmt\Namespace_) { |
|
29 | + if ($node instanceof Node\Stmt\Namespace_) |
|
30 | + { |
|
30 | 31 | $this->namespace = implode('\\', $node->name->parts); |
31 | 32 | } |
32 | 33 | |
33 | - if ($node instanceof Node\Stmt\Class_) { |
|
34 | + if ($node instanceof Node\Stmt\Class_) |
|
35 | + { |
|
34 | 36 | $this->class = $node->name->name; |
35 | 37 | |
36 | 38 | return NodeTraverser::STOP_TRAVERSAL; |
@@ -28,26 +28,26 @@ |
||
28 | 28 | */ |
29 | 29 | public function leaveNode(Node $node) |
30 | 30 | { |
31 | - if (!$node instanceof Node\Stmt\TraitUse) { |
|
31 | + if (!$node instanceof Node\Stmt\TraitUse){ |
|
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | |
35 | - foreach ($node->traits as $index => $use) { |
|
36 | - if ($use instanceof Node\Name) { |
|
35 | + foreach ($node->traits as $index => $use){ |
|
36 | + if ($use instanceof Node\Name){ |
|
37 | 37 | $name = $this->trimSlashes(implode('\\', $use->parts)); |
38 | 38 | if ( |
39 | 39 | in_array($name, [ |
40 | 40 | $this->trimSlashes(PrototypeTrait::class), |
41 | 41 | Utils::shortName(PrototypeTrait::class), |
42 | 42 | ], true) |
43 | - ) { |
|
43 | + ){ |
|
44 | 44 | unset($node->traits[$index]); |
45 | 45 | } |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | 49 | $node->traits = array_values($node->traits); |
50 | - if (empty($node->traits)) { |
|
50 | + if (empty($node->traits)){ |
|
51 | 51 | return NodeTraverser::REMOVE_NODE; |
52 | 52 | } |
53 | 53 |
@@ -28,12 +28,15 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function leaveNode(Node $node) |
30 | 30 | { |
31 | - if (!$node instanceof Node\Stmt\TraitUse) { |
|
31 | + if (!$node instanceof Node\Stmt\TraitUse) |
|
32 | + { |
|
32 | 33 | return null; |
33 | 34 | } |
34 | 35 | |
35 | - foreach ($node->traits as $index => $use) { |
|
36 | - if ($use instanceof Node\Name) { |
|
36 | + foreach ($node->traits as $index => $use) |
|
37 | + { |
|
38 | + if ($use instanceof Node\Name) |
|
39 | + { |
|
37 | 40 | $name = $this->trimSlashes(implode('\\', $use->parts)); |
38 | 41 | if ( |
39 | 42 | in_array($name, [ |
@@ -47,7 +50,8 @@ discard block |
||
47 | 50 | } |
48 | 51 | |
49 | 52 | $node->traits = array_values($node->traits); |
50 | - if (empty($node->traits)) { |
|
53 | + if (empty($node->traits)) |
|
54 | + { |
|
51 | 55 | return NodeTraverser::REMOVE_NODE; |
52 | 56 | } |
53 | 57 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | |
14 | 14 | class UnionTypes |
15 | 15 | { |
16 | - public static function example(SampleClass|TypedClass $example) |
|
16 | + public static function example(SampleClass | TypedClass $example) |
|
17 | 17 | { |
18 | 18 | } |
19 | 19 | } |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @see https://github.com/symplify/symplify/issues/2061 |
12 | 12 | */ |
13 | -\register_shutdown_function(static function () { |
|
14 | - $dest = \json_decode(\file_get_contents(__DIR__ . '/composer.json'), true); |
|
13 | +\register_shutdown_function(static function (){ |
|
14 | + $dest = \json_decode(\file_get_contents(__DIR__.'/composer.json'), true); |
|
15 | 15 | |
16 | 16 | $result = [ |
17 | 17 | 'name' => 'spiral/framework', |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | $json = \json_encode($result, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES); |
48 | 48 | |
49 | - \file_put_contents(__DIR__ . '/composer.json', $json . "\n"); |
|
49 | + \file_put_contents(__DIR__.'/composer.json', $json."\n"); |
|
50 | 50 | }); |
51 | 51 | |
52 | 52 |
@@ -10,7 +10,8 @@ |
||
10 | 10 | * |
11 | 11 | * @see https://github.com/symplify/symplify/issues/2061 |
12 | 12 | */ |
13 | -\register_shutdown_function(static function () { |
|
13 | +\register_shutdown_function(static function () |
|
14 | +{ |
|
14 | 15 | $dest = \json_decode(\file_get_contents(__DIR__ . '/composer.json'), true); |
15 | 16 | |
16 | 17 | $result = [ |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | class StreamsTest extends TestCase |
19 | 19 | { |
20 | - private const FIXTURE_DIRECTORY = __DIR__ . '/fixtures'; |
|
20 | + private const FIXTURE_DIRECTORY = __DIR__.'/fixtures'; |
|
21 | 21 | |
22 | 22 | public function setUp(): void |
23 | 23 | { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $this->assertSame(strlen('sample text'), filesize($filename)); |
43 | 43 | $this->assertSame(md5('sample text'), md5_file($filename)); |
44 | 44 | |
45 | - $newFilename = self::FIXTURE_DIRECTORY . '/test.txt'; |
|
45 | + $newFilename = self::FIXTURE_DIRECTORY.'/test.txt'; |
|
46 | 46 | copy($filename, $newFilename); |
47 | 47 | |
48 | 48 | $this->assertFileExists($newFilename); |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function testException() |
85 | 85 | { |
86 | - try { |
|
86 | + try{ |
|
87 | 87 | fopen('spiral://non-exists', 'rb'); |
88 | - } catch (\Throwable $e) { |
|
88 | + }catch (\Throwable $e){ |
|
89 | 89 | $this->assertStringContainsString('failed to open stream', $e->getMessage()); |
90 | 90 | } |
91 | 91 | |
92 | - try { |
|
92 | + try{ |
|
93 | 93 | filemtime('spiral://non-exists'); |
94 | - } catch (\Throwable $e) { |
|
94 | + }catch (\Throwable $e){ |
|
95 | 95 | $this->assertStringContainsString('stat failed', $e->getMessage()); |
96 | 96 | } |
97 | 97 | } |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function testExceptionPHP8() |
103 | 103 | { |
104 | - try { |
|
104 | + try{ |
|
105 | 105 | fopen('spiral://non-exists', 'rb'); |
106 | - } catch (\Throwable $e) { |
|
106 | + }catch (\Throwable $e){ |
|
107 | 107 | $this->assertStringContainsString('Failed to open stream', $e->getMessage()); |
108 | 108 | } |
109 | 109 | |
110 | - try { |
|
110 | + try{ |
|
111 | 111 | filemtime('spiral://non-exists'); |
112 | - } catch (\Throwable $e) { |
|
112 | + }catch (\Throwable $e){ |
|
113 | 113 | $this->assertStringContainsString('stat failed', $e->getMessage()); |
114 | 114 | } |
115 | 115 | } |
@@ -83,15 +83,21 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function testException() |
85 | 85 | { |
86 | - try { |
|
86 | + try |
|
87 | + { |
|
87 | 88 | fopen('spiral://non-exists', 'rb'); |
88 | - } catch (\Throwable $e) { |
|
89 | + } |
|
90 | + catch (\Throwable $e) |
|
91 | + { |
|
89 | 92 | $this->assertStringContainsString('failed to open stream', $e->getMessage()); |
90 | 93 | } |
91 | 94 | |
92 | - try { |
|
95 | + try |
|
96 | + { |
|
93 | 97 | filemtime('spiral://non-exists'); |
94 | - } catch (\Throwable $e) { |
|
98 | + } |
|
99 | + catch (\Throwable $e) |
|
100 | + { |
|
95 | 101 | $this->assertStringContainsString('stat failed', $e->getMessage()); |
96 | 102 | } |
97 | 103 | } |
@@ -101,15 +107,21 @@ discard block |
||
101 | 107 | */ |
102 | 108 | public function testExceptionPHP8() |
103 | 109 | { |
104 | - try { |
|
110 | + try |
|
111 | + { |
|
105 | 112 | fopen('spiral://non-exists', 'rb'); |
106 | - } catch (\Throwable $e) { |
|
113 | + } |
|
114 | + catch (\Throwable $e) |
|
115 | + { |
|
107 | 116 | $this->assertStringContainsString('Failed to open stream', $e->getMessage()); |
108 | 117 | } |
109 | 118 | |
110 | - try { |
|
119 | + try |
|
120 | + { |
|
111 | 121 | filemtime('spiral://non-exists'); |
112 | - } catch (\Throwable $e) { |
|
122 | + } |
|
123 | + catch (\Throwable $e) |
|
124 | + { |
|
113 | 125 | $this->assertStringContainsString('stat failed', $e->getMessage()); |
114 | 126 | } |
115 | 127 | } |
@@ -51,11 +51,11 @@ |
||
51 | 51 | public static function unpack(array $payload): MessageInterface |
52 | 52 | { |
53 | 53 | $message = new Message($payload['subject'], $payload['to'], $payload['data']); |
54 | - if ($payload['from'] !== null) { |
|
54 | + if ($payload['from'] !== null){ |
|
55 | 55 | $message->setFrom($payload['from']); |
56 | 56 | } |
57 | 57 | |
58 | - if ($payload['replyTo'] !== null) { |
|
58 | + if ($payload['replyTo'] !== null){ |
|
59 | 59 | $message->setReplyTo($payload['replyTo']); |
60 | 60 | } |
61 | 61 |
@@ -51,11 +51,13 @@ |
||
51 | 51 | public static function unpack(array $payload): MessageInterface |
52 | 52 | { |
53 | 53 | $message = new Message($payload['subject'], $payload['to'], $payload['data']); |
54 | - if ($payload['from'] !== null) { |
|
54 | + if ($payload['from'] !== null) |
|
55 | + { |
|
55 | 56 | $message->setFrom($payload['from']); |
56 | 57 | } |
57 | 58 | |
58 | - if ($payload['replyTo'] !== null) { |
|
59 | + if ($payload['replyTo'] !== null) |
|
60 | + { |
|
59 | 61 | $message->setReplyTo($payload['replyTo']); |
60 | 62 | } |
61 | 63 |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function render(MessageInterface $message): Email |
39 | 39 | { |
40 | - try { |
|
40 | + try{ |
|
41 | 41 | $view = $this->views->get($message->getSubject()); |
42 | - } catch (ViewException $e) { |
|
42 | + }catch (ViewException $e){ |
|
43 | 43 | throw new MailerException( |
44 | 44 | sprintf('Invalid email template `%s`: %s', $message->getSubject(), $e->getMessage()), |
45 | 45 | $e->getCode(), |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $msg = new Email(); |
51 | 51 | |
52 | - if ($message->getFrom() !== null) { |
|
52 | + if ($message->getFrom() !== null){ |
|
53 | 53 | $msg->from([$message->getFrom()]); |
54 | 54 | } |
55 | 55 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $msg->cc(...$message->getCC()); |
58 | 58 | $msg->bcc(...$message->getBCC()); |
59 | 59 | |
60 | - try { |
|
60 | + try{ |
|
61 | 61 | // render message partials |
62 | 62 | $view->render(array_merge(['_msg_' => $msg], $message->getData())); |
63 | - } catch (ViewException $e) { |
|
63 | + }catch (ViewException $e){ |
|
64 | 64 | throw new MailerException( |
65 | 65 | sprintf('Unable to render email `%s`: %s', $message->getSubject(), $e->getMessage()), |
66 | 66 | $e->getCode(), |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function escapeSubject(string $subject): string |
82 | 82 | { |
83 | - if (!preg_match('/[^\x20-\x7e]/', $subject)) { |
|
83 | + if (!preg_match('/[^\x20-\x7e]/', $subject)){ |
|
84 | 84 | // ascii-only subject, return as-is |
85 | 85 | return $subject; |
86 | 86 | } |
@@ -90,6 +90,6 @@ discard block |
||
90 | 90 | $prefix = '=?UTF-8?q?'; |
91 | 91 | $suffix = '?='; |
92 | 92 | |
93 | - return $prefix . str_replace("=\r\n", $suffix . "\r\n " . $prefix, $encoded) . $suffix; |
|
93 | + return $prefix.str_replace("=\r\n", $suffix."\r\n ".$prefix, $encoded).$suffix; |
|
94 | 94 | } |
95 | 95 | } |
@@ -37,9 +37,12 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function render(MessageInterface $message): Email |
39 | 39 | { |
40 | - try { |
|
40 | + try |
|
41 | + { |
|
41 | 42 | $view = $this->views->get($message->getSubject()); |
42 | - } catch (ViewException $e) { |
|
43 | + } |
|
44 | + catch (ViewException $e) |
|
45 | + { |
|
43 | 46 | throw new MailerException( |
44 | 47 | sprintf('Invalid email template `%s`: %s', $message->getSubject(), $e->getMessage()), |
45 | 48 | $e->getCode(), |
@@ -49,7 +52,8 @@ discard block |
||
49 | 52 | |
50 | 53 | $msg = new Email(); |
51 | 54 | |
52 | - if ($message->getFrom() !== null) { |
|
55 | + if ($message->getFrom() !== null) |
|
56 | + { |
|
53 | 57 | $msg->from([$message->getFrom()]); |
54 | 58 | } |
55 | 59 | |
@@ -57,10 +61,13 @@ discard block |
||
57 | 61 | $msg->cc(...$message->getCC()); |
58 | 62 | $msg->bcc(...$message->getBCC()); |
59 | 63 | |
60 | - try { |
|
64 | + try |
|
65 | + { |
|
61 | 66 | // render message partials |
62 | 67 | $view->render(array_merge(['_msg_' => $msg], $message->getData())); |
63 | - } catch (ViewException $e) { |
|
68 | + } |
|
69 | + catch (ViewException $e) |
|
70 | + { |
|
64 | 71 | throw new MailerException( |
65 | 72 | sprintf('Unable to render email `%s`: %s', $message->getSubject(), $e->getMessage()), |
66 | 73 | $e->getCode(), |
@@ -80,7 +87,8 @@ discard block |
||
80 | 87 | */ |
81 | 88 | public static function escapeSubject(string $subject): string |
82 | 89 | { |
83 | - if (!preg_match('/[^\x20-\x7e]/', $subject)) { |
|
90 | + if (!preg_match('/[^\x20-\x7e]/', $subject)) |
|
91 | + { |
|
84 | 92 | // ascii-only subject, return as-is |
85 | 93 | return $subject; |
86 | 94 | } |
@@ -35,6 +35,6 @@ |
||
35 | 35 | */ |
36 | 36 | public function boot(ViewsBootloader $views): void |
37 | 37 | { |
38 | - $views->addDirectory('sendit', __DIR__ . '/../../views'); |
|
38 | + $views->addDirectory('sendit', __DIR__.'/../../views'); |
|
39 | 39 | } |
40 | 40 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function send(MessageInterface ...$message): void |
44 | 44 | { |
45 | - foreach ($message as $msg) { |
|
45 | + foreach ($message as $msg){ |
|
46 | 46 | $this->queue->push( |
47 | 47 | self::JOB_NAME, |
48 | 48 | MessageSerializer::pack($msg), |
@@ -42,7 +42,8 @@ |
||
42 | 42 | */ |
43 | 43 | public function send(MessageInterface ...$message): void |
44 | 44 | { |
45 | - foreach ($message as $msg) { |
|
45 | + foreach ($message as $msg) |
|
46 | + { |
|
46 | 47 | $this->queue->push( |
47 | 48 | self::JOB_NAME, |
48 | 49 | MessageSerializer::pack($msg), |