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

Commit fe5a113

Browse files
author
Iltar van der Berg
committed
Deprecated Security ClassUtils in favor of Acl ClassUtils
1 parent 2f0fccf commit fe5a113

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ CHANGELOG
1010
`Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface` instead
1111
* deprecated `Symfony\Component\Security\Core\Authentication\SimpleFormAuthenticatorInterface`, use
1212
`Symfony\Component\Security\Http\Authentication\SimpleFormAuthenticatorInterface` instead
13+
* deprecated `Symfony\Component\Security\Core\Util\ClassUtils`, use
14+
`Symfony\Component\Security\Acl\Util\ClassUtils` instead
1315

1416
2.7.0
1517
-----

Core/Tests/Util/ClassUtilsTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
{
1414
use Symfony\Component\Security\Core\Util\ClassUtils;
1515

16+
/**
17+
* @group legacy
18+
*/
1619
class ClassUtilsTest extends \PHPUnit_Framework_TestCase
1720
{
1821
public static function dataGetClass()

Core/Util/ClassUtils.php

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

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

14-
use Doctrine\Common\Util\ClassUtils as DoctrineClassUtils;
14+
use Symfony\Component\Security\Acl\Util\ClassUtils as AclClassUtils;
15+
16+
@trigger_error('The '.__NAMESPACE__.'\ClassUtils class is deprecated since version 2.8, to be removed in 3.0. Use Symfony\Component\Security\Acl\Util\ClassUtils instead.', E_USER_DEPRECATED);
1517

1618
/**
1719
* Class related functionality for objects that
1820
* might or might not be proxy objects at the moment.
1921
*
20-
* @see DoctrineClassUtils
22+
* @deprecated ClassUtils is deprecated since version 2.8, to be removed in 3.0. Use Acl ClassUtils instead.
2123
*
2224
* @author Benjamin Eberlei <kontakt@beberlei.de>
2325
* @author Johannes Schmitt <schmittjoh@gmail.com>
@@ -54,6 +56,11 @@ private function __construct()
5456
*/
5557
public static function getRealClass($object)
5658
{
59+
if (class_exists('Symfony\Component\Security\Acl\Util\ClassUtils')) {
60+
return AclClassUtils::getRealClass($object);
61+
}
62+
63+
// fallback in case security-acl is not installed
5764
$class = is_object($object) ? get_class($object) : $object;
5865

5966
if (false === $pos = strrpos($class, '\\'.self::MARKER.'\\')) {

0 commit comments

Comments
 (0)