php – Uncaught TypeError: : Return value must be of type array, bool returned

I have a form where users fill to add the amount to their account, in that form they will select a gateway (Paypal, perfect money, etc…) input an amount then send it to the functions I have designed in order to make the deposit. On submitting the form is sent to the controller and then create the process by choosing the right API to continue now this error is being thrown. Please need anyone help to fix this, thanks in advance


Fatal error: Uncaught TypeError: gatewayinfo(): Return value must be of type array, bool returned in C:xampphtdocsmodelgateways-model.php:86 Stack trace: #0 

gateways Model

function gatewayinfo($gateway_id): array
    try {
        $db = createConnection();
        $sql = 'SELECT * FROM ays_gateways
                WHERE gatewayID = :gatewayID';
        $stmt = $db->prepare($sql);
        $stmt->bindValue(':gatewayID', $gateway_id, PDO::PARAM_INT);
        $gatewayinfo = $stmt->fetch(PDO::FETCH_ASSOC); //line 86
        return $gatewayinfo;
    } catch (PDOException $e) {
        exit($e->getMessage()) ;
        return ();

payment function

function getPaymentForm('51', gateway_id) {
    $gatewayInfo = gatewayinfo($gateway_id); ;
    $gateway = $gatewayInfo('name');
    if($gateway == "PayPal") { return PF_PayPal('51',$gateway_id); }
    elseif($gateway == "Perfect Money") { return PF_PerfectMoney('51',$gateway_id); }
    else { return 'Something was wrong. Please try again.'; }