Skip to content

PHP 8.6: unable to create PFA callable from never-returning function #25441

Closed

Description

@ondrejmirtes

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

Activity

  1. TimWolla commented on Nov 13, 2026

    @TimWolla
    Member

    Already fixed in 5e8d15e

  2. ondrejmirtes commented on Nov 13, 2026

    @ondrejmirtes
    ContributorAuthor

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions