Test Failed
Push — master ( 36f795...9f6bee )
by Aleksei
03:35 queued 16s
created
src/Exceptions/tests/ErrorReportingTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         #[ExpectedValues(values: [\E_USER_NOTICE, \E_USER_WARNING, \E_USER_ERROR])]
69 69
         int $type
70 70
     ): ?Throwable {
71
-        $handler = (new class extends ExceptionHandler {
71
+        $handler = (new class extends ExceptionHandler{
72 72
             public function handleError(int $errno, string $errstr, string $errfile = '', int $errline = 0): bool
73 73
             {
74 74
                 return parent::handleError($errno, $errstr, $errfile, $errline);
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
             {
79 79
             }
80 80
         });
81
-        try {
81
+        try{
82 82
             $handler->handleError(...\array_values($this->generateErrorArray($type)));
83
-        } catch (Throwable $e) {
83
+        }catch (Throwable $e){
84 84
             return $e;
85 85
         }
86 86
         return null;
Please login to merge, or discard this patch.
src/Exceptions/src/ExceptionHandler.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function getRenderer(?string $format = null): ?ExceptionRendererInterface
42 42
     {
43
-        if ($format !== null) {
44
-            foreach ($this->renderers as $renderer) {
45
-                if ($renderer->canRender($format)) {
43
+        if ($format !== null){
44
+            foreach ($this->renderers as $renderer){
45
+                if ($renderer->canRender($format)){
46 46
                     return $renderer;
47 47
                 }
48 48
             }
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 
66 66
     public function report(\Throwable $exception): void
67 67
     {
68
-        foreach ($this->reporters as $reporter) {
69
-            try {
70
-                if ($reporter instanceof ExceptionReporterInterface) {
68
+        foreach ($this->reporters as $reporter){
69
+            try{
70
+                if ($reporter instanceof ExceptionReporterInterface){
71 71
                     $reporter->report($exception);
72
-                } else {
72
+                }else{
73 73
                     $reporter($exception);
74 74
                 }
75
-            } catch (\Throwable) {
75
+            }catch (\Throwable){
76 76
                 // Do nothing
77 77
             }
78 78
         }
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 
81 81
     public function handleGlobalException(\Throwable $e): void
82 82
     {
83
-        if (\in_array(PHP_SAPI, ['cli', 'cli-server'], true)) {
83
+        if (\in_array(PHP_SAPI, ['cli', 'cli-server'], true)){
84 84
             $this->output ??= \defined('STDERR') ? \STDERR : \fopen('php://stderr', 'wb+');
85 85
             $format = 'cli';
86
-        } else {
86
+        }else{
87 87
             $this->output ??= \defined('STDOUT') ? \STDOUT : \fopen('php://stdout', 'wb+');
88 88
             $format = 'html';
89 89
         }
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
         $this->report($e);
93 93
 
94 94
         // There is possible an exception on the application termination
95
-        try {
95
+        try{
96 96
             \fwrite($this->output, $this->render($e, verbosity: $this->verbosity, format: $format));
97
-        } catch (\Throwable) {
97
+        }catch (\Throwable){
98 98
             $this->output = null;
99 99
         }
100 100
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     /**
111 111
      * @param ExceptionReporterInterface|Closure(\Throwable):void $reporter
112 112
      */
113
-    public function addReporter(ExceptionReporterInterface|Closure $reporter): void
113
+    public function addReporter(ExceptionReporterInterface | Closure $reporter): void
114 114
     {
115 115
         $this->reporters[] = $reporter;
116 116
     }
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
      */
129 129
     protected function handleShutdown(): void
130 130
     {
131
-        if (empty($error = \error_get_last())) {
131
+        if (empty($error = \error_get_last())){
132 132
             return;
133 133
         }
134 134
 
135
-        try {
135
+        try{
136 136
             $this->handleError($error['type'], $error['message'], $error['file'], $error['line']);
137
-        } catch (\Throwable $e) {
137
+        }catch (\Throwable $e){
138 138
             $this->handleGlobalException($e);
139 139
         }
140 140
     }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         string $errfile = '',
151 151
         int $errline = 0,
152 152
     ): bool {
153
-        if (!(\error_reporting() & $errno)) {
153
+        if (!(\error_reporting() & $errno)){
154 154
             return false;
155 155
         }
156 156
 
Please login to merge, or discard this patch.