Container::call() now supports invokable class names #192

merged 2 commits into from Sep 27, 2014


None yet
1 participant

mnapoli commented Sep 27, 2014

Container::call() supports callable objects:

class Foo {
    public function __invoke() {

$container->call(new Foo);

This pull request adds support for providing the class name as string: $container->call('Foo');.

The object will be created using $container->get() before being invoked. For example:


// is the same as

This feature adds consistency for Container::call() with #185 and #173. Now Container::call() can call anything and it's awesome.

I have also included tests for the definition dumpers.

@mnapoli mnapoli added this to the 4.4 milestone Sep 27, 2014

@mnapoli mnapoli added the enhancement label Sep 27, 2014

@mnapoli mnapoli self-assigned this Sep 27, 2014

mnapoli added a commit that referenced this pull request Sep 27, 2014

Merge pull request #192 from mnapoli/feature/callable-class
Container::call() now supports invokable class names

@mnapoli mnapoli merged commit b966785 into 4.4 Sep 27, 2014

0 of 2 checks passed

ci/scrutinizer Scrutinizer: No new issues — Tests: pending
continuous-integration/travis-ci The Travis CI build is in progress

@mnapoli mnapoli deleted the feature/callable-class branch Sep 27, 2014

@tobscure tobscure referenced this pull request in flarum/core Jan 10, 2018


New PHP Extension API #851

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