From f4b8f8673e7696de3bfdf7a02064c2b94498e385 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Wed, 11 Feb 2026 17:39:01 +0100 Subject: [PATCH] fix: set `Database` env credentials without returning a new instance (#24) This is a follow-up PR from #22. Instead of returning a new instance after setting the environment variables we simply do nothing. Most of the extending classes will not take advantage of the new instance anyways, and will just call `new Database()` as before. Of course, as mentioned in #22 this setup is not ideal, and another solution should be implemented to instance this class. Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/24 --- src/Database/Database.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Database/Database.php b/src/Database/Database.php index ec95a26..a7c94f1 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -26,9 +26,9 @@ * @param string $username * @param string $password * @param string $database - * @return static + * @return void */ - public static function from_credentials( + public static function set_credentials( ?string $host = self::DEFAULT_HOSTNAME, ?string $username = self::DEFAULT_USERNAME, ?string $password = self::DEFAULT_PASSWORD, @@ -44,8 +44,6 @@ $_ENV["mariadb"]["user"] = $username; $_ENV["mariadb"]["pass"] = $password; $_ENV["mariadb"]["db"] = $database; - - return new static(); } /**