@@ -72,8 +72,8 @@ discard block |
||
| 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 |
||
| 86 | 86 | $this->records[] = $record; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function hasRecords(string|int $level): bool |
|
| 89 | + public function hasRecords(string | int $level): bool |
|
| 90 | 90 | { |
| 91 | 91 | return isset($this->recordsByLevel[$level]); |
| 92 | 92 | } |
@@ -94,31 +94,31 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | * @param string|array<string, mixed> $record |
| 96 | 96 | */ |
| 97 | - public function hasRecord(string|array $record, string|int $level): bool |
|
| 97 | + public function hasRecord(string | array $record, string | int $level): bool |
|
| 98 | 98 | { |
| 99 | 99 | if (\is_string($record)) { |
| 100 | 100 | $record = ['message' => $record]; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - return $this->hasRecordThatPasses(static function (array $rec) use ($record) { |
|
| 103 | + return $this->hasRecordThatPasses(static function(array $rec) use ($record) { |
|
| 104 | 104 | if ($rec['message'] !== $record['message']) { |
| 105 | 105 | return false; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return ! isset($record['context']) || $rec['context'] === $record['context']; |
|
| 108 | + return !isset($record['context']) || $rec['context'] === $record['context']; |
|
| 109 | 109 | }, $level); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - public function hasRecordThatContains(string $message, string|int $level): bool |
|
| 112 | + public function hasRecordThatContains(string $message, string | int $level): bool |
|
| 113 | 113 | { |
| 114 | - return $this->hasRecordThatPasses(static function (array $rec) use ($message) { |
|
| 114 | + return $this->hasRecordThatPasses(static function(array $rec) use ($message) { |
|
| 115 | 115 | return \str_contains($rec['message'], $message); |
| 116 | 116 | }, $level); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function hasRecordThatMatches(string $regex, string|int $level): bool |
|
| 119 | + public function hasRecordThatMatches(string $regex, string | int $level): bool |
|
| 120 | 120 | { |
| 121 | - return $this->hasRecordThatPasses(static function ($rec) use ($regex) { |
|
| 121 | + return $this->hasRecordThatPasses(static function($rec) use ($regex) { |
|
| 122 | 122 | return \preg_match($regex, $rec['message']) > 0; |
| 123 | 123 | }, $level); |
| 124 | 124 | } |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | /** |
| 127 | 127 | * @param callable(array<string, mixed>, int): bool $predicate |
| 128 | 128 | */ |
| 129 | - public function hasRecordThatPasses(callable $predicate, string|int $level): bool |
|
| 129 | + public function hasRecordThatPasses(callable $predicate, string | int $level): bool |
|
| 130 | 130 | { |
| 131 | - if (! isset($this->recordsByLevel[$level])) { |
|
| 131 | + if (!isset($this->recordsByLevel[$level])) { |
|
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | public function __call(string $method, array $args): bool |
| 148 | 148 | { |
| 149 | 149 | if (\preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { |
| 150 | - $genericMethod = $matches[1] . ($matches[3] !== 'Records' ? 'Record' : '') . $matches[3]; |
|
| 150 | + $genericMethod = $matches[1].($matches[3] !== 'Records' ? 'Record' : '').$matches[3]; |
|
| 151 | 151 | $callable = [$this, $genericMethod]; |
| 152 | 152 | $level = \strtolower($matches[2]); |
| 153 | 153 | if (\is_callable($callable)) { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - throw new \BadMethodCallException('Call to undefined method ' . self::class . '::' . $method . '()'); |
|
| 160 | + throw new \BadMethodCallException('Call to undefined method '.self::class.'::'.$method.'()'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function reset(): void |