Timezone: shut phpstan up about impossible ini_get() errors

This commit is contained in:
Dylan K. Taylor 2020-04-15 09:48:20 +01:00
parent 7e9c38a9d9
commit cf538d83bf

View File

@ -48,7 +48,11 @@ use function trim;
abstract class Timezone{ abstract class Timezone{
public static function get() : string{ public static function get() : string{
return ini_get('date.timezone'); $tz = ini_get('date.timezone');
if($tz === false){
throw new AssumptionFailedError('date.timezone INI entry should always exist');
}
return $tz;
} }
/** /**
@ -57,7 +61,7 @@ abstract class Timezone{
public static function init() : array{ public static function init() : array{
$messages = []; $messages = [];
do{ do{
$timezone = ini_get("date.timezone"); $timezone = self::get();
if($timezone !== ""){ if($timezone !== ""){
/* /*
* This is here so that people don't come to us complaining and fill up the issue tracker when they put * This is here so that people don't come to us complaining and fill up the issue tracker when they put