Skip to content

Commit b20e764

Browse files
committed
Removing the Controller::getUser() deprecation
1 parent f03522d commit b20e764

File tree

3 files changed

+0
-17
lines changed

3 files changed

+0
-17
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ CHANGELOG
1111
* Removed `symfony/asset` from the list of required dependencies in `composer.json`
1212
* The `Resources/public/images/*` files have been removed.
1313
* The `Resources/public/css/*.css` files have been removed (they are now inlined in TwigBundle).
14-
* The `Controller::getUser()` method has been deprecated and will be removed in
15-
Symfony 4.0; typehint the security user object in the action instead.
1614
* Added possibility to prioritize form type extensions with `'priority'` attribute on tags `form.type_extension`
1715

1816
3.1.0

Controller/Controller.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2323
use Symfony\Component\HttpKernel\HttpKernelInterface;
2424
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
25-
use Symfony\Component\Security\Core\User\UserInterface;
2625
use Symfony\Component\Security\Csrf\CsrfToken;
2726
use Symfony\Component\Form\Extension\Core\Type\FormType;
2827
use Symfony\Component\Form\Form;
@@ -367,16 +366,12 @@ protected function getDoctrine()
367366
*
368367
* @return mixed
369368
*
370-
* @deprecated as of 3.2 and will be removed in 4.0. You can typehint your method argument with Symfony\Component\Security\Core\User\UserInterface instead.
371-
*
372369
* @throws \LogicException If SecurityBundle is not available
373370
*
374371
* @see TokenInterface::getUser()
375372
*/
376373
protected function getUser()
377374
{
378-
@trigger_error(sprintf('%s() is deprecated as of 3.2 and will be removed in 4.0. You can typehint your method argument with %s instead.', __METHOD__, UserInterface::class), E_USER_DEPRECATED);
379-
380375
if (!$this->container->has('security.token_storage')) {
381376
throw new \LogicException('The SecurityBundle is not registered in your application.');
382377
}

Tests/Controller/ControllerTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ public function testForward()
5656
$this->assertEquals('xml--fr', $response->getContent());
5757
}
5858

59-
/**
60-
* @group legacy
61-
*/
6259
public function testGetUser()
6360
{
6461
$user = new User('user', 'pass');
@@ -70,9 +67,6 @@ public function testGetUser()
7067
$this->assertSame($controller->getUser(), $user);
7168
}
7269

73-
/**
74-
* @group legacy
75-
*/
7670
public function testGetUserAnonymousUserConvertedToNull()
7771
{
7872
$token = new AnonymousToken('default', 'anon.');
@@ -83,9 +77,6 @@ public function testGetUserAnonymousUserConvertedToNull()
8377
$this->assertNull($controller->getUser());
8478
}
8579

86-
/**
87-
* @group legacy
88-
*/
8980
public function testGetUserWithEmptyTokenStorage()
9081
{
9182
$controller = new TestController();
@@ -95,7 +86,6 @@ public function testGetUserWithEmptyTokenStorage()
9586
}
9687

9788
/**
98-
* @group legacy
9989
* @expectedException \LogicException
10090
* @expectedExceptionMessage The SecurityBundle is not registered in your application.
10191
*/

0 commit comments

Comments
 (0)