<?php

namespace JDesrosiers\Resourceful\ResourcefulServiceProvider;

use Pimple\Container;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class ResourcesFactory
{
    private $app;

    public function __construct(Container $app)
    {
        $this->app = $app;
    }

    public function __invoke($schema)
    {
        $resource = $this->app["controllers_factory"];

        $resource->after(function (Request $request, Response $response, Application $app) use ($schema) {
            if ($response->isSuccessful()) {
                $app["json-schema.describedBy"] = $schema;
            }
        });

        return $resource;
    }
}

<?php

namespace JDesrosiers\Resourceful\ResourcefulServiceProvider;

use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class ResourcesFactory
{
    private $app;

    public function __construct(Application $app)
    {
        $this->app = $app;
    }

    public function __invoke($schema)
    {
        $resource = $this->app["controllers_factory"];

        $resource->after(function (Request $request, Response $response, Application $app) use ($schema) {
            if ($response->isSuccessful()) {
                $app["json-schema.describedBy"] = $schema;
            }
        });

        return $resource;
    }
}

--- 
+++ 
@@ -2,6 +2,7 @@
 
 namespace JDesrosiers\Resourceful\ResourcefulServiceProvider;
 
+use Pimple\Container;
 use Silex\Application;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
@@ -10,7 +11,7 @@
 {
     private $app;
 
-    public function __construct(Application $app)
+    public function __construct(Container $app)
     {
         $this->app = $app;
     }
Fix type issue between Application and Container

ResourceFactory should take a Container, not an Application.
