Skip to content

Commit 72bfe31

Browse files
committed
Fix CallableProxy::toString() for PHP 8.4
PHP 8.4 adds a new closure name format matching '{closure:CLASS::METHOD:LINENO}'. Since we want to preserve BC down to PHP 7.2 we unfortunately can't use that additional information.
1 parent 7ad5c4c commit 72bfe31

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/CallableProxy.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ public function toString(): string
9191
$closureName = $closureReflector->getName();
9292
if (substr_compare($closureName, '\\{closure}', -10) === 0) {
9393
$closureName = '{closure}';
94+
// @codeCoverageIgnoreStart
95+
} elseif (substr_compare($closureName, '{closure:', 0, 9) === 0) {
96+
// TODO: PHP 8.4 adds a new closure name format matching '{closure:CLASS::METHOD:LINENO}'
97+
// since we want to preserve BC here we unfortunately can't use that additional information
98+
$closureName = '{closure}';
99+
// @codeCoverageIgnoreEnd
94100
}
95101

96102
if ($closureReflector->getClosureThis() !== null) {

0 commit comments

Comments
 (0)