Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
2d3a96bb
Commit
2d3a96bb
authored
Nov 04, 2013
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed type-hint to Pimple whenever possible
parent
df568cb2
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
28 additions
and
45 deletions
+28
-45
src/Silex/Api/EventListenerProviderInterface.php
src/Silex/Api/EventListenerProviderInterface.php
+1
-2
src/Silex/Api/ServiceProviderInterface.php
src/Silex/Api/ServiceProviderInterface.php
+3
-5
src/Silex/Provider/DoctrineServiceProvider.php
src/Silex/Provider/DoctrineServiceProvider.php
+1
-2
src/Silex/Provider/FormServiceProvider.php
src/Silex/Provider/FormServiceProvider.php
+1
-2
src/Silex/Provider/HttpCacheServiceProvider.php
src/Silex/Provider/HttpCacheServiceProvider.php
+2
-3
src/Silex/Provider/HttpFragmentServiceProvider.php
src/Silex/Provider/HttpFragmentServiceProvider.php
+2
-3
src/Silex/Provider/LocaleServiceProvider.php
src/Silex/Provider/LocaleServiceProvider.php
+2
-3
src/Silex/Provider/MonologServiceProvider.php
src/Silex/Provider/MonologServiceProvider.php
+1
-1
src/Silex/Provider/RememberMeServiceProvider.php
src/Silex/Provider/RememberMeServiceProvider.php
+2
-3
src/Silex/Provider/SecurityServiceProvider.php
src/Silex/Provider/SecurityServiceProvider.php
+2
-2
src/Silex/Provider/SerializerServiceProvider.php
src/Silex/Provider/SerializerServiceProvider.php
+2
-3
src/Silex/Provider/ServiceControllerServiceProvider.php
src/Silex/Provider/ServiceControllerServiceProvider.php
+1
-2
src/Silex/Provider/SessionServiceProvider.php
src/Silex/Provider/SessionServiceProvider.php
+2
-3
src/Silex/Provider/SwiftmailerServiceProvider.php
src/Silex/Provider/SwiftmailerServiceProvider.php
+2
-3
src/Silex/Provider/TranslationServiceProvider.php
src/Silex/Provider/TranslationServiceProvider.php
+1
-2
src/Silex/Provider/TwigServiceProvider.php
src/Silex/Provider/TwigServiceProvider.php
+1
-2
src/Silex/Provider/UrlGeneratorServiceProvider.php
src/Silex/Provider/UrlGeneratorServiceProvider.php
+1
-2
src/Silex/Provider/ValidatorServiceProvider.php
src/Silex/Provider/ValidatorServiceProvider.php
+1
-2
No files found.
src/Silex/Api/EventListenerProviderInterface.php
View file @
2d3a96bb
...
...
@@ -12,7 +12,6 @@
namespace
Silex\Api
;
use
Symfony\Component\EventDispatcher\EventDispatcherInterface
;
use
Silex\Application
;
/**
* Interface for event listener providers.
...
...
@@ -21,5 +20,5 @@ use Silex\Application;
*/
interface
EventListenerProviderInterface
{
public
function
subscribe
(
Application
$app
,
EventDispatcherInterface
$dispatcher
);
public
function
subscribe
(
\Pimple
$app
,
EventDispatcherInterface
$dispatcher
);
}
src/Silex/Api/ServiceProviderInterface.php
View file @
2d3a96bb
...
...
@@ -11,8 +11,6 @@
namespace
Silex\Api
;
use
Silex\Application
;
/**
* Interface that all Silex service providers must implement.
*
...
...
@@ -21,12 +19,12 @@ use Silex\Application;
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
);
}
src/Silex/Provider/DoctrineServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\Api\ServiceProviderInterface
;
use
Doctrine\DBAL\DriverManager
;
use
Doctrine\DBAL\Configuration
;
...
...
@@ -25,7 +24,7 @@ use Symfony\Bridge\Doctrine\Logger\DbalLogger;
*/
class
DoctrineServiceProvider
implements
ServiceProviderInterface
{
public
function
register
(
Application
$app
)
public
function
register
(
\Pimple
$app
)
{
$app
[
'db.default_options'
]
=
array
(
'driver'
=>
'pdo_mysql'
,
...
...
src/Silex/Provider/FormServiceProvider.php
View file @
2d3a96bb
...
...
@@ -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
;
...
...
@@ -28,7 +27,7 @@ use Symfony\Component\Form\ResolvedFormTypeFactory;
*/
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.'
);
...
...
src/Silex/Provider/HttpCacheServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\HttpCache
;
use
Silex\Api\ServiceProviderInterface
;
use
Silex\Api\EventListenerProviderInterface
;
...
...
@@ -27,7 +26,7 @@ use Symfony\Component\HttpKernel\EventListener\EsiListener;
*/
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
(
...
...
@@ -54,7 +53,7 @@ class HttpCacheServiceProvider implements ServiceProviderInterface, EventListene
$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'
]);
}
...
...
src/Silex/Provider/HttpFragmentServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\Api\ServiceProviderInterface
;
use
Silex\Api\EventListenerProviderInterface
;
use
Symfony\Component\EventDispatcher\EventDispatcherInterface
;
...
...
@@ -29,7 +28,7 @@ use Symfony\Component\HttpKernel\UriSigner;
*/
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'
]);
...
...
@@ -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'
]);
}
...
...
src/Silex/Provider/LocaleServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\LazyUrlMatcher
;
use
Silex\Api\ServiceProviderInterface
;
use
Silex\Api\EventListenerProviderInterface
;
...
...
@@ -25,7 +24,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
*/
class
LocaleServiceProvider
implements
ServiceProviderInterface
,
EventListenerProviderInterface
{
public
function
register
(
Application
$app
)
public
function
register
(
\Pimple
$app
)
{
$app
[
'locale.listener'
]
=
$app
->
share
(
function
(
$app
)
{
$urlMatcher
=
null
;
...
...
@@ -41,7 +40,7 @@ class LocaleServiceProvider implements ServiceProviderInterface, EventListenerPr
$app
[
'locale'
]
=
'en'
;
}
public
function
subscribe
(
Application
$app
,
EventDispatcherInterface
$dispatcher
)
public
function
subscribe
(
\Pimple
$app
,
EventDispatcherInterface
$dispatcher
)
{
$dispatcher
->
addSubscriber
(
$app
[
'locale.listener'
]);
}
...
...
src/Silex/Provider/MonologServiceProvider.php
View file @
2d3a96bb
...
...
@@ -29,7 +29,7 @@ use Silex\EventListener\LogListener;
*/
class
MonologServiceProvider
implements
ServiceProviderInterface
,
BootableProviderInterface
{
public
function
register
(
Application
$app
)
public
function
register
(
\Pimple
$app
)
{
$app
[
'logger'
]
=
function
()
use
(
$app
)
{
return
$app
[
'monolog'
];
...
...
src/Silex/Provider/RememberMeServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\Api\ServiceProviderInterface
;
use
Silex\Api\EventListenerProviderInterface
;
use
Symfony\Component\EventDispatcher\EventDispatcherInterface
;
...
...
@@ -27,7 +26,7 @@ use Symfony\Component\Security\Http\RememberMe\ResponseListener;
*/
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'
]))
{
...
...
@@ -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'
]);
}
...
...
src/Silex/Provider/SecurityServiceProvider.php
View file @
2d3a96bb
...
...
@@ -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
();
...
...
@@ -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'
]);
}
...
...
src/Silex/Provider/SerializerServiceProvider.php
View file @
2d3a96bb
...
...
@@ -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
;
...
...
@@ -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'
]);
...
...
src/Silex/Provider/ServiceControllerServiceProvider.php
View file @
2d3a96bb
...
...
@@ -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'
]);
...
...
src/Silex/Provider/SessionServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\Api\ServiceProviderInterface
;
use
Silex\Api\EventListenerProviderInterface
;
use
Silex\EventListener\SessionListener
;
...
...
@@ -31,7 +30,7 @@ class SessionServiceProvider implements ServiceProviderInterface, EventListenerP
{
private
$app
;
public
function
register
(
Application
$app
)
public
function
register
(
\Pimple
$app
)
{
$this
->
app
=
$app
;
...
...
@@ -77,7 +76,7 @@ class SessionServiceProvider implements ServiceProviderInterface, EventListenerP
$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'
]);
...
...
src/Silex/Provider/SwiftmailerServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\Api\ServiceProviderInterface
;
use
Silex\Api\EventListenerProviderInterface
;
use
Symfony\Component\EventDispatcher\EventDispatcherInterface
;
...
...
@@ -25,7 +24,7 @@ use Symfony\Component\HttpKernel\Event\PostResponseEvent;
*/
class
SwiftmailerServiceProvider
implements
ServiceProviderInterface
,
EventListenerProviderInterface
{
public
function
register
(
Application
$app
)
public
function
register
(
\Pimple
$app
)
{
$app
[
'swiftmailer.options'
]
=
array
();
...
...
@@ -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
)
{
// To speed things up (by avoiding Swift Mailer initialization), flush
...
...
src/Silex/Provider/TranslationServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\Api\ServiceProviderInterface
;
use
Silex\Translator
;
use
Symfony\Component\Translation\MessageSelector
;
...
...
@@ -25,7 +24,7 @@ use Symfony\Component\Translation\Loader\XliffFileLoader;
*/
class
TranslationServiceProvider
implements
ServiceProviderInterface
{
public
function
register
(
Application
$app
)
public
function
register
(
\Pimple
$app
)
{
$app
[
'translator'
]
=
$app
->
share
(
function
(
$app
)
{
if
(
!
isset
(
$app
[
'locale'
]))
{
...
...
src/Silex/Provider/TwigServiceProvider.php
View file @
2d3a96bb
...
...
@@ -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
;
...
...
@@ -28,7 +27,7 @@ use Symfony\Bridge\Twig\Form\TwigRenderer;
*/
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'
);
...
...
src/Silex/Provider/UrlGeneratorServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\Api\ServiceProviderInterface
;
use
Symfony\Component\Routing\Generator\UrlGenerator
;
...
...
@@ -22,7 +21,7 @@ use Symfony\Component\Routing\Generator\UrlGenerator;
*/
class
UrlGeneratorServiceProvider
implements
ServiceProviderInterface
{
public
function
register
(
Application
$app
)
public
function
register
(
\Pimple
$app
)
{
$app
[
'url_generator'
]
=
$app
->
share
(
function
(
$app
)
{
$app
->
flush
();
...
...
src/Silex/Provider/ValidatorServiceProvider.php
View file @
2d3a96bb
...
...
@@ -11,7 +11,6 @@
namespace
Silex\Provider
;
use
Silex\Application
;
use
Silex\Api\ServiceProviderInterface
;
use
Silex\ConstraintValidatorFactory
;
use
Symfony\Component\Validator\Validator
;
...
...
@@ -26,7 +25,7 @@ use Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader;
*/
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'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment