Skip to content

Commit 8f5b19e

Browse files
authored
add comma as lookbehind for types regex
1 parent adb8336 commit 8f5b19e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/TicketSwapErrorFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public static function highlight(string $message, ?string $tip, ?string $identif
245245

246246
// Types
247247
$message = (string) preg_replace(
248-
'/(?<=[\s\|\(><])(null|true|false|int|float|bool|([-\w]+-)?string|Stringable|array|object|mixed|resource|iterable|void|callable|stdClass)(?=[:]{2}|[\.\s\|><,\(\)\{\}]+)/',
248+
'/(?<=[\s\|\(><,])(null|true|false|int|float|bool|([-\w]+-)?string|Stringable|array|object|mixed|resource|iterable|void|callable|stdClass)(?=[:]{2}|[\.\s\|><,\(\)\{\}]+)/',
249249
'<fg=magenta>$1</>',
250250
$message,
251251
);

tests/TicketSwapErrorFormatterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ public static function provideHighlight() : iterable
224224
null,
225225
true,
226226
];
227+
yield [
228+
'Parameter #1 <fg=green>$callback</> of method <fg=yellow>Illuminate\Support\Collection</><<fg=magenta>int</>,<fg=magenta>mixed</>>: <fg=blue>map()</> expects',
229+
'Parameter #1 $callback of method Illuminate\Support\Collection<int,mixed>::map() expects',
230+
null,
231+
null,
232+
true,
233+
];
227234
}
228235

229236
/**

0 commit comments

Comments
 (0)