From 25279c696a2c17529bfb868c676c19a53a3d8b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bar=C3=A1=C5=A1ek?= Date: Mon, 11 Apr 2022 17:02:45 +0200 Subject: [PATCH] Fix PhpStan. --- README.md | 2 ++ src/MjmlServer.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a95c90d..a9618f4 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ MJML PHP server Imagine you want render your [MJML template](https://mjml.io) on your private PHP server, now you can. +> **Please note:** This package is not officially supported as of 2021-04-01. Install MJML manually on the server, or use Docker. + How to install -------------- diff --git a/src/MjmlServer.php b/src/MjmlServer.php index f36f75d..da43ac7 100644 --- a/src/MjmlServer.php +++ b/src/MjmlServer.php @@ -25,12 +25,12 @@ public function run(): void echo json_encode([ 'status' => 'ok', 'content' => (new self)->process($_POST['template'] ?? ''), - ]); + ], JSON_THROW_ON_ERROR); } catch (\Throwable $e) { echo json_encode([ 'status' => 'error', 'message' => $e->getMessage(), - ]); + ], JSON_THROW_ON_ERROR); } die; } @@ -53,6 +53,7 @@ public function process(string $template): string throw new \RuntimeException('Function shell_exec() is disabled on this server.'); } + /** @phpstan-ignore-next-line */ shell_exec('/node_modules/.bin/mjml ' . escapeshellarg($sourceFile) . ' > ' . escapeshellarg($finalFile)); return $this->processReturn($finalFile);