Passed
Pull Request — main (#3)
by
unknown
48:47 queued 13:47
created
src/TestLogger.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         if (is_array($levelMap)) {
87 87
             $passedKeys = \array_keys($levelMap);
88 88
             if ($passedKeys !== \array_keys($this->levelMap)) {
89
-                throw new \InvalidArgumentException("Level map keys must be the LogLevel::* values; passed " . print_r($passedKeys, TRUE));
89
+                throw new \InvalidArgumentException("Level map keys must be the LogLevel::* values; passed ".print_r($passedKeys, TRUE));
90 90
             }
91 91
         }
92 92
         $this->levelMap = $levelMap ?? $this->levelMap;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     /**
113 113
      * @param string|int $level
114 114
      */
115
-    public function hasRecords(string|int $level): bool
115
+    public function hasRecords(string | int $level): bool
116 116
     {
117 117
         return isset($this->recordsByLevel[$level]);
118 118
     }
@@ -121,27 +121,27 @@  discard block
 block discarded – undo
121 121
      * @param string|array<string, mixed> $record
122 122
      * @param string|int                  $level
123 123
      */
124
-    public function hasRecord($record, string|int $level): bool
124
+    public function hasRecord($record, string | int $level): bool
125 125
     {
126 126
         if (\is_string($record)) {
127 127
             $record = ['message' => $record];
128 128
         }
129 129
 
130
-        return $this->hasRecordThatPasses(static function (array $rec) use ($record) {
130
+        return $this->hasRecordThatPasses(static function(array $rec) use ($record) {
131 131
             if ($rec['message'] !== $record['message']) {
132 132
                 return false;
133 133
             }
134 134
 
135
-            return ! isset($record['context']) || $rec['context'] === $record['context'];
135
+            return !isset($record['context']) || $rec['context'] === $record['context'];
136 136
         }, $level);
137 137
     }
138 138
 
139 139
     /**
140 140
      * @param string|int $level
141 141
      */
142
-    public function hasRecordThatContains(string $message, string|int $level): bool
142
+    public function hasRecordThatContains(string $message, string | int $level): bool
143 143
     {
144
-        return $this->hasRecordThatPasses(static function (array $rec) use ($message) {
144
+        return $this->hasRecordThatPasses(static function(array $rec) use ($message) {
145 145
             return \strpos($rec['message'], $message) !== false;
146 146
         }, $level);
147 147
     }
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
     /**
150 150
      * @param string|int $level
151 151
      */
152
-    public function hasRecordThatMatches(string $regex, string|int $level): bool
152
+    public function hasRecordThatMatches(string $regex, string | int $level): bool
153 153
     {
154
-        return $this->hasRecordThatPasses(static function ($rec) use ($regex) {
154
+        return $this->hasRecordThatPasses(static function($rec) use ($regex) {
155 155
             return \preg_match($regex, $rec['message']) > 0;
156 156
         }, $level);
157 157
     }
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
      * @param callable(array<string, mixed>, int): bool $predicate
161 161
      * @param string|int                                $level
162 162
      */
163
-    public function hasRecordThatPasses(callable $predicate, string|int $level): bool
163
+    public function hasRecordThatPasses(callable $predicate, string | int $level): bool
164 164
     {
165
-        if (! isset($this->recordsByLevel[$level])) {
165
+        if (!isset($this->recordsByLevel[$level])) {
166 166
             return false;
167 167
         }
168 168
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
     public function __call(string $method, array $args): bool
182 182
     {
183 183
         $levelNames = \implode('|', \array_map('ucfirst', \array_keys($this->levelMap)));
184
-        if (\preg_match('/(.*)(' . $levelNames . ')(.*)/', $method, $matches) > 0) {
185
-            $genericMethod = $matches[1] . ($matches[3] !== 'Records' ? 'Record' : '') . $matches[3];
184
+        if (\preg_match('/(.*)('.$levelNames.')(.*)/', $method, $matches) > 0) {
185
+            $genericMethod = $matches[1].($matches[3] !== 'Records' ? 'Record' : '').$matches[3];
186 186
             $callable      = [$this, $genericMethod];
187 187
             $level         = $this->levelMap[\strtolower($matches[2])];
188 188
             if (\is_callable($callable)) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             }
193 193
         }
194 194
 
195
-        throw new \BadMethodCallException('Call to undefined method ' . static::class . '::' . $method . '()');
195
+        throw new \BadMethodCallException('Call to undefined method '.static::class.'::'.$method.'()');
196 196
     }
197 197
 
198 198
     public function reset(): void
Please login to merge, or discard this patch.