Actually adding ?? ' ' to the end of line 7 and 13 like below temporarily fix the issue but I think it should be fixed on next versions. Thanks
$badge = preg_match ('/badge/', $params->get('moduleclass_sfx')??'')? '<span class="badge"> </span>' : '';
$moduleClassSfx = htmlspecialchars($params->get('moduleclass_sfx')?? '');