Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Commit

Permalink
changed type-hint to Pimple whenever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 29, 2014
1 parent df568cb commit 2d3a96b
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 45 deletions.
3 changes: 1 addition & 2 deletions src/Silex/Api/EventListenerProviderInterface.php
Expand Up @@ -12,7 +12,6 @@
namespace Silex\Api;

use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Silex\Application;

/**
* Interface for event listener providers.
Expand All @@ -21,5 +20,5 @@
*/
interface EventListenerProviderInterface
{
public function subscribe(Application $app, EventDispatcherInterface $dispatcher);
public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher);
}
8 changes: 3 additions & 5 deletions src/Silex/Api/ServiceProviderInterface.php
Expand Up @@ -11,8 +11,6 @@

namespace Silex\Api;

use Silex\Application;

/**
* Interface that all Silex service providers must implement.
*
Expand All @@ -21,12 +19,12 @@
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.
* 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);
}
3 changes: 1 addition & 2 deletions src/Silex/Provider/DoctrineServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Configuration;
Expand All @@ -25,7 +24,7 @@
*/
class DoctrineServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['db.default_options'] = array(
'driver' => 'pdo_mysql',
Expand Down
3 changes: 1 addition & 2 deletions src/Silex/Provider/FormServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider;
Expand All @@ -28,7 +27,7 @@
*/
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')) {
throw new \RuntimeException('You must either install the PHP intl extension or the Symfony Locale Component to use the Form extension.');
Expand Down
5 changes: 2 additions & 3 deletions src/Silex/Provider/HttpCacheServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\HttpCache;
use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface;
Expand All @@ -27,7 +26,7 @@
*/
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.options'] = array_replace(
Expand All @@ -54,7 +53,7 @@ public function register(Application $app)
$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']);
}
Expand Down
5 changes: 2 additions & 3 deletions src/Silex/Provider/HttpFragmentServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand All @@ -29,7 +28,7 @@
*/
class HttpFragmentServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['fragment.handler'] = $app->share(function ($app) {
return new FragmentHandler($app['fragment.renderers'], $app['debug'], $app['request_stack']);
Expand Down Expand Up @@ -78,7 +77,7 @@ public function register(Application $app)
});
}

public function subscribe(Application $app, EventDispatcherInterface $dispatcher)
public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{
$dispatcher->addSubscriber($app['fragment.listener']);
}
Expand Down
5 changes: 2 additions & 3 deletions src/Silex/Provider/LocaleServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\LazyUrlMatcher;
use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface;
Expand All @@ -25,7 +24,7 @@
*/
class LocaleServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['locale.listener'] = $app->share(function ($app) {
$urlMatcher = null;
Expand All @@ -41,7 +40,7 @@ public function register(Application $app)
$app['locale'] = 'en';
}

public function subscribe(Application $app, EventDispatcherInterface $dispatcher)
public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{
$dispatcher->addSubscriber($app['locale.listener']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Silex/Provider/MonologServiceProvider.php
Expand Up @@ -29,7 +29,7 @@
*/
class MonologServiceProvider implements ServiceProviderInterface, BootableProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['logger'] = function () use ($app) {
return $app['monolog'];
Expand Down
5 changes: 2 additions & 3 deletions src/Silex/Provider/RememberMeServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand All @@ -27,7 +26,7 @@
*/
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) {
if (!isset($app['security'])) {
Expand Down Expand Up @@ -99,7 +98,7 @@ public function register(Application $app)
});
}

public function subscribe(Application $app, EventDispatcherInterface $dispatcher)
public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{
$dispatcher->addSubscriber($app['security.remember_me.response_listener']);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Silex/Provider/SecurityServiceProvider.php
Expand Up @@ -65,7 +65,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
{
protected $fakeRoutes;

public function register(Application $app)
public function register(\Pimple $app)
{
// used to register routes for login_check and logout
$this->fakeRoutes = array();
Expand Down Expand Up @@ -539,7 +539,7 @@ public function register(Application $app)
}
}

public function subscribe(Application $app, EventDispatcherInterface $dispatcher)
public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{
$dispatcher->addSubscriber($app['security.firewall']);
}
Expand Down
5 changes: 2 additions & 3 deletions src/Silex/Provider/SerializerServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
Expand All @@ -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
* 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) {
return new Serializer($app['serializer.normalizers'], $app['serializer.encoders']);
Expand Down
3 changes: 1 addition & 2 deletions src/Silex/Provider/ServiceControllerServiceProvider.php
Expand Up @@ -11,13 +11,12 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Silex\ServiceControllerResolver;

class ServiceControllerServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['resolver'] = $app->share($app->extend('resolver', function ($resolver, $app) {
return new ServiceControllerResolver($resolver, $app['callback_resolver']);
Expand Down
5 changes: 2 additions & 3 deletions src/Silex/Provider/SessionServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface;
use Silex\EventListener\SessionListener;
Expand All @@ -31,7 +30,7 @@ class SessionServiceProvider implements ServiceProviderInterface, EventListenerP
{
private $app;

public function register(Application $app)
public function register(\Pimple $app)
{
$this->app = $app;

Expand Down Expand Up @@ -77,7 +76,7 @@ public function register(Application $app)
$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']);

Expand Down
5 changes: 2 additions & 3 deletions src/Silex/Provider/SwiftmailerServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Silex\Api\EventListenerProviderInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand All @@ -25,7 +24,7 @@
*/
class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['swiftmailer.options'] = array();

Expand Down Expand Up @@ -88,7 +87,7 @@ public function register(Application $app)
});
}

public function subscribe(Application $app, EventDispatcherInterface $dispatcher)
public function subscribe(\Pimple $app, EventDispatcherInterface $dispatcher)
{
$dispatcher->addListener(KernelEvents::TERMINATE, function (PostResponseEvent $event) use ($app) {
// To speed things up (by avoiding Swift Mailer initialization), flush
Expand Down
3 changes: 1 addition & 2 deletions src/Silex/Provider/TranslationServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Silex\Translator;
use Symfony\Component\Translation\MessageSelector;
Expand All @@ -25,7 +24,7 @@
*/
class TranslationServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['translator'] = $app->share(function ($app) {
if (!isset($app['locale'])) {
Expand Down
3 changes: 1 addition & 2 deletions src/Silex/Provider/TwigServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Symfony\Bridge\Twig\Extension\RoutingExtension;
use Symfony\Bridge\Twig\Extension\TranslationExtension;
Expand All @@ -28,7 +27,7 @@
*/
class TwigServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['twig.options'] = array();
$app['twig.form.templates'] = array('form_div_layout.html.twig');
Expand Down
3 changes: 1 addition & 2 deletions src/Silex/Provider/UrlGeneratorServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Symfony\Component\Routing\Generator\UrlGenerator;

Expand All @@ -22,7 +21,7 @@
*/
class UrlGeneratorServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['url_generator'] = $app->share(function ($app) {
$app->flush();
Expand Down
3 changes: 1 addition & 2 deletions src/Silex/Provider/ValidatorServiceProvider.php
Expand Up @@ -11,7 +11,6 @@

namespace Silex\Provider;

use Silex\Application;
use Silex\Api\ServiceProviderInterface;
use Silex\ConstraintValidatorFactory;
use Symfony\Component\Validator\Validator;
Expand All @@ -26,7 +25,7 @@
*/
class ValidatorServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
public function register(\Pimple $app)
{
$app['validator'] = $app->share(function ($app) {
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');
Expand Down

0 comments on commit 2d3a96b

Please sign in to comment.