php-src
php-src copied to clipboard
PHP 8.6: unable to create PFA callable from never-returning function
Description
The following code:
<?php
function doFoo($a): never {
}
doFoo(...); // works
doFoo(?); // does not work
Resulted in this output:
Fatal error: A never-returning function must not return in test.php on line 8
But I expected this output instead:
(empty)
PHP Version
PHP 8.6.0-dev (cli) (built: Nov 11 2026 23:30:36) (NTS)
Copyright © The PHP Group and Contributors
Built by Shivam Mathur
Zend Engine v4.6.0-dev, Copyright © Zend by Perforce
with Zend OPcache v8.6.0-dev, Copyright ©, by Zend by Perforce
Operating System
macOS 27.2.1
Already fixed in 5e8d15e57017efb1076b513f5bce67c9ce980f25
Thank you!