From 91ef07480bdaa2622d7c1f8573b962bcd41d6063 Mon Sep 17 00:00:00 2001 From: Brian Foley Date: Sat, 11 Jul 2026 14:52:46 +0100 Subject: [PATCH] SiteConfig: Make get()'s return type the singleton. So that phpstan can statically check SiteConfig::get()->foo, and we get a more comprehensible runtime error if SiteConfig somehow isn't loaded. --- pinc/SiteConfig.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pinc/SiteConfig.inc b/pinc/SiteConfig.inc index 4460f32ba..0465ddef0 100644 --- a/pinc/SiteConfig.inc +++ b/pinc/SiteConfig.inc @@ -154,8 +154,11 @@ class SiteConfig self::$_site_config = new SiteConfig($filename); } - public static function get() + public static function get(): SiteConfig { + if (is_null(self::$_site_config)) { + throw new RuntimeException("Configuration error. SiteConfig not loaded."); + } return self::$_site_config; } }