I am currently building a response class with PHP to communicate with my backend API if everything went alright. This is the class:
public static function Success($data = null)
{
if (!$data) {
return [
'result' => true
];
} else {
return [
'result' => true,
'data' => $data
];
}
}
But when someone tries to install the plugin on a website it gives the error:
Parse error: syntax error, unexpected '[' in filename on line 13,
Line 13 is where the first bracket [
starts at the first return.
Does anyone know why I get this error? I think it has something to do with the version of PHP or Wordpress.