Skip to content

Commit a7bb40a

Browse files
committed
Fix closure location message assertion for 8.4
1 parent 2acf239 commit a7bb40a

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

test/unit/Logging/ExternalCallSiteFinderTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,20 @@ function log_ab8123723123($asserter) {
129129
[
130130
<<<'PHP'
131131
// Anonymous func
132+
use test\unit\Ingenerator\PHPUtils\Logging\ExternalCallSiteFinderTest;
132133
return (function ($asserter) {
133-
return $asserter->test(['file' => __FILE__, 'line' => __LINE__, 'function' => '{closure}']);
134+
if (PHP_VERSION_ID < 80400) {
135+
$expected_func_name = '{closure}';
136+
} else {
137+
$expected_func_name = sprintf("%s->{closure:%s:%d}",
138+
ExternalCallSiteFinderTest::class,
139+
__FILE__,
140+
// it's the line with the 'function' keyword
141+
(__LINE__-8)
142+
);
143+
}
144+
return $asserter->test(['file' => __FILE__, 'line' => __LINE__, 'function' => $expected_func_name]);
145+
134146
})($asserter);
135147
PHP
136148
,

0 commit comments

Comments
 (0)