Skip to content

Commit 5701cb9

Browse files
committed
minor #1972 replace deprecated code usages, drop support for Symfony < 3.4 (xabbuh)
This PR was squashed before being merged into the 2.4-dev branch (closes #1972). Discussion ---------- replace deprecated code usages, drop support for Symfony < 3.4 Commits ------- f9c3bcd use PHPUnit 6.5 on PHP 7.1 d4e21d2 never rely on service auto-registration 7b206d6 compatibility with symfony/form 4.2+ cea8022 fix risky tests 5526e9c fix lowest supported JMSSerializerBundle release 8e009b7 replace Controller with AbstractController 2764e00 drop support for unmaintained Symfony versions
2 parents ee84444 + f9c3bcd commit 5701cb9

32 files changed

+94
-76
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ matrix:
1818
- php: 5.5
1919
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_DEPRECATIONS_HELPER=weak
2020
- php: 5.6
21-
# Symfony 2 LTS
22-
- php: 7.0
23-
env: SYMFONY_LTS='^2'
2421
# Symfony 3 LTS
2522
- php: 7.0
2623
env: SYMFONY_LTS='^3'
2724
# Symfony 4
2825
- php: 7.1
26+
env: SYMFONY_PHPUNIT_VERSION='6.5'
2927
- php: 7.2
3028
- php: 7.3
3129
# development dependencies

Form/Extension/DisableCSRFExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@ public function getExtendedType()
6767
: 'form' // SF <2.8 BC
6868
;
6969
}
70+
71+
public static function getExtendedTypes()
72+
{
73+
return array(FormType::class);
74+
}
7075
}

Tests/EventListener/BodyListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class BodyListenerTest extends TestCase
3636
* @param string $contentType the request header content type
3737
* @param bool $throwExceptionOnUnsupportedContentType
3838
*
39-
* @dataProvider testOnKernelRequestDataProvider
39+
* @dataProvider onKernelRequestDataProvider
4040
*/
4141
public function testOnKernelRequest($decode, Request $request, $method, $expectedParameters, $contentType = null, $throwExceptionOnUnsupportedContentType = false)
4242
{
@@ -76,7 +76,7 @@ public function testOnKernelRequest($decode, Request $request, $method, $expecte
7676
$this->assertEquals($request->request->all(), $expectedParameters);
7777
}
7878

79-
public static function testOnKernelRequestDataProvider()
79+
public static function onKernelRequestDataProvider()
8080
{
8181
return [
8282
'Empty POST request' => [true, new Request([], [], [], [], [], [], ['foo']), 'POST', ['foo'], 'application/json'],

Tests/Fixtures/Controller/AnnotatedConditionalUsersController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
use FOS\RestBundle\Controller\Annotations\Put;
2323
use FOS\RestBundle\Controller\Annotations\Route;
2424
use FOS\RestBundle\Controller\Annotations\Unlink;
25-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
25+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2626
use FOS\RestBundle\Tests\Fixtures\User;
2727

28-
class AnnotatedConditionalUsersController extends Controller
28+
class AnnotatedConditionalUsersController extends AbstractController
2929
{
3030
/**
3131
* [OPTIONS] /users.

Tests/Fixtures/Controller/AnnotatedNonPluralizedArticleController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
namespace FOS\RestBundle\Tests\Fixtures\Controller;
1313

14+
use FOS\RestBundle\Controller\AbstractFOSRestController;
1415
use FOS\RestBundle\Controller\Annotations as Rest;
15-
use FOS\RestBundle\Controller\FOSRestController;
1616

1717
/**
1818
* @Rest\RouteResource("Article", pluralize=false)
1919
*/
20-
class AnnotatedNonPluralizedArticleController extends FOSRestController
20+
class AnnotatedNonPluralizedArticleController extends AbstractFOSRestController
2121
{
2222
/**
2323
* [GET] /article.

Tests/Fixtures/Controller/AnnotatedPrefixedController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
namespace FOS\RestBundle\Tests\Fixtures\Controller;
1313

1414
use FOS\RestBundle\Controller\Annotations\Prefix;
15-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
15+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1616
use Symfony\Component\HttpFoundation\Request;
1717

1818
/**
1919
* @author Donald Tyler <[email protected]>
2020
* @Prefix("aprefix")
2121
*/
22-
class AnnotatedPrefixedController extends Controller
22+
class AnnotatedPrefixedController extends AbstractController
2323
{
2424
/**
2525
* [GET] /aprefix/something.{_format}.

Tests/Fixtures/Controller/AnnotatedUsersController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
use FOS\RestBundle\Controller\Annotations\Route;
3030
use FOS\RestBundle\Controller\Annotations\Unlink;
3131
use FOS\RestBundle\Controller\Annotations\Unlock;
32-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
32+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
3333

34-
class AnnotatedUsersController extends Controller
34+
class AnnotatedUsersController extends AbstractController
3535
{
3636
/**
3737
* @Options

Tests/Fixtures/Controller/AnnotatedVersionUserController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
use FOS\RestBundle\Controller\Annotations\Version;
1515
use FOS\RestBundle\Controller\Annotations\Get;
16-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
16+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1717

1818
/**
1919
* @Version({"v1", "v3"})
2020
*/
21-
class AnnotatedVersionUserController extends Controller
21+
class AnnotatedVersionUserController extends AbstractController
2222
{
2323
/**
2424
* [GET, HEAD] /users/{slug}/v2.

Tests/Fixtures/Controller/ArticleController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
use FOS\RestBundle\Controller\ControllerTrait;
1515
use FOS\RestBundle\Routing\ClassResourceInterface;
16+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1617
use Symfony\Component\HttpFoundation\Request;
17-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
1818
use Symfony\Component\Validator\ConstraintViolationList;
1919

20-
class ArticleController extends Controller implements ClassResourceInterface
20+
class ArticleController extends AbstractController implements ClassResourceInterface
2121
{
2222
use ControllerTrait;
2323

Tests/Fixtures/Controller/Directory/UserTopicCommentsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace FOS\RestBundle\Tests\Fixtures\Controller\Directory;
1313

14-
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
14+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1515

16-
class UserTopicCommentsController extends Controller
16+
class UserTopicCommentsController extends AbstractController
1717
{
1818
public function getCommentsAction($slug, $title)
1919
{

0 commit comments

Comments
 (0)