Closed augustohp closed 11 years ago
$votes++;
Maybe this will fix an issue I had with Symfony HttpKernel and route callbacks.
I am not following, perhaps a use case or example of the problem.
__invoke
will continue to be inherited by subclasses.
php> class ABC {
... function __invoke() {
... echo "I am invoked ".get_class($this);
... }
... }
php> class DEF extends ABC {}
php> $a = new ABC;
php> $b = new DEF;
php> $a();
I am invoked ABC
php> $b();
I am invoked DEF
That's because Instantiator
doesn't extend the class he is supposed to instantiate. The testcase is something like:
<?php
class Foo {
public $hello;
function __invoke() { return $this->hello; }
function setHello($hello) {$this->hello = $hello;}
}
$c = new Container(parse_ini_string('
[foo Foo]
setHello[] = [Hello Pandas]
'));
$helloCallable = $c->foo;
print $helloCallable(); //Hello Pandas
Because if it encapsulates an object that implements it, this prevents the __invoke() be runned into the object.