vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/Role.php line 21

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Security\Core\Role;
  11. /**
  12.  * Role is a simple implementation representing a role identified by a string.
  13.  *
  14.  * @author Fabien Potencier <fabien@symfony.com>
  15.  *
  16.  * @deprecated since Symfony 4.3, to be removed in 5.0. Use strings as roles instead.
  17.  */
  18. class Role
  19. {
  20.     private $role;
  21.     public function __construct(string $role)
  22.     {
  23.         if (\func_num_args() < || func_get_arg(1)) {
  24.             @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3 and will be removed in 5.0. Use strings as roles instead.'__CLASS__), \E_USER_DEPRECATED);
  25.         }
  26.         $this->role $role;
  27.     }
  28.     /**
  29.      * Returns a string representation of the role.
  30.      *
  31.      * @return string
  32.      */
  33.     public function getRole()
  34.     {
  35.         return $this->role;
  36.     }
  37.     public function __toString(): string
  38.     {
  39.         return $this->role;
  40.     }
  41. }