Improve CLI check, added PHP dev server to sentry helper (#2105)

This commit is contained in:
Belle Aerni authored and GitHub committed 2024-01-28 13:32:25 -08:00
1 parent b9f5ca3cec
commit b729da69fc
2 files changed
+5 -2

No files matched your search

+1 -1
View File
@@ -60,6 +60,6 @@ class Environment
*/
public static function isCLI(): bool
{
return php_sapi_name() === 'cli' || !http_response_code();
return PHP_SAPI === 'cli' || defined('STDIN') || !http_response_code();
}
}
+4 -1
View File
@@ -52,7 +52,8 @@ class SentryHelper
{
$sentryDSN = '--replace--this--during--release--process--';
$httpClient = new class() implements HttpClientInterface {
$httpClient = new class() implements HttpClientInterface
{
public function sendRequest(Request $request, Options $options): Response
{
$dsn = $options->getDsn();
@@ -179,6 +180,8 @@ class SentryHelper
return 'Litespeed';
} elseif (stripos(strtolower($serverSoftware), 'nginx') !== false) {
return 'NGINX';
} elseif (PHP_SAPI === 'cli-server') {
return 'PHP Development Server';
} else {
return 'Unknown';
}