Skip to content

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

Merged
mnapoli merged 2 commits into4.4from
feature/callable-class
Sep 27, 2014
Merged

Container::call() now supports invokable class names#192
mnapoli merged 2 commits into4.4from
feature/callable-class

Conversation

@mnapoli
Copy link
Copy Markdown
Member

@mnapoli 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:

$container->call('Foo');

// is the same as
$container->call(
    $container->get('Foo')
);

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 self-assigned this Sep 27, 2014
mnapoli added a commit that referenced this pull request Sep 27, 2014
Container::call() now supports invokable class names
@mnapoli mnapoli merged commit b966785 into 4.4 Sep 27, 2014
@mnapoli mnapoli deleted the feature/callable-class branch September 27, 2014 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant