How to turn off a mistaken error highlighting in VS Code?

I have the following PHP codes in VS Code.

Code:
$variables = Some string array like ["a,b,c", "e,d,f", "x,y,z",...];
$variables = array_map(function ($s) {return explode(",", $s);}, $variables);
//now $variables is an array array
$numberOfIteration = count($variables[0]);
//error highlighted as VSCode thinks elements of $variables are still strings so can't be counted.
I tried using function (string $s): array {return explode(",", $s);} to indicate it is a damn array of array but VS Codes still recognizes that fucker as var string[].

Code:
php > $variables = ["a,b,c", "x,y,z"];
php > echo gettype($variables[0]);
string
php > $variables = array_map(function (string $s): array {return explode(",", $s);}, $variables);
php > echo gettype($variables[0]);
array
php > var_dump($variables);
array(2) {
  [0]=>
  array(3) {
    [0]=>
    string(1) "a"
    [1]=>
    string(1) "b"
    [2]=>
    string(1) "c"
  }
  [1]=>
  array(3) {
    [0]=>
    string(1) "x"
    [1]=>
    string(1) "y"
    [2]=>
    string(1) "z"
  }
}

I would like to keep error highlighting on because it is useful but to turn off that one mistaken highlighting that marks my file red. How can I do it?
 
Back
Top