vip scanner php warning

0

I have this code and the vip scanner gives me a warning but I can not figure out what the problem is, do you have any idea?

public function callback($data = false) {
    if (false !== $data) {
        $message = serialize($data);
        //wp_mail( '[email protected]', $message );
    }
}

Error:

An endpoint needs to return something, I'd also suggest adding a type hint to the '$data' parameter
    
asked by Santiago D'Antuoni 14.11.2016 в 20:25
source

1 answer

0
  

Test:

     
  • Return ( return ) something at the end of the function callback .
  •   
  • and document the parameter $data
  •   

For example:

/**
 * @param array $data Arreglo con la info a ser enviadada por mail
 * @param bool  $data Si es 'false' no se enviara info por mail
 */
public function callback( $data = false ) {

    if ( false !== $data ) {
        $message = serialize( $data );
        // wp_mail( '[email protected]', $message );
    }

    // Devolver algo (An endpoint needs to return something)
    return true;
}
    
answered by 14.11.2016 в 20:53