Skip to content

Commit 6ab3a93

Browse files
authored
Decorate Stringable type (#21)
1 parent 311d8fc commit 6ab3a93

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|array|object|mixed|resource|iterable|void|callable)(?=[:]{2}|[\.\s\|><,\(\)\{\}]+)/',
248+
'/(?<=[\s\|\(><])(null|true|false|int|float|bool|([-\w]+-)?string|Stringable|array|object|mixed|resource|iterable|void|callable)(?=[:]{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
@@ -203,6 +203,13 @@ public static function provideHighlight() : iterable
203203
'argument.type',
204204
true
205205
];
206+
yield [
207+
'Parameter #1 <fg=green>$currentWorkingDirectory</> of method <fg=yellow>Application\AnalyzeCommand</>: <fg=blue>getFinder()</> expects <fg=magenta>string</>, <fg=magenta>Stringable</>|<fg=magenta>false</> given.',
208+
'Parameter #1 $currentWorkingDirectory of method Application\AnalyzeCommand: getFinder() expects string, Stringable|false given.',
209+
null,
210+
null,
211+
true
212+
];
206213
}
207214

208215
/**

0 commit comments

Comments
 (0)