Commit 2d3a96bb authored by Fabien Potencier's avatar Fabien Potencier

changed type-hint to Pimple whenever possible

parent df568cb2
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
namespace Silex\Api; namespace Silex\Api;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Silex\Application;
/** /**
* Interface for event listener providers. * Interface for event listener providers.
...@@ -21,5 +20,5 @@ use Silex\Application; ...@@ -21,5 +20,5 @@ use Silex\Application;
*/ */
interface EventListenerProviderInterface interface EventListenerProviderInterface
{ {
public function subscribe(Application $app, EventDispatcherInterface $dispatcher); public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher);
} }
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
namespace Silex\Api; namespace Silex\Api;
use Silex\Application;
/** /**
* Interface that all Silex service providers must implement. * Interface that all Silex service providers must implement.
* *
...@@ -21,12 +19,12 @@ use Silex\Application; ...@@ -21,12 +19,12 @@ use Silex\Application;
interface ServiceProviderInterface interface ServiceProviderInterface
{ {
/** /**
* Registers services on the given app. * Registers services on the given Pimple container.
* *
* This method should only be used to configure services and parameters. * This method should only be used to configure services and parameters.
* It should not get services. * It should not get services.
* *
* @param Application $app An Application instance * @param Pimple $app A Pimple instance
*/ */
public function register(Application $app); public function register(\Pimple $app);
} }
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Configuration;
...@@ -25,7 +24,7 @@ use Symfony\Bridge\Doctrine\Logger\DbalLogger; ...@@ -25,7 +24,7 @@ use Symfony\Bridge\Doctrine\Logger\DbalLogger;
*/ */
class DoctrineServiceProvider implements ServiceProviderInterface class DoctrineServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['db.default_options'] = array( $app['db.default_options'] = array(
'driver' => 'pdo_mysql', 'driver' => 'pdo_mysql',
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Symfony\Component\Form\Extension\Csrf\CsrfExtension; use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider; use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider;
...@@ -28,7 +27,7 @@ use Symfony\Component\Form\ResolvedFormTypeFactory; ...@@ -28,7 +27,7 @@ use Symfony\Component\Form\ResolvedFormTypeFactory;
*/ */
class FormServiceProvider implements ServiceProviderInterface class FormServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
if (!class_exists('Locale') && !class_exists('Symfony\Component\Locale\Stub\StubLocale')) { if (!class_exists('Locale') && !class_exists('Symfony\Component\Locale\Stub\StubLocale')) {
throw new \RuntimeException('You must either install the PHP intl extension or the Symfony Locale Component to use the Form extension.'); throw new \RuntimeException('You must either install the PHP intl extension or the Symfony Locale Component to use the Form extension.');
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\HttpCache; use Silex\HttpCache;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface; use Silex\Api\EventListenerProviderInterface;
...@@ -27,7 +26,7 @@ use Symfony\Component\HttpKernel\EventListener\EsiListener; ...@@ -27,7 +26,7 @@ use Symfony\Component\HttpKernel\EventListener\EsiListener;
*/ */
class HttpCacheServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface class HttpCacheServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['http_cache'] = $app->share(function ($app) { $app['http_cache'] = $app->share(function ($app) {
$app['http_cache.options'] = array_replace( $app['http_cache.options'] = array_replace(
...@@ -54,7 +53,7 @@ class HttpCacheServiceProvider implements ServiceProviderInterface, EventListene ...@@ -54,7 +53,7 @@ class HttpCacheServiceProvider implements ServiceProviderInterface, EventListene
$app['http_cache.options'] = array(); $app['http_cache.options'] = array();
} }
public function subscribe(Application $app, EventDispatcherInterface $dispatcher) public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{ {
$dispatcher->addSubscriber($app['http_cache.esi_listener']); $dispatcher->addSubscriber($app['http_cache.esi_listener']);
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface; use Silex\Api\EventListenerProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
...@@ -29,7 +28,7 @@ use Symfony\Component\HttpKernel\UriSigner; ...@@ -29,7 +28,7 @@ use Symfony\Component\HttpKernel\UriSigner;
*/ */
class HttpFragmentServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface class HttpFragmentServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['fragment.handler'] = $app->share(function ($app) { $app['fragment.handler'] = $app->share(function ($app) {
return new FragmentHandler($app['fragment.renderers'], $app['debug'], $app['request_stack']); return new FragmentHandler($app['fragment.renderers'], $app['debug'], $app['request_stack']);
...@@ -78,7 +77,7 @@ class HttpFragmentServiceProvider implements ServiceProviderInterface, EventList ...@@ -78,7 +77,7 @@ class HttpFragmentServiceProvider implements ServiceProviderInterface, EventList
}); });
} }
public function subscribe(Application $app, EventDispatcherInterface $dispatcher) public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{ {
$dispatcher->addSubscriber($app['fragment.listener']); $dispatcher->addSubscriber($app['fragment.listener']);
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\LazyUrlMatcher; use Silex\LazyUrlMatcher;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface; use Silex\Api\EventListenerProviderInterface;
...@@ -25,7 +24,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; ...@@ -25,7 +24,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
*/ */
class LocaleServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface class LocaleServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['locale.listener'] = $app->share(function ($app) { $app['locale.listener'] = $app->share(function ($app) {
$urlMatcher = null; $urlMatcher = null;
...@@ -41,7 +40,7 @@ class LocaleServiceProvider implements ServiceProviderInterface, EventListenerPr ...@@ -41,7 +40,7 @@ class LocaleServiceProvider implements ServiceProviderInterface, EventListenerPr
$app['locale'] = 'en'; $app['locale'] = 'en';
} }
public function subscribe(Application $app, EventDispatcherInterface $dispatcher) public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{ {
$dispatcher->addSubscriber($app['locale.listener']); $dispatcher->addSubscriber($app['locale.listener']);
} }
......
...@@ -29,7 +29,7 @@ use Silex\EventListener\LogListener; ...@@ -29,7 +29,7 @@ use Silex\EventListener\LogListener;
*/ */
class MonologServiceProvider implements ServiceProviderInterface, BootableProviderInterface class MonologServiceProvider implements ServiceProviderInterface, BootableProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['logger'] = function () use ($app) { $app['logger'] = function () use ($app) {
return $app['monolog']; return $app['monolog'];
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface; use Silex\Api\EventListenerProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
...@@ -27,7 +26,7 @@ use Symfony\Component\Security\Http\RememberMe\ResponseListener; ...@@ -27,7 +26,7 @@ use Symfony\Component\Security\Http\RememberMe\ResponseListener;
*/ */
class RememberMeServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface class RememberMeServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['security.remember_me.response_listener'] = $app->share(function ($app) { $app['security.remember_me.response_listener'] = $app->share(function ($app) {
if (!isset($app['security'])) { if (!isset($app['security'])) {
...@@ -99,7 +98,7 @@ class RememberMeServiceProvider implements ServiceProviderInterface, EventListen ...@@ -99,7 +98,7 @@ class RememberMeServiceProvider implements ServiceProviderInterface, EventListen
}); });
} }
public function subscribe(Application $app, EventDispatcherInterface $dispatcher) public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{ {
$dispatcher->addSubscriber($app['security.remember_me.response_listener']); $dispatcher->addSubscriber($app['security.remember_me.response_listener']);
} }
......
...@@ -65,7 +65,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener ...@@ -65,7 +65,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
{ {
protected $fakeRoutes; protected $fakeRoutes;
public function register(Application $app) public function register(\Pimple $app)
{ {
// used to register routes for login_check and logout // used to register routes for login_check and logout
$this->fakeRoutes = array(); $this->fakeRoutes = array();
...@@ -539,7 +539,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener ...@@ -539,7 +539,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
} }
} }
public function subscribe(Application $app, EventDispatcherInterface $dispatcher) public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{ {
$dispatcher->addSubscriber($app['security.firewall']); $dispatcher->addSubscriber($app['security.firewall']);
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\Encoder\JsonEncoder;
...@@ -33,9 +32,9 @@ class SerializerServiceProvider implements ServiceProviderInterface ...@@ -33,9 +32,9 @@ class SerializerServiceProvider implements ServiceProviderInterface
* This method registers a serializer service. {@link http://api.symfony.com/master/Symfony/Component/Serializer/Serializer.html * This method registers a serializer service. {@link http://api.symfony.com/master/Symfony/Component/Serializer/Serializer.html
* The service is provided by the Symfony Serializer component}. * The service is provided by the Symfony Serializer component}.
* *
* @param Silex\Application $app * @param Pimple $app
*/ */
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['serializer'] = $app->share(function () use ($app) { $app['serializer'] = $app->share(function () use ($app) {
return new Serializer($app['serializer.normalizers'], $app['serializer.encoders']); return new Serializer($app['serializer.normalizers'], $app['serializer.encoders']);
......
...@@ -11,13 +11,12 @@ ...@@ -11,13 +11,12 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Silex\ServiceControllerResolver; use Silex\ServiceControllerResolver;
class ServiceControllerServiceProvider implements ServiceProviderInterface class ServiceControllerServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['resolver'] = $app->share($app->extend('resolver', function ($resolver, $app) { $app['resolver'] = $app->share($app->extend('resolver', function ($resolver, $app) {
return new ServiceControllerResolver($resolver, $app['callback_resolver']); return new ServiceControllerResolver($resolver, $app['callback_resolver']);
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface; use Silex\Api\EventListenerProviderInterface;
use Silex\EventListener\SessionListener; use Silex\EventListener\SessionListener;
...@@ -31,7 +30,7 @@ class SessionServiceProvider implements ServiceProviderInterface, EventListenerP ...@@ -31,7 +30,7 @@ class SessionServiceProvider implements ServiceProviderInterface, EventListenerP
{ {
private $app; private $app;
public function register(Application $app) public function register(\Pimple $app)
{ {
$this->app = $app; $this->app = $app;
...@@ -77,7 +76,7 @@ class SessionServiceProvider implements ServiceProviderInterface, EventListenerP ...@@ -77,7 +76,7 @@ class SessionServiceProvider implements ServiceProviderInterface, EventListenerP
$app['session.storage.save_path'] = null; $app['session.storage.save_path'] = null;
} }
public function subscribe(Application $app, EventDispatcherInterface $dispatcher) public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{ {
$dispatcher->addSubscriber($app['session.listener']); $dispatcher->addSubscriber($app['session.listener']);
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface; use Silex\Api\EventListenerProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
...@@ -25,7 +24,7 @@ use Symfony\Component\HttpKernel\Event\PostResponseEvent; ...@@ -25,7 +24,7 @@ use Symfony\Component\HttpKernel\Event\PostResponseEvent;
*/ */
class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['swiftmailer.options'] = array(); $app['swiftmailer.options'] = array();
...@@ -88,7 +87,7 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe ...@@ -88,7 +87,7 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe
}); });
} }
public function subscribe(Application $app, EventDispatcherInterface $dispatcher) public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{ {
$dispatcher->addListener(KernelEvents::TERMINATE, function (PostResponseEvent $event) use ($app) { $dispatcher->addListener(KernelEvents::TERMINATE, function (PostResponseEvent $event) use ($app) {
// To speed things up (by avoiding Swift Mailer initialization), flush // To speed things up (by avoiding Swift Mailer initialization), flush
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Silex\Translator; use Silex\Translator;
use Symfony\Component\Translation\MessageSelector; use Symfony\Component\Translation\MessageSelector;
...@@ -25,7 +24,7 @@ use Symfony\Component\Translation\Loader\XliffFileLoader; ...@@ -25,7 +24,7 @@ use Symfony\Component\Translation\Loader\XliffFileLoader;
*/ */
class TranslationServiceProvider implements ServiceProviderInterface class TranslationServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['translator'] = $app->share(function ($app) { $app['translator'] = $app->share(function ($app) {
if (!isset($app['locale'])) { if (!isset($app['locale'])) {
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Symfony\Bridge\Twig\Extension\RoutingExtension; use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension; use Symfony\Bridge\Twig\Extension\TranslationExtension;
...@@ -28,7 +27,7 @@ use Symfony\Bridge\Twig\Form\TwigRenderer; ...@@ -28,7 +27,7 @@ use Symfony\Bridge\Twig\Form\TwigRenderer;
*/ */
class TwigServiceProvider implements ServiceProviderInterface class TwigServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['twig.options'] = array(); $app['twig.options'] = array();
$app['twig.form.templates'] = array('form_div_layout.html.twig'); $app['twig.form.templates'] = array('form_div_layout.html.twig');
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Symfony\Component\Routing\Generator\UrlGenerator; use Symfony\Component\Routing\Generator\UrlGenerator;
...@@ -22,7 +21,7 @@ use Symfony\Component\Routing\Generator\UrlGenerator; ...@@ -22,7 +21,7 @@ use Symfony\Component\Routing\Generator\UrlGenerator;
*/ */
class UrlGeneratorServiceProvider implements ServiceProviderInterface class UrlGeneratorServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['url_generator'] = $app->share(function ($app) { $app['url_generator'] = $app->share(function ($app) {
$app->flush(); $app->flush();
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
namespace Silex\Provider; namespace Silex\Provider;
use Silex\Application;
use Silex\Api\ServiceProviderInterface; use Silex\Api\ServiceProviderInterface;
use Silex\ConstraintValidatorFactory; use Silex\ConstraintValidatorFactory;
use Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Validator;
...@@ -26,7 +25,7 @@ use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader; ...@@ -26,7 +25,7 @@ use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader;
*/ */
class ValidatorServiceProvider implements ServiceProviderInterface class ValidatorServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(\Pimple $app)
{ {
$app['validator'] = $app->share(function ($app) { $app['validator'] = $app->share(function ($app) {
$r = new \ReflectionClass('Symfony\Component\Validator\Validator'); $r = new \ReflectionClass('Symfony\Component\Validator\Validator');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment