Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 7c3ed12

Browse files
author
Hugo Hamon
committed
Adds deprecation notices for structures to be removed in 3.0.
1 parent 79471f9 commit 7c3ed12

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Core/SecurityContext.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Security\Core;
1313

14+
trigger_error('The '.__NAMESPACE__.'\SecurityContext class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface and Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface implementation to check for authentication and authorization.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
1517
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
1618
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@@ -74,6 +76,8 @@ public function __construct($tokenStorage, $authorizationChecker, $alwaysAuthent
7476
*/
7577
public function getToken()
7678
{
79+
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage::getToken() method instead.', E_USER_DEPRECATED);
80+
7781
return $this->tokenStorage->getToken();
7882
}
7983

@@ -82,6 +86,8 @@ public function getToken()
8286
*/
8387
public function setToken(TokenInterface $token = null)
8488
{
89+
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage::setToken() method instead.', E_USER_DEPRECATED);
90+
8591
return $this->tokenStorage->setToken($token);
8692
}
8793

@@ -90,6 +96,8 @@ public function setToken(TokenInterface $token = null)
9096
*/
9197
public function isGranted($attributes, $object = null)
9298
{
99+
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::isGranted() method instead.', E_USER_DEPRECATED);
100+
93101
return $this->authorizationChecker->isGranted($attributes, $object);
94102
}
95103
}

Core/SecurityContextInterface.php

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

1212
namespace Symfony\Component\Security\Core;
1313

14+
trigger_error('The '.__NAMESPACE__.'\SecurityContextInterface interface is deprecated since version 2.6 and will be removed in 3.0. Use both Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface and Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface interfaces instead.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1517
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
1618

Tests/Core/LegacySecurityContextInterfaceTest.php

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

1212
namespace Symfony\Component\Security\Tests\Core;
1313

14+
trigger_error('The '.__NAMESPACE__.'\SecurityContextInterfaceTest class is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
15+
1416
use Symfony\Component\Security\Core\SecurityContextInterface;
1517
use Symfony\Component\Security\Core\Security;
1618

0 commit comments

Comments
 (0)