On Fri, 2008-07-04 at 11:31 +0200, Lars Strojny wrote:
> Hi Johannes,
> 
> Am Freitag, den 04.07.2008, 11:18 +0200 schrieb Johannes Schlüter:
> > Now such a check isn't possible, all reflection information on the
> > callback I can get is that it is an object of type Closure having a
> > method __invoke() with zero required parameters. There's no further
> > information on the function, so probably we need a ReflectionClosure
> > class or something
> 
> Couldn't ReflectionFunction play that role. Classes and instances with a
> defined "__invoke" method can be reflected with ReflectionFunction?

At the moment: not enough.

$ php -r 'echo new ReflectionObject(function ($a, $b) use ($c) {});'
Object of class [ <internal> final class Closure ] {

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Dynamic properties [0] {
  }

  - Methods [1] {
    Method [ <internal> public method __invoke ] {
    }
  }
}

it's not mentioning the parameters or the used variable, and yes, it's a
tiny issue which can, most likely, fixed within an hour or so but I
guess we'll have many more of that kind: Tiny issues which end up in
discussions about taste ("should we add a new class or simply add
special treatment in ReflectionMethod for Closure::__invoke?") and all
this stuff can delay things... That's the risk I'm seeing.

johannes


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to