@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * |
| 18 | 18 | * @see https://github.com/symplify/symplify/issues/2061 |
| 19 | 19 | */ |
| 20 | -register_shutdown_function(static function () { |
|
| 21 | - $dest = json_decode(file_get_contents(__DIR__ . '/composer.json'), true); |
|
| 20 | +register_shutdown_function(static function (){ |
|
| 21 | + $dest = json_decode(file_get_contents(__DIR__.'/composer.json'), true); |
|
| 22 | 22 | |
| 23 | 23 | $result = [ |
| 24 | 24 | 'name' => 'spiral/framework', |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $json = json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); |
| 55 | 55 | |
| 56 | - file_put_contents(__DIR__ . '/composer.json', $json . "\n"); |
|
| 56 | + file_put_contents(__DIR__.'/composer.json', $json."\n"); |
|
| 57 | 57 | }); |
| 58 | 58 | |
| 59 | 59 | |
@@ -17,7 +17,8 @@ |
||
| 17 | 17 | * |
| 18 | 18 | * @see https://github.com/symplify/symplify/issues/2061 |
| 19 | 19 | */ |
| 20 | -register_shutdown_function(static function () { |
|
| 20 | +register_shutdown_function(static function () |
|
| 21 | +{ |
|
| 21 | 22 | $dest = json_decode(file_get_contents(__DIR__ . '/composer.json'), true); |
| 22 | 23 | |
| 23 | 24 | $result = [ |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function boot(DirectoriesInterface $dirs, EnvironmentInterface $env) |
| 26 | 26 | { |
| 27 | - $dotenvPath = $env->get('DOTENV_PATH', $dirs->get('root') . '.env'); |
|
| 27 | + $dotenvPath = $env->get('DOTENV_PATH', $dirs->get('root').'.env'); |
|
| 28 | 28 | |
| 29 | - if (!file_exists($dotenvPath)) { |
|
| 29 | + if (!file_exists($dotenvPath)){ |
|
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | ) |
| 37 | 37 | ->load(); |
| 38 | 38 | |
| 39 | - foreach ($dotenv as $key => $value) { |
|
| 39 | + foreach ($dotenv as $key => $value){ |
|
| 40 | 40 | $env->set($key, $value); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -26,7 +26,8 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $dotenvPath = $env->get('DOTENV_PATH', $dirs->get('root') . '.env'); |
| 28 | 28 | |
| 29 | - if (!file_exists($dotenvPath)) { |
|
| 29 | + if (!file_exists($dotenvPath)) |
|
| 30 | + { |
|
| 30 | 31 | return; |
| 31 | 32 | } |
| 32 | 33 | |
@@ -36,7 +37,8 @@ discard block |
||
| 36 | 37 | ) |
| 37 | 38 | ->load(); |
| 38 | 39 | |
| 39 | - foreach ($dotenv as $key => $value) { |
|
| 40 | + foreach ($dotenv as $key => $value) |
|
| 41 | + { |
|
| 40 | 42 | $env->set($key, $value); |
| 41 | 43 | } |
| 42 | 44 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | PSR7WorkerInterface $worker, |
| 59 | 59 | ContainerInterface $container, |
| 60 | 60 | FinalizerInterface $finalizer |
| 61 | - ) { |
|
| 61 | + ){ |
|
| 62 | 62 | $this->env = $env; |
| 63 | 63 | $this->worker = $worker; |
| 64 | 64 | $this->container = $container; |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | /** @var Http $http */ |
| 82 | 82 | $http = $this->container->get(Http::class); |
| 83 | - while ($request = $this->worker->waitRequest()) { |
|
| 84 | - try { |
|
| 83 | + while ($request = $this->worker->waitRequest()){ |
|
| 84 | + try{ |
|
| 85 | 85 | $response = $http->handle($request); |
| 86 | 86 | |
| 87 | 87 | $this->worker->respond($response); |
| 88 | - } catch (\Throwable $e) { |
|
| 88 | + }catch (\Throwable $e){ |
|
| 89 | 89 | $this->worker->respond($this->errorToResponse($e)); |
| 90 | - } finally { |
|
| 90 | + }finally{ |
|
| 91 | 91 | $this->finalizer->finalize(false); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | $handler = new HtmlHandler(); |
| 103 | 103 | |
| 104 | - try { |
|
| 104 | + try{ |
|
| 105 | 105 | /** @var SnapshotInterface $snapshot */ |
| 106 | 106 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
| 107 | 107 | \file_put_contents('php://stderr', $snapshot->getMessage()); |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | // on demand |
| 110 | 110 | $state = $this->container->get(StateInterface::class); |
| 111 | 111 | |
| 112 | - if ($state !== null) { |
|
| 112 | + if ($state !== null){ |
|
| 113 | 113 | $handler = $handler->withState($state); |
| 114 | 114 | } |
| 115 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 115 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
| 116 | 116 | \file_put_contents('php://stderr', (string)$e); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -80,14 +80,20 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | /** @var Http $http */ |
| 82 | 82 | $http = $this->container->get(Http::class); |
| 83 | - while ($request = $this->worker->waitRequest()) { |
|
| 84 | - try { |
|
| 83 | + while ($request = $this->worker->waitRequest()) |
|
| 84 | + { |
|
| 85 | + try |
|
| 86 | + { |
|
| 85 | 87 | $response = $http->handle($request); |
| 86 | 88 | |
| 87 | 89 | $this->worker->respond($response); |
| 88 | - } catch (\Throwable $e) { |
|
| 90 | + } |
|
| 91 | + catch (\Throwable $e) |
|
| 92 | + { |
|
| 89 | 93 | $this->worker->respond($this->errorToResponse($e)); |
| 90 | - } finally { |
|
| 94 | + } |
|
| 95 | + finally |
|
| 96 | + { |
|
| 91 | 97 | $this->finalizer->finalize(false); |
| 92 | 98 | } |
| 93 | 99 | } |
@@ -101,7 +107,8 @@ discard block |
||
| 101 | 107 | { |
| 102 | 108 | $handler = new HtmlHandler(); |
| 103 | 109 | |
| 104 | - try { |
|
| 110 | + try |
|
| 111 | + { |
|
| 105 | 112 | /** @var SnapshotInterface $snapshot */ |
| 106 | 113 | $snapshot = $this->container->get(SnapshotterInterface::class)->register($e); |
| 107 | 114 | \file_put_contents('php://stderr', $snapshot->getMessage()); |
@@ -109,10 +116,13 @@ discard block |
||
| 109 | 116 | // on demand |
| 110 | 117 | $state = $this->container->get(StateInterface::class); |
| 111 | 118 | |
| 112 | - if ($state !== null) { |
|
| 119 | + if ($state !== null) |
|
| 120 | + { |
|
| 113 | 121 | $handler = $handler->withState($state); |
| 114 | 122 | } |
| 115 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
| 123 | + } |
|
| 124 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
| 125 | + { |
|
| 116 | 126 | \file_put_contents('php://stderr', (string)$e); |
| 117 | 127 | } |
| 118 | 128 | |
@@ -13,4 +13,4 @@ |
||
| 13 | 13 | ini_set('display_errors', 'stderr'); |
| 14 | 14 | |
| 15 | 15 | //Composer |
| 16 | -require dirname(__DIR__) . '/vendor_php/autoload.php'; |
|
| 16 | +require dirname(__DIR__).'/vendor_php/autoload.php'; |
|
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | { |
| 24 | 24 | protected function tearDown(): void |
| 25 | 25 | { |
| 26 | - if (file_exists(Job::JOB_FILE)) { |
|
| 26 | + if (file_exists(Job::JOB_FILE)){ |
|
| 27 | 27 | unlink(Job::JOB_FILE); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -23,7 +23,8 @@ |
||
| 23 | 23 | { |
| 24 | 24 | protected function tearDown(): void |
| 25 | 25 | { |
| 26 | - if (file_exists(Job::JOB_FILE)) { |
|
| 26 | + if (file_exists(Job::JOB_FILE)) |
|
| 27 | + { |
|
| 27 | 28 | unlink(Job::JOB_FILE); |
| 28 | 29 | } |
| 29 | 30 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | class Job extends JobHandler |
| 17 | 17 | { |
| 18 | - public const JOB_FILE = __DIR__ . '/../../local.job'; |
|
| 18 | + public const JOB_FILE = __DIR__.'/../../local.job'; |
|
| 19 | 19 | |
| 20 | 20 | public function invoke(string $id, array $payload): void |
| 21 | 21 | { |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | class Job extends JobHandler |
| 17 | 17 | { |
| 18 | - public const JOB_FILE = __DIR__ . '/../../local.job'; |
|
| 18 | + public const JOB_FILE = __DIR__.'/../../local.job'; |
|
| 19 | 19 | |
| 20 | 20 | public function invoke(string $id, array $payload): void |
| 21 | 21 | { |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | protected function tearDown(): void |
| 37 | 37 | { |
| 38 | - if (file_exists((static::JOB)::JOB_FILE)) { |
|
| 38 | + if (file_exists((static::JOB)::JOB_FILE)){ |
|
| 39 | 39 | unlink((static::JOB)::JOB_FILE); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | $start = microtime(true); |
| 107 | 107 | $try = 0; |
| 108 | - while (!file_exists($this->job::JOB_FILE) && $try < 10) { |
|
| 108 | + while (!file_exists($this->job::JOB_FILE) && $try < 10){ |
|
| 109 | 109 | usleep(250000); |
| 110 | 110 | $try++; |
| 111 | 111 | } |
@@ -35,7 +35,8 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | protected function tearDown(): void |
| 37 | 37 | { |
| 38 | - if (file_exists((static::JOB)::JOB_FILE)) { |
|
| 38 | + if (file_exists((static::JOB)::JOB_FILE)) |
|
| 39 | + { |
|
| 39 | 40 | unlink((static::JOB)::JOB_FILE); |
| 40 | 41 | } |
| 41 | 42 | } |
@@ -105,7 +106,8 @@ discard block |
||
| 105 | 106 | { |
| 106 | 107 | $start = microtime(true); |
| 107 | 108 | $try = 0; |
| 108 | - while (!file_exists($this->job::JOB_FILE) && $try < 10) { |
|
| 109 | + while (!file_exists($this->job::JOB_FILE) && $try < 10) |
|
| 110 | + { |
|
| 109 | 111 | usleep(250000); |
| 110 | 112 | $try++; |
| 111 | 113 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | class Job extends JobHandler |
| 17 | 17 | { |
| 18 | - public const JOB_FILE = __DIR__ . '/../../local.job'; |
|
| 18 | + public const JOB_FILE = __DIR__.'/../../local.job'; |
|
| 19 | 19 | |
| 20 | 20 | public function invoke(string $id, array $payload): void |
| 21 | 21 | { |