Deprecated Security ClassUtils in favor of Acl ClassUtils

This commit is contained in:
Iltar van der Berg 2015-08-25 12:07:24 +02:00
parent bab9ac542c
commit 4278fe4477
3 changed files with 14 additions and 2 deletions

View File

@ -10,6 +10,8 @@ CHANGELOG
`Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface` instead `Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface` instead
* deprecated `Symfony\Component\Security\Core\Authentication\SimpleFormAuthenticatorInterface`, use * deprecated `Symfony\Component\Security\Core\Authentication\SimpleFormAuthenticatorInterface`, use
`Symfony\Component\Security\Http\Authentication\SimpleFormAuthenticatorInterface` instead `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 2.7.0
----- -----

View File

@ -13,6 +13,9 @@ namespace Symfony\Component\Security\Core\Tests\Util
{ {
use Symfony\Component\Security\Core\Util\ClassUtils; use Symfony\Component\Security\Core\Util\ClassUtils;
/**
* @group legacy
*/
class ClassUtilsTest extends \PHPUnit_Framework_TestCase class ClassUtilsTest extends \PHPUnit_Framework_TestCase
{ {
public static function dataGetClass() public static function dataGetClass()

View File

@ -11,13 +11,15 @@
namespace Symfony\Component\Security\Core\Util; 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 * Class related functionality for objects that
* might or might not be proxy objects at the moment. * 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 <kontakt@beberlei.de> * @author Benjamin Eberlei <kontakt@beberlei.de>
* @author Johannes Schmitt <schmittjoh@gmail.com> * @author Johannes Schmitt <schmittjoh@gmail.com>
@ -54,6 +56,11 @@ class ClassUtils
*/ */
public static function getRealClass($object) 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; $class = is_object($object) ? get_class($object) : $object;
if (false === $pos = strrpos($class, '\\'.self::MARKER.'\\')) { if (false === $pos = strrpos($class, '\\'.self::MARKER.'\\')) {