This function won't work for when you're running PHP from the command line. If will always return an empty array. This can be an issue when testing your project using PHPUnit or Codeception.
To solve this, install the xdebug extension and use `xdebug_get_headers` when on the cli.
<?php
$headers = php_sapi_name() === 'cli' ? xdebug_get_headers() : headers_list();
?>