From 4278fe44773b4b76e1dfa216294349df08204b25 Mon Sep 17 00:00:00 2001 From: Iltar van der Berg Date: Tue, 25 Aug 2015 12:07:24 +0200 Subject: [PATCH] Deprecated Security ClassUtils in favor of Acl ClassUtils --- src/Symfony/Component/Security/CHANGELOG.md | 2 ++ .../Security/Core/Tests/Util/ClassUtilsTest.php | 3 +++ .../Component/Security/Core/Util/ClassUtils.php | 11 +++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Security/CHANGELOG.md b/src/Symfony/Component/Security/CHANGELOG.md index f202692929..0728da9bdb 100644 --- a/src/Symfony/Component/Security/CHANGELOG.md +++ b/src/Symfony/Component/Security/CHANGELOG.md @@ -10,6 +10,8 @@ CHANGELOG `Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface` instead * deprecated `Symfony\Component\Security\Core\Authentication\SimpleFormAuthenticatorInterface`, use `Symfony\Component\Security\Http\Authentication\SimpleFormAuthenticatorInterface` instead + * deprecated `Symfony\Component\Security\Core\Util\ClassUtils`, use + `Symfony\Component\Security\Acl\Util\ClassUtils` instead 2.7.0 ----- diff --git a/src/Symfony/Component/Security/Core/Tests/Util/ClassUtilsTest.php b/src/Symfony/Component/Security/Core/Tests/Util/ClassUtilsTest.php index e8f0143eb7..b04820614a 100644 --- a/src/Symfony/Component/Security/Core/Tests/Util/ClassUtilsTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Util/ClassUtilsTest.php @@ -13,6 +13,9 @@ namespace Symfony\Component\Security\Core\Tests\Util { use Symfony\Component\Security\Core\Util\ClassUtils; + /** + * @group legacy + */ class ClassUtilsTest extends \PHPUnit_Framework_TestCase { public static function dataGetClass() diff --git a/src/Symfony/Component/Security/Core/Util/ClassUtils.php b/src/Symfony/Component/Security/Core/Util/ClassUtils.php index 6c8709668f..06186ef895 100644 --- a/src/Symfony/Component/Security/Core/Util/ClassUtils.php +++ b/src/Symfony/Component/Security/Core/Util/ClassUtils.php @@ -11,13 +11,15 @@ namespace Symfony\Component\Security\Core\Util; -use Doctrine\Common\Util\ClassUtils as DoctrineClassUtils; +use Symfony\Component\Security\Acl\Util\ClassUtils as AclClassUtils; + +@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); /** * Class related functionality for objects that * might or might not be proxy objects at the moment. * - * @see DoctrineClassUtils + * @deprecated ClassUtils is deprecated since version 2.8, to be removed in 3.0. Use Acl ClassUtils instead. * * @author Benjamin Eberlei * @author Johannes Schmitt @@ -54,6 +56,11 @@ class ClassUtils */ public static function getRealClass($object) { + if (class_exists('Symfony\Component\Security\Acl\Util\ClassUtils')) { + return AclClassUtils::getRealClass($object); + } + + // fallback in case security-acl is not installed $class = is_object($object) ? get_class($object) : $object; if (false === $pos = strrpos($class, '\\'.self::MARKER.'\\')) {