[VarDumper] dd() can fallback to a plain text dumper if no suitable Dumper found

by @pierresh

Some issues have been detected in this pull request

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/58151/70a66ae8c6dabf5e224b2ba238e4f2610680583a/cs.diff | patch -p0
diff -ru src/Symfony/Component/VarDumper/Resources/functions/dump.php src/Symfony/Component/VarDumper/Resources/functions/dump.php
--- src/Symfony/Component/VarDumper/Resources/functions/dump.php	2024-09-03 07:56:36.885908369 +0000
+++ src/Symfony/Component/VarDumper/Resources/functions/dump.php	2024-09-03 07:56:37.456928767 +0000
@@ -45,7 +45,7 @@
 if (!function_exists('dd')) {
     function dd(mixed ...$vars): never
     {
-        if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && !headers_sent()) {
+        if (!in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) && !headers_sent()) {
             header('HTTP/1.1 500 Internal Server Error');
         }
 
@@ -58,9 +58,9 @@
         $acceptHeader = $_SERVER['HTTP_ACCEPT'] ?? '---';
 
         if (
-            str_contains($acceptHeader, '*/*') ||
-            str_contains($acceptHeader, 'text/html') ||
-            \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)
+            str_contains($acceptHeader, '*/*')
+            || str_contains($acceptHeader, 'text/html')
+            || in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)
         ) {
             dump($vars);
 

0
Common Typos

0
License Headers

0
Pull Request Contributor Headers

0
File Permissions

0
Merge Commits

0
Exception Messages Formatting

0
Usage of void in test files

0
Use ::class whenever possible

0
Deprecation Messages