Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typehint callable not supported #582

Closed
lstrojny opened this issue Sep 11, 2012 · 4 comments
Closed

Typehint callable not supported #582

lstrojny opened this issue Sep 11, 2012 · 4 comments

Comments

@lstrojny
Copy link

PHP 5.4 introduces the callable typehint to allow closures, string $function and array($obj, 'method'). See http://php.net/manual/de/language.types.callable.php for details. HipHop analyzes callable as UnknownClass.

@paroski
Copy link

paroski commented Oct 12, 2012

HipHop does not currently support all PHP 5.4 features. We plan to add support for the "callable" typehint some time in the coming months.

@ptarjan
Copy link
Contributor

ptarjan commented May 13, 2013

It's there now: cc37fe6

@ptarjan ptarjan closed this as completed May 13, 2013
@evert
Copy link
Contributor

evert commented Dec 2, 2013

This is still failing for me:

<?php

function callMe(callable $b) {

    $b();

}

callMe(function() {

    echo "hello\n";

});

Throws:

HipHop Fatal error: Argument 1 passed to callMe() must be an instance of callable, Closure$callMe$47daeefeedcd4b135f362b25e98454cc$ given in /Users/evert/code/sabre/event/tests/foo3.php on line 7

Version:

$ hhvm --version
HipHop VM v2.3.0-dev (rel)
Compiler: heads/master-0-gf6413a9d4ca5a0646290bf180702e967ff1daf61
Repo schema: 536d56f98b940f0920eafa10249dca34d2e855de

@scannell
Copy link
Contributor

scannell commented Dec 2, 2013

@paroski, this seems to work only when EnableHipHopSyntax=1. Any idea why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants