From 399a297c386ad132efeeda2a5556b11914b5199f Mon Sep 17 00:00:00 2001 From: Simon Bigelmayr Date: Wed, 24 Sep 2025 11:01:45 +0200 Subject: [PATCH 1/5] add stdClass as type --- src/TicketSwapErrorFormatter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TicketSwapErrorFormatter.php b/src/TicketSwapErrorFormatter.php index bd91324..72defc1 100644 --- a/src/TicketSwapErrorFormatter.php +++ b/src/TicketSwapErrorFormatter.php @@ -245,7 +245,7 @@ public static function highlight(string $message, ?string $tip, ?string $identif // Types $message = (string) preg_replace( - '/(?<=[\s\|\(><])(null|true|false|int|float|bool|([-\w]+-)?string|Stringable|array|object|mixed|resource|iterable|void|callable)(?=[:]{2}|[\.\s\|><,\(\)\{\}]+)/', + '/(?<=[\s\|\(><])(null|true|false|int|float|bool|([-\w]+-)?string|Stringable|array|object|mixed|resource|iterable|void|callable|stdClass)(?=[:]{2}|[\.\s\|><,\(\)\{\}]+)/', '$1', $message, ); From 4100d3b81d0175175dab243326ec11cdc080e1d2 Mon Sep 17 00:00:00 2001 From: Simon Bigelmayr Date: Wed, 24 Sep 2025 11:17:06 +0200 Subject: [PATCH 2/5] add missing testcase for stdClass --- tests/TicketSwapErrorFormatterTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/TicketSwapErrorFormatterTest.php b/tests/TicketSwapErrorFormatterTest.php index fc3b5e5..a1e2085 100644 --- a/tests/TicketSwapErrorFormatterTest.php +++ b/tests/TicketSwapErrorFormatterTest.php @@ -217,6 +217,13 @@ public static function provideHighlight() : iterable null, true ]; + yield [ + 'Property App\Models\ExampleModel::$example_property (stdClass|null) does not accept mixed.', + 'Property App\Models\ExampleModel::$example_property (stdClass|null) does not accept mixed.', + null, + null, + true, + ]; } /** From adb8336c1413862751e3d9fb99fd13adba06a2f7 Mon Sep 17 00:00:00 2001 From: Simon Bigelmayr Date: Wed, 24 Sep 2025 11:19:27 +0200 Subject: [PATCH 3/5] fix test --- tests/TicketSwapErrorFormatterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TicketSwapErrorFormatterTest.php b/tests/TicketSwapErrorFormatterTest.php index a1e2085..d2e1ba9 100644 --- a/tests/TicketSwapErrorFormatterTest.php +++ b/tests/TicketSwapErrorFormatterTest.php @@ -218,7 +218,7 @@ public static function provideHighlight() : iterable true ]; yield [ - 'Property App\Models\ExampleModel::$example_property (stdClass|null) does not accept mixed.', + 'Property App\Models\ExampleModel::$example_property (stdClass|null) does not accept mixed.', 'Property App\Models\ExampleModel::$example_property (stdClass|null) does not accept mixed.', null, null, From 8f5b19ef40ef810405f97b55ce69f1f797e052ab Mon Sep 17 00:00:00 2001 From: Simon Bigelmayr Date: Wed, 24 Sep 2025 11:36:13 +0200 Subject: [PATCH 4/5] add comma as lookbehind for types regex --- src/TicketSwapErrorFormatter.php | 2 +- tests/TicketSwapErrorFormatterTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/TicketSwapErrorFormatter.php b/src/TicketSwapErrorFormatter.php index 72defc1..ca502c7 100644 --- a/src/TicketSwapErrorFormatter.php +++ b/src/TicketSwapErrorFormatter.php @@ -245,7 +245,7 @@ public static function highlight(string $message, ?string $tip, ?string $identif // Types $message = (string) preg_replace( - '/(?<=[\s\|\(><])(null|true|false|int|float|bool|([-\w]+-)?string|Stringable|array|object|mixed|resource|iterable|void|callable|stdClass)(?=[:]{2}|[\.\s\|><,\(\)\{\}]+)/', + '/(?<=[\s\|\(><,])(null|true|false|int|float|bool|([-\w]+-)?string|Stringable|array|object|mixed|resource|iterable|void|callable|stdClass)(?=[:]{2}|[\.\s\|><,\(\)\{\}]+)/', '$1', $message, ); diff --git a/tests/TicketSwapErrorFormatterTest.php b/tests/TicketSwapErrorFormatterTest.php index d2e1ba9..8565a4b 100644 --- a/tests/TicketSwapErrorFormatterTest.php +++ b/tests/TicketSwapErrorFormatterTest.php @@ -224,6 +224,13 @@ public static function provideHighlight() : iterable null, true, ]; + yield [ + 'Parameter #1 $callback of method Illuminate\Support\Collection<int,mixed>: map() expects', + 'Parameter #1 $callback of method Illuminate\Support\Collection::map() expects', + null, + null, + true, + ]; } /** From 242fc54cd5d1750f0468cbd0687f7b2cc74a3c75 Mon Sep 17 00:00:00 2001 From: Simon Bigelmayr Date: Wed, 24 Sep 2025 11:41:11 +0200 Subject: [PATCH 5/5] fix test --- tests/TicketSwapErrorFormatterTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TicketSwapErrorFormatterTest.php b/tests/TicketSwapErrorFormatterTest.php index 8565a4b..08a4aa3 100644 --- a/tests/TicketSwapErrorFormatterTest.php +++ b/tests/TicketSwapErrorFormatterTest.php @@ -225,7 +225,7 @@ public static function provideHighlight() : iterable true, ]; yield [ - 'Parameter #1 $callback of method Illuminate\Support\Collection<int,mixed>: map() expects', + 'Parameter #1 $callback of method Illuminate\Support\Collection<int,mixed>::map() expects', 'Parameter #1 $callback of method Illuminate\Support\Collection::map() expects', null, null,