Jasrags/Dice — pull request #1 by kenjis (2014-01-17 15:40:03+00:00)
Title: Fix Composer Autoloader can't find class

I got an error below:

~~~
Class twig_loader_filesystem does not exist
~~~

The true class name is `Twig_Loader_Filesystem` and located in `vendor/twig/twig/lib/Twig/Loader/Filesystem.php`.

My code is below:

~~~php
$rule1 = new \Jasrags\Dice\Rule;
$rule1->instanceOf = 'Twig_Loader_Filesystem';
$rule1->constructParams = [__DIR__ . '/../app/views'];
$container->addRule('$MyTwig_Loader_Filesystem', $rule1);

$rule2 = new \Jasrags\Dice\Rule;
$rule2->shared = true;
$rule2->constructParams = [['cache' => __DIR__ . '/../cache']];
$rule2->substitutions['Twig_LoaderInterface'] = new \Jasrags\Dice\Instance('$MyTwig_Loader_Filesystem');
$container->addRule('Twig_Environment', $rule2);
~~~