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
This commit is contained in:
Victor Westerlund 2026-02-11 17:39:01 +01:00
parent 1536079fe3
commit 3b8fadf613

View file

@ -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();
}
/**