Skip to content

Commit 081b100

Browse files
author
Iltar van der Berg
committed
Deprecated Security ClassUtils in favor of Acl ClassUtils
1 parent ad0e914 commit 081b100

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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()

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 <[email protected]>
2325
* @author Johannes Schmitt <[email protected]>
@@ -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)