Passed
Push — main ( 9dc8ea...b1f66a )
by Colin
03:00 queued 33s
created
src/TestLogger.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function log($level, $message, array $context = []): void
74 74
     {
75
-        if (! (\is_string($level) || \is_int($level))) {
76
-            throw new InvalidArgumentException('Unsupported log level. The psr-testlogger library only supports string and integer log levels; passed ' . \print_r($level, true));
75
+        if (!(\is_string($level) || \is_int($level))) {
76
+            throw new InvalidArgumentException('Unsupported log level. The psr-testlogger library only supports string and integer log levels; passed '.\print_r($level, true));
77 77
         }
78 78
 
79 79
         $record = [
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $this->records[]                          = $record;
87 87
     }
88 88
 
89
-    public function hasRecords(string|int|null $level = null): bool
89
+    public function hasRecords(string | int | null $level = null): bool
90 90
     {
91 91
         if ($level === null) {
92 92
             return \count($this->records) !== 0;
@@ -98,31 +98,31 @@  discard block
 block discarded – undo
98 98
     /**
99 99
      * @param string|array<string, mixed> $record
100 100
      */
101
-    public function hasRecord(string|array $record, string|int|null $level = null): bool
101
+    public function hasRecord(string | array $record, string | int | null $level = null): bool
102 102
     {
103 103
         if (\is_string($record)) {
104 104
             $record = ['message' => $record];
105 105
         }
106 106
 
107
-        return $this->hasRecordThatPasses(static function (array $rec) use ($record) {
107
+        return $this->hasRecordThatPasses(static function(array $rec) use ($record) {
108 108
             if ($rec['message'] !== $record['message']) {
109 109
                 return false;
110 110
             }
111 111
 
112
-            return ! isset($record['context']) || $rec['context'] === $record['context'];
112
+            return !isset($record['context']) || $rec['context'] === $record['context'];
113 113
         }, $level);
114 114
     }
115 115
 
116
-    public function hasRecordThatContains(string $message, string|int|null $level = null): bool
116
+    public function hasRecordThatContains(string $message, string | int | null $level = null): bool
117 117
     {
118
-        return $this->hasRecordThatPasses(static function (array $rec) use ($message) {
118
+        return $this->hasRecordThatPasses(static function(array $rec) use ($message) {
119 119
             return \str_contains($rec['message'], $message);
120 120
         }, $level);
121 121
     }
122 122
 
123
-    public function hasRecordThatMatches(string $regex, string|int|null $level = null): bool
123
+    public function hasRecordThatMatches(string $regex, string | int | null $level = null): bool
124 124
     {
125
-        return $this->hasRecordThatPasses(static function ($rec) use ($regex) {
125
+        return $this->hasRecordThatPasses(static function($rec) use ($regex) {
126 126
             return \preg_match($regex, $rec['message']) > 0;
127 127
         }, $level);
128 128
     }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
     /**
131 131
      * @param callable(array<string, mixed>, int): bool $predicate
132 132
      */
133
-    public function hasRecordThatPasses(callable $predicate, string|int|null $level = null): bool
133
+    public function hasRecordThatPasses(callable $predicate, string | int | null $level = null): bool
134 134
     {
135
-        if (! $this->hasRecords($level)) {
135
+        if (!$this->hasRecords($level)) {
136 136
             return false;
137 137
         }
138 138
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     public function __call(string $method, array $args): bool
152 152
     {
153 153
         if (\preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
154
-            $genericMethod = $matches[1] . ($matches[3] !== 'Records' ? 'Record' : '') . $matches[3];
154
+            $genericMethod = $matches[1].($matches[3] !== 'Records' ? 'Record' : '').$matches[3];
155 155
             $callable      = [$this, $genericMethod];
156 156
             $level         = \strtolower($matches[2]);
157 157
             if (\is_callable($callable)) {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             }
162 162
         }
163 163
 
164
-        throw new \BadMethodCallException('Call to undefined method ' . self::class . '::' . $method . '()');
164
+        throw new \BadMethodCallException('Call to undefined method '.self::class.'::'.$method.'()');
165 165
     }
166 166
 
167 167
     public function reset(): void
Please login to merge, or discard this patch.