Commit 155cb751 authored by Fabien Potencier's avatar Fabien Potencier

removed support for Symfony 2.7

parent 27764071
......@@ -9,9 +9,8 @@ cache:
before_script:
# symfony/*
- sh -c "if [ '$TWIG_VERSION' != '2.0' ]; then sed -i 's/~1.8|~2.0/~1.8/g' composer.json; composer update; fi"
- sh -c "if [ '$SYMFONY_DEPS_VERSION' = '3.0' ]; then sed -i 's/~2\.7|3\.0\.\*/3.0.*@dev/g' composer.json; composer update; fi"
- sh -c "if [ '$SYMFONY_DEPS_VERSION' = '2.8' ]; then sed -i 's/~2\.7|3\.0\.\*/2.8.*@dev/g' composer.json; composer update; fi"
- sh -c "if [ '$SYMFONY_DEPS_VERSION' = '' ]; then sed -i 's/~2\.7|3\.0\.\*/2.7.*@dev/g' composer.json; composer update; fi"
- sh -c "if [ '$SYMFONY_DEPS_VERSION' = '3.0' ]; then sed -i 's/~2\.8|3\.0\.\*/3.0.*@dev/g' composer.json; composer update; fi"
- sh -c "if [ '$SYMFONY_DEPS_VERSION' = '' ]; then sed -i 's/~2\.8|3\.0\.\*/2.8.*@dev/g' composer.json; composer update; fi"
- composer install
script: phpunit
......@@ -21,8 +20,6 @@ matrix:
- php: 5.5
- php: 5.6
env: TWIG_VERSION=2.0
- php: 5.6
env: SYMFONY_DEPS_VERSION=2.8
- php: 5.6
env: SYMFONY_DEPS_VERSION=3.0
- php: 7.0
......
......@@ -17,31 +17,31 @@
"require": {
"php": ">=5.5.9",
"pimple/pimple": "~3.0",
"symfony/event-dispatcher": "~2.7|3.0.*",
"symfony/http-foundation": "~2.7|3.0.*",
"symfony/http-kernel": "~2.7|3.0.*",
"symfony/routing": "~2.7|3.0.*"
"symfony/event-dispatcher": "~2.8|3.0.*",
"symfony/http-foundation": "~2.8|3.0.*",
"symfony/http-kernel": "~2.8|3.0.*",
"symfony/routing": "~2.8|3.0.*"
},
"require-dev": {
"symfony/asset": "~2.7|3.0.*",
"symfony/security": "~2.7|3.0.*",
"symfony/config": "~2.7|3.0.*",
"symfony/locale": "~2.7|3.0.*",
"symfony/form": "~2.7|3.0.*",
"symfony/browser-kit": "~2.7|3.0.*",
"symfony/css-selector": "~2.7|3.0.*",
"symfony/debug": "~2.7|3.0.*",
"symfony/dom-crawler": "~2.7|3.0.*",
"symfony/finder": "~2.7|3.0.*",
"symfony/monolog-bridge": "~2.7|3.0.*",
"symfony/doctrine-bridge": "~2.7|3.0.*",
"symfony/options-resolver": "~2.7|3.0.*",
"symfony/process": "~2.7|3.0.*",
"symfony/serializer": "~2.7|3.0.*",
"symfony/translation": "~2.7|3.0.*",
"symfony/twig-bridge": "~2.7|3.0.*",
"symfony/validator": "~2.7|3.0.*",
"symfony/var-dumper": "~2.7|3.0.*",
"symfony/asset": "~2.8|3.0.*",
"symfony/security": "~2.8|3.0.*",
"symfony/config": "~2.8|3.0.*",
"symfony/locale": "~2.8|3.0.*",
"symfony/form": "~2.8|3.0.*",
"symfony/browser-kit": "~2.8|3.0.*",
"symfony/css-selector": "~2.8|3.0.*",
"symfony/debug": "~2.8|3.0.*",
"symfony/dom-crawler": "~2.8|3.0.*",
"symfony/finder": "~2.8|3.0.*",
"symfony/monolog-bridge": "~2.8|3.0.*",
"symfony/doctrine-bridge": "~2.8|3.0.*",
"symfony/options-resolver": "~2.8|3.0.*",
"symfony/process": "~2.8|3.0.*",
"symfony/serializer": "~2.8|3.0.*",
"symfony/translation": "~2.8|3.0.*",
"symfony/twig-bridge": "~2.8|3.0.*",
"symfony/validator": "~2.8|3.0.*",
"symfony/var-dumper": "~2.8|3.0.*",
"twig/twig": "~1.8|~2.0",
"doctrine/dbal": "~2.2",
"swiftmailer/swiftmailer": "~5",
......
......@@ -9,7 +9,7 @@ Changelog
* [BC BREAK] CSRF has been moved to a standalone provider (``form.secret`` is not available anymore)
* added support for the Symfony HttpFoundation Twig bridge extension
* added support for the Symfony Asset Component
* bumped minimum version of Symfony to 2.7
* bumped minimum version of Symfony to 2.8
* bumped minimum version of PHP to 5.5.0
* Updated Pimple to 3.0
* Updated session listeners to extends HttpKernel ones
......
......@@ -645,9 +645,9 @@ Symfony `cookbook`_.
.. note::
Since Symfony 2.8, the Guard component simplify the creation of custom
authentication providers.
:doc:`How to Create a Custom Authentication System with Guard <cookbook/guard_authentication>`
The Guard component simplifies the creation of custom authentication
providers. :doc:`How to Create a Custom Authentication System with Guard
<cookbook/guard_authentication>`
Stateless Authentication
~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -32,8 +32,7 @@ trait FormTrait
public function form($data = null, array $options = array(), $type = null)
{
if (null === $type) {
// BC with Symfony < 2.8
$type = class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FormType' : 'form';
$type = 'Symfony\Component\Form\Extension\Core\Type\FormType';
}
return $this['form.factory']->createBuilder($type, $data, $options);
......
......@@ -36,17 +36,12 @@ class ExceptionHandler implements EventSubscriberInterface
{
$handler = new DebugExceptionHandler($this->debug);
if (method_exists($handler, 'getHtml')) {
$exception = $event->getException();
if (!$exception instanceof FlattenException) {
$exception = FlattenException::create($exception);
}
$response = Response::create($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset(ini_get('default_charset'));
} else {
// BC with Symfony < 2.8
$response = $handler->createResponse($event->getException());
}
$event->setResponse($response);
}
......
......@@ -33,11 +33,7 @@ class HttpFragmentServiceProvider implements ServiceProviderInterface, EventList
public function register(Container $app)
{
$app['fragment.handler'] = function ($app) {
if (Kernel::VERSION_ID >= 20800) {
return new FragmentHandler($app['request_stack'], $app['fragment.renderers'], $app['debug']);
}
return new FragmentHandler($app['fragment.renderers'], $app['debug'], $app['request_stack']);
};
$app['fragment.renderer.inline'] = function ($app) {
......
......@@ -21,7 +21,6 @@ use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\HttpKernel\EventListener\RouterListener;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
......@@ -76,11 +75,7 @@ class RoutingServiceProvider implements ServiceProviderInterface, EventListenerP
return $app['request_matcher'];
});
if (Kernel::VERSION_ID >= 20800) {
return new RouterListener($urlMatcher, $app['request_stack'], $app['request_context'], $app['logger']);
}
return new RouterListener($urlMatcher, $app['request_context'], $app['logger'], $app['request_stack']);
};
}
......
......@@ -21,7 +21,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RequestMatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Component\Security\Core\User\UserChecker;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
......@@ -374,19 +373,14 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
};
$app['security.last_error'] = $app->protect(function (Request $request) {
if (class_exists('Symfony\Component\Security\Core\Security')) {
$error = Security::AUTHENTICATION_ERROR;
} else {
$error = SecurityContextInterface::AUTHENTICATION_ERROR;
}
if ($request->attributes->has($error)) {
return $request->attributes->get($error)->getMessage();
if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) {
return $request->attributes->get(Security::AUTHENTICATION_ERROR)->getMessage();
}
$session = $request->getSession();
if ($session && $session->has($error)) {
$message = $session->get($error)->getMessage();
$session->remove($error);
if ($session && $session->has(Security::AUTHENTICATION_ERROR)) {
$message = $session->get(Security::AUTHENTICATION_ERROR)->getMessage();
$session->remove(Security::AUTHENTICATION_ERROR);
return $message;
}
......
......@@ -46,8 +46,8 @@ class FormServiceProviderTest extends \PHPUnit_Framework_TestCase
return $extensions;
});
$form = $app['form.factory']->createBuilder(class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FormType' : 'form', array())
->add('dummy', class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Silex\Tests\Provider\DummyFormType' : 'dummy')
$form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array())
->add('dummy', 'Silex\Tests\Provider\DummyFormType')
->getForm();
$this->assertInstanceOf('Symfony\Component\Form\Form', $form);
......@@ -65,8 +65,8 @@ class FormServiceProviderTest extends \PHPUnit_Framework_TestCase
return $extensions;
});
$form = $app['form.factory']->createBuilder(class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FormType' : 'form', array())
->add('file', class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FileType' : 'file', array('image_path' => 'webPath'))
$form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array())
->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType', array('image_path' => 'webPath'))
->getForm();
$this->assertInstanceOf('Symfony\Component\Form\Form', $form);
......@@ -106,7 +106,7 @@ class FormServiceProviderTest extends \PHPUnit_Framework_TestCase
return $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface');
};
$form = $app['form.factory']->createBuilder(class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FormType' : 'form', array())
$form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array())
->getForm();
$form->handleRequest($req = Request::create('/', 'POST', array('form' => array(
......@@ -153,27 +153,14 @@ class FormServiceProviderTest extends \PHPUnit_Framework_TestCase
$app->register(new CsrfServiceProvider());
$app['session.test'] = true;
$form = $app['form.factory']->createBuilder(class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FormType' : 'form', array())->getForm();
$form = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array())->getForm();
$this->assertTrue(isset($form->createView()['_token']));
}
}
if (class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType')) {
class DummyFormType extends AbstractType
{
}
} else {
class DummyFormType extends AbstractType
{
/**
* @return string The name of this type
*/
public function getName()
{
return 'dummy';
}
}
class DummyFormType extends AbstractType
{
}
if (method_exists('Symfony\Component\Form\AbstractType', 'configureOptions')) {
......@@ -181,7 +168,7 @@ if (method_exists('Symfony\Component\Form\AbstractType', 'configureOptions')) {
{
public function getExtendedType()
{
return class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FileType' : 'file';
return 'Symfony\Component\Form\Extension\Core\Type\FileType';
}
public function configureOptions(OptionsResolver $resolver)
......@@ -194,7 +181,7 @@ if (method_exists('Symfony\Component\Form\AbstractType', 'configureOptions')) {
{
public function getExtendedType()
{
return class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FileType' : 'file';
return 'Symfony\Component\Form\Extension\Core\Type\FileType';
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
......
......@@ -122,11 +122,6 @@ class SecurityServiceProviderTest extends WebTestCase
public function testGuardAuthentication()
{
if (!class_exists('Symfony\\Component\\Security\\Guard\\AbstractGuardAuthenticator')) {
$this->markTestSkipped(
'The guard component require Symfony 2.8+'
);
}
$app = $this->createApplication('guard');
$client = new Client($app);
......
......@@ -71,10 +71,6 @@ class ValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase
*/
public function testConstraintValidatorFactoryWithExpression($app)
{
if (!class_exists('Symfony\Component\Validator\Constraints\Expression')) {
$this->markTestSkipped('Expression are not supported by this version of Symfony');
}
$constraint = new Assert\Expression('true');
$validator = $app['validator.validator_factory']->getInstance($constraint);
$this->assertInstanceOf('Symfony\Component\Validator\Constraints\ExpressionValidator', $validator);
......@@ -101,12 +97,12 @@ class ValidatorServiceProviderTest extends \PHPUnit_Framework_TestCase
),
));
$builder = $app['form.factory']->createBuilder(class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\FormType' : 'form', array(), array(
$builder = $app['form.factory']->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array(), array(
'constraints' => $constraints,
));
$form = $builder
->add('email', class_exists('Symfony\Component\Form\Extension\Core\Type\RangeType') ? 'Symfony\Component\Form\Extension\Core\Type\EmailType' : 'email', array('label' => 'Email'))
->add('email', 'Symfony\Component\Form\Extension\Core\Type\EmailType', array('label' => 'Email'))
->getForm()
;
......
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