From 784788e0357732cf7ac5bc5e8bdaffc63cbe49e9 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Thu, 21 Oct 2021 15:13:59 +0900 Subject: [PATCH] Add psalm checks --- psalm.xml | 14 ++++++++++++++ src/read_env_file.php | 6 ++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 psalm.xml diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..d303829 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/src/read_env_file.php b/src/read_env_file.php index 22f3e28..b6b719f 100644 --- a/src/read_env_file.php +++ b/src/read_env_file.php @@ -15,16 +15,13 @@ * * @param string $path Folder to file, default is __DIR__ * @param string $env_file What file to load, default is .env - * @return int -1 other error - * 0 for success full load + * @return int 0 for success full load * 1 for file loadable, but no data inside * 2 for file not readable * 3 for file not found */ function readEnvFile(string $path = __DIR__, string $env_file = '.env'): int { - // default -1; - $status = -1; $env_file_target = $path . DIRECTORY_SEPARATOR . $env_file; // this is not a file -> abort if (!is_file($env_file_target)) { @@ -74,6 +71,7 @@ function readEnvFile(string $path = __DIR__, string $env_file = '.env'): int $line = $matches[1]; } // strip line of slashes + /** @psalm-suppress MixedOperand */ $_ENV[$var] .= stripslashes($line); } }