Fix potential type error in editor component XML handling logic

This commit is contained in:
Kijin Sung 2023-10-03 16:18:56 +09:00
parent db4e874660
commit df6fdd3bc3
2 changed files with 9 additions and 7 deletions

View file

@ -13,15 +13,15 @@ class EditorComponentParser extends BaseParser
* @param string $filename
* @param string $component_name
* @param string $lang
* @return object|false
* @return ?object
*/
public static function loadXML(string $filename, string $component_name, string $lang = '')
public static function loadXML(string $filename, string $component_name, string $lang = ''): ?object
{
// Load the XML file.
$xml = simplexml_load_string(file_get_contents($filename));
if ($xml === false)
{
return false;
return null;
}
// Get the current language.