From 6758d66671c04d6d5e2a9da95396c13eed52c156 Mon Sep 17 00:00:00 2001 From: Vincent Wong Date: Tue, 31 Dec 2024 01:23:47 +0800 Subject: [PATCH] Properly write down the constant --- src/AsyncTask.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/AsyncTask.php b/src/AsyncTask.php index f7b0963..c7a3b28 100644 --- a/src/AsyncTask.php +++ b/src/AsyncTask.php @@ -41,6 +41,12 @@ class AsyncTask */ private float|null $laravelStartVal = null; + /** + * The string constant name for constant('LARAVEL_START'). Mainly to keep the code clean. + * @var string + */ + private const LARAVEL_START = "LARAVEL_START"; + /** * Indicates whether GNU coreutils is found in the system; in particular, we are looking for the timeout command inside coreutils. * @@ -83,7 +89,7 @@ public function run(): void { // todo startup configs // write down the LARAVEL_START constant value for future usage - $this->laravelStartVal = constant("LARAVEL_START") ?? null; + $this->laravelStartVal = defined(self::LARAVEL_START) ? constant("LARAVEL_START") : null; // install a timeout detector // this single function checks all kinds of timeouts