Commit fb1e41e5 authored by Fabien Potencier's avatar Fabien Potencier

removed deprecated features, BC layers

parent 55bbb1ef
...@@ -26,22 +26,6 @@ please join us on the `mailing list ...@@ -26,22 +26,6 @@ please join us on the `mailing list
Any code you contribute must be licensed under the MIT Any code you contribute must be licensed under the MIT
License. License.
Target branch
=============
Before you create a pull request for Silex, you need to determine which branch
to submit it to. Read this section carefully first.
Silex has two active branches: `1.0` and `master` (`1.1`).
* **1.0**: Bugfixes and documentation fixes go into the 1.0 branch. 1.0 is
periodically merged into master. The 1.0 branch targets versions 2.1, 2.2 and
2.3 of Symfony2.
* **1.1**: All new features go into the 1.1 branch. Changes cannot break
backward compatibility. The 1.1 branch targets the 2.3 version of Symfony2.
Writing Documentation Writing Documentation
===================== =====================
......
...@@ -215,8 +215,7 @@ methods on your application: ``get``, ``post``, ``put``, ``delete``:: ...@@ -215,8 +215,7 @@ methods on your application: ``get``, ``post``, ``put``, ``delete``::
<input type="hidden" id="_method" name="_method" value="PUT" /> <input type="hidden" id="_method" name="_method" value="PUT" />
</form> </form>
If you are using Symfony Components 2.2+, you will need to explicitly You need to explicitly enable this method override::
enable this method override::
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
...@@ -685,19 +684,11 @@ To further customize the response before returning it, check the API doc for ...@@ -685,19 +684,11 @@ To further customize the response before returning it, check the API doc for
->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'pic.jpg') ->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'pic.jpg')
; ;
.. note::
HttpFoundation 2.2 or greater is required for this feature to be available.
Traits Traits
------ ------
Silex comes with PHP traits that define shortcut methods. Silex comes with PHP traits that define shortcut methods.
.. caution::
You need to use PHP 5.4 or later to benefit from this feature.
Almost all built-in service providers have some corresponding PHP traits. To Almost all built-in service providers have some corresponding PHP traits. To
use them, define your own Application class and include the traits you want:: use them, define your own Application class and include the traits you want::
......
...@@ -120,13 +120,12 @@ point: ...@@ -120,13 +120,12 @@ point:
.. _FallbackResource directive: http://www.adayinthelifeof.nl/2012/01/21/apaches-fallbackresource-your-new-htaccess-command/ .. _FallbackResource directive: http://www.adayinthelifeof.nl/2012/01/21/apaches-fallbackresource-your-new-htaccess-command/
PHP 5.4 PHP
------- ---
PHP 5.4 ships with a built-in webserver for development. This server allows PHP ships with a built-in webserver for development. This server allows you to
you to run silex without any configuration. However, in order to serve static run silex without any configuration. However, in order to serve static files,
files, you'll have to make sure your front controller returns false in that you'll have to make sure your front controller returns false in that case::
case::
// web/index.php // web/index.php
......
...@@ -32,20 +32,8 @@ class ExceptionHandler implements EventSubscriberInterface ...@@ -32,20 +32,8 @@ class ExceptionHandler implements EventSubscriberInterface
$this->enabled = true; $this->enabled = true;
} }
/**
* @deprecated since 1.3, to be removed in 2.0
*/
public function disable()
{
$this->enabled = false;
}
public function onSilexError(GetResponseForExceptionEvent $event) public function onSilexError(GetResponseForExceptionEvent $event)
{ {
if (!$this->enabled) {
return;
}
$handler = new DebugExceptionHandler($this->debug); $handler = new DebugExceptionHandler($this->debug);
$event->setResponse($handler->createResponse($event->getException())); $event->setResponse($handler->createResponse($event->getException()));
......
...@@ -30,7 +30,7 @@ class RememberMeServiceProvider implements ServiceProviderInterface, EventListen ...@@ -30,7 +30,7 @@ class RememberMeServiceProvider implements ServiceProviderInterface, EventListen
public function register(Container $app) public function register(Container $app)
{ {
$app['security.remember_me.response_listener'] = function ($app) { $app['security.remember_me.response_listener'] = function ($app) {
if (!isset($app['security'])) { if (!isset($app['security.token_storage'])) {
throw new \LogicException('You must register the SecurityServiceProvider to use the RememberMeServiceProvider'); throw new \LogicException('You must register the SecurityServiceProvider to use the RememberMeServiceProvider');
} }
......
...@@ -82,7 +82,6 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener ...@@ -82,7 +82,6 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
$r = new \ReflectionMethod('Symfony\Component\Security\Http\Firewall\ContextListener', '__construct'); $r = new \ReflectionMethod('Symfony\Component\Security\Http\Firewall\ContextListener', '__construct');
$params = $r->getParameters(); $params = $r->getParameters();
if ('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface' === $params[0]->getClass()->getName()) {
$app['security.authorization_checker'] = function ($app) { $app['security.authorization_checker'] = function ($app) {
return new AuthorizationChecker($app['security.token_storage'], $app['security.authentication_manager'], $app['security.access_manager']); return new AuthorizationChecker($app['security.token_storage'], $app['security.authentication_manager'], $app['security.access_manager']);
}; };
...@@ -91,21 +90,6 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener ...@@ -91,21 +90,6 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
return new TokenStorage(); return new TokenStorage();
}; };
$app['security'] = function ($app) {
// Deprecated, to be removed in 2.0
return new SecurityContext($app['security.token_storage'], $app['security.authorization_checker']);
};
} else {
$app['security.token_storage'] = $app['security.authorization_checker'] = function ($app) {
return $app['security'];
};
$app['security'] = function ($app) {
// Deprecated, to be removed in 2.0
return new SecurityContext($app['security.authentication_manager'], $app['security.access_manager']);
};
}
$app['security.authentication_manager'] = function ($app) { $app['security.authentication_manager'] = function ($app) {
$manager = new AuthenticationProviderManager($app['security.authentication_providers']); $manager = new AuthenticationProviderManager($app['security.authentication_providers']);
$manager->setEventDispatcher($app['dispatcher']); $manager->setEventDispatcher($app['dispatcher']);
......
...@@ -36,12 +36,6 @@ class TranslationServiceProvider implements ServiceProviderInterface, EventListe ...@@ -36,12 +36,6 @@ class TranslationServiceProvider implements ServiceProviderInterface, EventListe
} }
$translator = new Translator($app['locale'], $app['translator.message_selector'], $app['translator.cache_dir'], $app['debug']); $translator = new Translator($app['locale'], $app['translator.message_selector'], $app['translator.cache_dir'], $app['debug']);
// Handle deprecated 'locale_fallback'
if (isset($app['locale_fallback'])) {
$app['locale_fallbacks'] = (array) $app['locale_fallback'];
}
$translator->setFallbackLocales($app['locale_fallbacks']); $translator->setFallbackLocales($app['locale_fallbacks']);
$translator->addLoader('array', new ArrayLoader()); $translator->addLoader('array', new ArrayLoader());
$translator->addLoader('xliff', new XliffFileLoader()); $translator->addLoader('xliff', new XliffFileLoader());
......
...@@ -17,8 +17,6 @@ use Silex\Provider\FormServiceProvider; ...@@ -17,8 +17,6 @@ use Silex\Provider\FormServiceProvider;
* FormTrait test cases. * FormTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class FormTraitTest extends \PHPUnit_Framework_TestCase class FormTraitTest extends \PHPUnit_Framework_TestCase
{ {
......
...@@ -19,8 +19,6 @@ use Monolog\Logger; ...@@ -19,8 +19,6 @@ use Monolog\Logger;
* MonologTrait test cases. * MonologTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class MonologTraitTest extends \PHPUnit_Framework_TestCase class MonologTraitTest extends \PHPUnit_Framework_TestCase
{ {
......
...@@ -20,8 +20,6 @@ use Symfony\Component\HttpFoundation\Request; ...@@ -20,8 +20,6 @@ use Symfony\Component\HttpFoundation\Request;
* SecurityTrait test cases. * SecurityTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class SecurityTraitTest extends \PHPUnit_Framework_TestCase class SecurityTraitTest extends \PHPUnit_Framework_TestCase
{ {
......
...@@ -17,8 +17,6 @@ use Silex\Provider\SwiftmailerServiceProvider; ...@@ -17,8 +17,6 @@ use Silex\Provider\SwiftmailerServiceProvider;
* SwiftmailerTrait test cases. * SwiftmailerTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class SwiftmailerTraitTest extends \PHPUnit_Framework_TestCase class SwiftmailerTraitTest extends \PHPUnit_Framework_TestCase
{ {
......
...@@ -17,8 +17,6 @@ use Silex\Provider\TranslationServiceProvider; ...@@ -17,8 +17,6 @@ use Silex\Provider\TranslationServiceProvider;
* TranslationTrait test cases. * TranslationTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class TranslationTraitTest extends \PHPUnit_Framework_TestCase class TranslationTraitTest extends \PHPUnit_Framework_TestCase
{ {
......
...@@ -19,8 +19,6 @@ use Symfony\Component\HttpFoundation\StreamedResponse; ...@@ -19,8 +19,6 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
* TwigTrait test cases. * TwigTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class TwigTraitTest extends \PHPUnit_Framework_TestCase class TwigTraitTest extends \PHPUnit_Framework_TestCase
{ {
......
...@@ -19,8 +19,6 @@ use Silex\Provider\UrlGeneratorServiceProvider; ...@@ -19,8 +19,6 @@ use Silex\Provider\UrlGeneratorServiceProvider;
* UrlGeneratorTrait test cases. * UrlGeneratorTrait test cases.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @requires PHP 5.4
*/ */
class UrlGeneratorTraitTest extends \PHPUnit_Framework_TestCase class UrlGeneratorTraitTest extends \PHPUnit_Framework_TestCase
{ {
......
...@@ -189,7 +189,7 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase ...@@ -189,7 +189,7 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase
public function testNoResponseExceptionHandler() public function testNoResponseExceptionHandler()
{ {
$app = new Application(); $app = new Application();
$app['exception_handler']->disable(); unset($app['exception_handler']);
$app->match('/foo', function () { $app->match('/foo', function () {
throw new \RuntimeException('foo exception'); throw new \RuntimeException('foo exception');
......
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