Created
May 14, 2015 18:36
-
-
Save GRMule/addd42fe35263b3f518a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('../vendor/autoload.php'); // composer autoload | |
class Foo { | |
public $someProperty = 'val1'; | |
} | |
class Bar { | |
public function __construct($valueFromFoo){ | |
} | |
} | |
$auryn = new Auryn\Injector(); | |
$auryn->delegate('Bar', function (Foo $foo) { | |
return new Bar($foo->someProperty); | |
}); | |
$bar = $auryn->make('Bar'); | |
// expected: delegate function is provisioed with a Foo object | |
// actual: Catchable fatal error: Argument 1 passed to {closure}() must be an instance of Foo, string given |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment