'VSCode show error after use PHP Intelephense

I am trying to get post data from client, the code working fine until I switch to use PHP intelephense extension. It show that I have error "expected type 'object'. Found 'array'.intelephense(1006)"

my part of code that error is like ->

if ($_SERVER['REQUEST_METHOD'] === 'POST' && empty($_POST)) {
    $_POST = json_decode(file_get_contents('php://input'));
}

$date = $_POST->date;
$branch = $_POST->idBranch;

The error part is at $_POST.

Is it error with the extension or is it my code that is not correct.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source