From 072743f6e0127209e52f0e524429bc87d4467208 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 1 Mar 2021 15:30:34 +0100 Subject: [PATCH 01/13] opened 4.0-dev --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 570486c..0c6f74f 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "4.0-dev" } }, "config": { From 9a9d9fe934bd0d4871debebc6dfe60cee74edb7b Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 30 Oct 2025 23:51:04 +0100 Subject: [PATCH 02/13] requires PHP 8.3 --- .github/workflows/static-analysis.yml | 2 +- .github/workflows/tests.yml | 6 +++--- composer.json | 2 +- readme.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index b5b0dff..1d8d064 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v6 - uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: 8.3 coverage: none - run: composer install --no-progress --prefer-dist diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5ee52c1..686f085 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['8.1', '8.2', '8.3', '8.4', '8.5'] + php: ['8.3', '8.4', '8.5'] fail-fast: false @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v6 - uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.3 coverage: none - run: composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable @@ -50,7 +50,7 @@ jobs: - uses: actions/checkout@v6 - uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.3 coverage: none - run: composer install --no-progress --prefer-dist diff --git a/composer.json b/composer.json index 0c6f74f..169ee8a 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": "8.1 - 8.5", + "php": "8.3 - 8.5", "nette/utils": "^4.0" }, "require-dev": { diff --git a/readme.md b/readme.md index a9e93b8..9853eab 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ Authentication & Authorization library for Nette. Documentation can be found on the [website](https://doc.nette.org/access-control). -It requires PHP version 8.1 and supports PHP up to 8.5. +It requires PHP version 8.3 and supports PHP up to 8.5. [Support Me](https://github.com/sponsors/dg) From 6c22067606cb6b5e152aa295d92bfcbf7427976c Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 11 Dec 2023 13:59:38 +0100 Subject: [PATCH 03/13] uses nette/http 4 --- composer.json | 4 ++-- src/Bridges/SecurityHttp/CookieStorage.php | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 169ee8a..84842ec 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "require-dev": { "nette/di": "^3.1", - "nette/http": "^3.2", + "nette/http": "^4.0", "nette/tester": "^2.6", "tracy/tracy": "^2.9", "phpstan/phpstan": "^2.1@stable", @@ -30,7 +30,7 @@ }, "conflict": { "nette/di": "<3.0-stable", - "nette/http": "<3.1.3" + "nette/http": "<4" }, "autoload": { "classmap": ["src/"], diff --git a/src/Bridges/SecurityHttp/CookieStorage.php b/src/Bridges/SecurityHttp/CookieStorage.php index ab9a2d1..03b5a2e 100644 --- a/src/Bridges/SecurityHttp/CookieStorage.php +++ b/src/Bridges/SecurityHttp/CookieStorage.php @@ -45,11 +45,8 @@ public function saveAuthentication(IIdentity $identity): void $this->cookieName, $uid, $this->cookieExpiration, - null, - $this->cookieDomain, - null, - true, - $this->cookieSameSite, + domain: $this->cookieDomain, + sameSite: $this->cookieSameSite, ); } @@ -59,8 +56,7 @@ public function clearAuthentication(bool $clearIdentity): void $this->uid = ''; $this->response->deleteCookie( $this->cookieName, - null, - $this->cookieDomain, + domain: $this->cookieDomain, ); } From 1ab902d43da5481506e4a4c7943add5ab6d5a956 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 23 Dec 2025 22:50:45 +0100 Subject: [PATCH 04/13] used PHP 8.2 features --- src/Security/Identity.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Security/Identity.php b/src/Security/Identity.php index 56cc132..cfc5dbb 100644 --- a/src/Security/Identity.php +++ b/src/Security/Identity.php @@ -35,9 +35,7 @@ public function __construct(string|int $id, string|array|null $roles = null, ?it { $this->setId($id); $this->setRoles((array) $roles); - $this->data = $data instanceof \Traversable - ? iterator_to_array($data) - : (array) $data; + $this->data = iterator_to_array($data ?? []); } From 62e4db135b36883c944105cbe09416505b2ab485 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 20 Sep 2021 18:39:13 +0200 Subject: [PATCH 05/13] removed deprecated IAuthenticator (BC break) --- src/Bridges/SecurityDI/SecurityExtension.php | 2 +- src/Security/Authenticator.php | 2 +- src/Security/IAuthenticator.php | 35 -------------------- src/Security/User.php | 14 ++++---- 4 files changed, 8 insertions(+), 45 deletions(-) delete mode 100644 src/Security/IAuthenticator.php diff --git a/src/Bridges/SecurityDI/SecurityExtension.php b/src/Bridges/SecurityDI/SecurityExtension.php index 3719288..8cbcebd 100644 --- a/src/Bridges/SecurityDI/SecurityExtension.php +++ b/src/Bridges/SecurityDI/SecurityExtension.php @@ -112,7 +112,7 @@ public function loadConfiguration(): void } $builder->addDefinition($this->prefix('authenticator')) - ->setType(Nette\Security\IAuthenticator::class) + ->setType(Nette\Security\Authenticator::class) ->setFactory(Nette\Security\SimpleAuthenticator::class, [$usersList, $usersRoles, $usersData]); if ($this->name === 'security') { diff --git a/src/Security/Authenticator.php b/src/Security/Authenticator.php index 2b47c70..42c0cab 100644 --- a/src/Security/Authenticator.php +++ b/src/Security/Authenticator.php @@ -11,7 +11,7 @@ /** * Performs authentication. */ -interface Authenticator extends IAuthenticator +interface Authenticator { /** Exception error code */ public const diff --git a/src/Security/IAuthenticator.php b/src/Security/IAuthenticator.php deleted file mode 100644 index 443f37b..0000000 --- a/src/Security/IAuthenticator.php +++ /dev/null @@ -1,35 +0,0 @@ - $roles * @property-read ?int $logoutReason - * @property IAuthenticator $authenticator + * @property Authenticator $authenticator * @property Authorizator $authorizator */ class User @@ -68,7 +68,7 @@ class User public function __construct( private readonly UserStorage $storage, - private ?IAuthenticator $authenticator = null, + private ?Authenticator $authenticator = null, private ?Authorizator $authorizator = null, ) { } @@ -99,9 +99,7 @@ public function login( $this->identity = $username; } else { $authenticator = $this->getAuthenticator(); - $this->identity = $authenticator instanceof Authenticator - ? $authenticator->authenticate(...func_get_args()) - : $authenticator->authenticate(func_get_args()); + $this->identity = $authenticator->authenticate(...func_get_args()); } $id = $this->authenticator instanceof IdentityHandler @@ -214,7 +212,7 @@ final public function refreshStorage(): void /** * Sets authentication handler. */ - public function setAuthenticator(IAuthenticator $handler): static + public function setAuthenticator(Authenticator $handler): static { $this->authenticator = $handler; $this->guestIdentityResolved = false; @@ -225,7 +223,7 @@ public function setAuthenticator(IAuthenticator $handler): static /** * Returns authentication handler. */ - final public function getAuthenticator(): IAuthenticator + final public function getAuthenticator(): Authenticator { if (!$this->authenticator) { throw new Nette\InvalidStateException('Authenticator has not been set.'); @@ -238,7 +236,7 @@ final public function getAuthenticator(): IAuthenticator /** * Returns authentication handler, or null if none is set. */ - final public function getAuthenticatorIfExists(): ?IAuthenticator + final public function getAuthenticatorIfExists(): ?Authenticator { return $this->authenticator; } From 86e80b04863c0e29e7ebc65e2510071bba417333 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 12 Dec 2021 18:12:59 +0100 Subject: [PATCH 06/13] IIdentity: added return typehint (BC break) --- src/Security/IIdentity.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Security/IIdentity.php b/src/Security/IIdentity.php index 774a8fa..1b820f9 100644 --- a/src/Security/IIdentity.php +++ b/src/Security/IIdentity.php @@ -16,9 +16,8 @@ interface IIdentity { /** * Returns the ID of user. - * @return string|int */ - function getId(); + function getId(): string|int; /** * Returns a list of roles that the user is a member of. From c9396e2c61200ca5ef860d18d91ad38a9d90234c Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 15 Jun 2026 07:42:52 +0200 Subject: [PATCH 07/13] Identity -> SimpleIdentity Identity class must exist as an alias in order to read it from session --- src/Security/Identity.php | 125 -------------------------------- src/Security/SimpleIdentity.php | 111 +++++++++++++++++++++++++++- src/compatibility-intf.php | 35 +++++++++ src/compatibility.php | 26 +------ tests/Security/Identity.phpt | 23 ------ 5 files changed, 149 insertions(+), 171 deletions(-) delete mode 100644 src/Security/Identity.php create mode 100644 src/compatibility-intf.php delete mode 100644 tests/Security/Identity.phpt diff --git a/src/Security/Identity.php b/src/Security/Identity.php deleted file mode 100644 index cfc5dbb..0000000 --- a/src/Security/Identity.php +++ /dev/null @@ -1,125 +0,0 @@ - $roles - * @property array $data - */ -class Identity implements IIdentity -{ - private string|int $id; - - /** @var list */ - private array $roles; - - /** @var array */ - private array $data; - - - /** - * @param string|list|null $roles - * @param ?iterable $data - */ - public function __construct(string|int $id, string|array|null $roles = null, ?iterable $data = null) - { - $this->setId($id); - $this->setRoles((array) $roles); - $this->data = iterator_to_array($data ?? []); - } - - - /** - * Sets the ID of user. - */ - public function setId(string|int $id): static - { - $this->id = is_string($id) && ctype_digit($id) && (string) ($tmp = (int) $id) === $id ? $tmp : $id; - return $this; - } - - - /** - * Returns the ID of user. - */ - public function getId(): string|int - { - return $this->id; - } - - - /** - * Sets a list of roles that the user is a member of. - * @param list $roles - */ - public function setRoles(array $roles): static - { - $this->roles = $roles; - return $this; - } - - - /** - * Returns a list of roles that the user is a member of. - * @return list - */ - public function getRoles(): array - { - return $this->roles; - } - - - /** - * Returns user data. - * @return array - */ - public function getData(): array - { - return $this->data; - } - - - /** - * Sets user data value. - */ - public function __set(string $key, mixed $value): void - { - match ($key) { - 'id' => $this->setId($value), - 'roles' => $this->setRoles($value), - 'data' => $this->data = $value, - default => $this->data[$key] = $value, - }; - } - - - /** - * Returns user data value. - */ - public function &__get(string $key): mixed - { - if (in_array($key, ['id', 'roles', 'data'], strict: true)) { - $res = $this->{'get' . ucfirst($key)}(); - return $res; - - } else { - return $this->data[$key]; - } - } - - - public function __isset(string $key): bool - { - return isset($this->data[$key]) || in_array($key, ['id', 'roles', 'data'], strict: true); - } -} diff --git a/src/Security/SimpleIdentity.php b/src/Security/SimpleIdentity.php index c987f6f..b831a28 100644 --- a/src/Security/SimpleIdentity.php +++ b/src/Security/SimpleIdentity.php @@ -7,10 +7,119 @@ namespace Nette\Security; +use function ctype_digit, in_array, is_string, iterator_to_array; + /** * Default implementation of IIdentity. + * @property string|int $id + * @property list $roles + * @property array $data */ -class SimpleIdentity extends Identity +class SimpleIdentity implements IIdentity { + private string|int $id; + + /** @var list */ + private array $roles; + + /** @var array */ + private array $data; + + + /** + * @param string|list|null $roles + * @param ?iterable $data + */ + public function __construct(string|int $id, string|array|null $roles = null, ?iterable $data = null) + { + $this->setId($id); + $this->setRoles((array) $roles); + $this->data = iterator_to_array($data ?? []); + } + + + /** + * Sets the ID of user. + */ + public function setId(string|int $id): static + { + $this->id = is_string($id) && ctype_digit($id) && (string) ($tmp = (int) $id) === $id ? $tmp : $id; + return $this; + } + + + /** + * Returns the ID of user. + */ + public function getId(): string|int + { + return $this->id; + } + + + /** + * Sets a list of roles that the user is a member of. + * @param list $roles + */ + public function setRoles(array $roles): static + { + $this->roles = $roles; + return $this; + } + + + /** + * Returns a list of roles that the user is a member of. + * @return list + */ + public function getRoles(): array + { + return $this->roles; + } + + + /** + * Returns user data. + * @return array + */ + public function getData(): array + { + return $this->data; + } + + + /** + * Sets user data value. + */ + public function __set(string $key, mixed $value): void + { + match ($key) { + 'id' => $this->setId($value), + 'roles' => $this->setRoles($value), + 'data' => $this->data = $value, + default => $this->data[$key] = $value, + }; + } + + + /** + * Returns user data value. + */ + public function &__get(string $key): mixed + { + if (in_array($key, ['id', 'roles', 'data'], strict: true)) { + $res = $this->{'get' . ucfirst($key)}(); + return $res; + + } else { + return $this->data[$key]; + } + } + + + public function __isset(string $key): bool + { + return isset($this->data[$key]) || in_array($key, ['id', 'roles', 'data'], strict: true); + } } diff --git a/src/compatibility-intf.php b/src/compatibility-intf.php new file mode 100644 index 0000000..fc11a81 --- /dev/null +++ b/src/compatibility-intf.php @@ -0,0 +1,35 @@ + 'John']); - Assert::same(12, $id->id); - Assert::same(['admin'], $id->roles); - Assert::same('John', $id->name); - - // numeric string id is coerced to int, oversized stays string - Assert::same(12, (new Identity('12'))->getId()); - Assert::same('12345678901234567890', (new Identity('12345678901234567890'))->getId()); -}); From effcf33a14385fccbe1452175b4ee275a6713fcd Mon Sep 17 00:00:00 2001 From: David Grudl Date: Mon, 20 Sep 2021 18:29:35 +0200 Subject: [PATCH 08/13] SimpleIdentity: uses __serialize & __unserialize --- src/Security/SimpleIdentity.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Security/SimpleIdentity.php b/src/Security/SimpleIdentity.php index b831a28..ac749cc 100644 --- a/src/Security/SimpleIdentity.php +++ b/src/Security/SimpleIdentity.php @@ -122,4 +122,22 @@ public function __isset(string $key): bool { return isset($this->data[$key]) || in_array($key, ['id', 'roles', 'data'], strict: true); } + + + public function __serialize(): array + { + return [ + 'id' => $this->id, + 'roles' => $this->roles, + 'data' => $this->data, + ]; + } + + + public function __unserialize(array $data): void + { + $this->id = $data['id'] ?? $data["\00Nette\\Security\\Identity\00id"] ?? 0; + $this->roles = $data['roles'] ?? $data["\00Nette\\Security\\Identity\00roles"] ?? []; + $this->data = $data['data'] ?? $data["\00Nette\\Security\\Identity\00data"] ?? []; + } } From a2781994044aecd7a79903b0f64f4991dd9fed6a Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 12 Jul 2026 21:15:28 +0200 Subject: [PATCH 09/13] SimpleIdentity: reading an undeclared property throws (BC break) Until now __get() returned null for an unknown key and, because it returns by reference, silently created that key in the data (and thus in the storage). It now throws MemberAccessException, like any other Nette object. This also ends the by-ref write pattern $identity->cart[] = $item on a key that has not been set yet. --- src/Security/SimpleIdentity.php | 8 ++++++-- tests/Security/SimpleIdentity.phpt | 13 +++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Security/SimpleIdentity.php b/src/Security/SimpleIdentity.php index ac749cc..ef61208 100644 --- a/src/Security/SimpleIdentity.php +++ b/src/Security/SimpleIdentity.php @@ -7,7 +7,8 @@ namespace Nette\Security; -use function ctype_digit, in_array, is_string, iterator_to_array; +use Nette; +use function array_key_exists, ctype_digit, in_array, is_string, iterator_to_array; /** @@ -112,8 +113,11 @@ public function &__get(string $key): mixed $res = $this->{'get' . ucfirst($key)}(); return $res; - } else { + } elseif (array_key_exists($key, $this->data)) { return $this->data[$key]; + + } else { + Nette\Utils\ObjectHelpers::strictGet(static::class, $key); } } diff --git a/tests/Security/SimpleIdentity.phpt b/tests/Security/SimpleIdentity.phpt index b44fa56..bba74f2 100644 --- a/tests/Security/SimpleIdentity.phpt +++ b/tests/Security/SimpleIdentity.phpt @@ -32,3 +32,16 @@ test('', function () { $id = new SimpleIdentity('12345678901234567890'); Assert::same('12345678901234567890', $id->getId()); }); + + +test('reading an undeclared data key throws and does not pollute data', function () { + $id = new SimpleIdentity(12, 'admin', ['name' => 'John', 'note' => null]); + Assert::null($id->note); // existing null value is readable + + Assert::exception( + fn() => $id->undeclared, + Nette\MemberAccessException::class, + 'Cannot read an undeclared property Nette\Security\SimpleIdentity::$undeclared.', + ); + Assert::same(['name' => 'John', 'note' => null], $id->getData()); +}); From 266e4453c0b6b138e0851c2892acd29bb7935a0b Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 24 Sep 2021 14:12:52 +0200 Subject: [PATCH 10/13] User: deprecated magic properties (BC break) --- src/Security/User.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Security/User.php b/src/Security/User.php index f9055d2..21387ac 100644 --- a/src/Security/User.php +++ b/src/Security/User.php @@ -17,11 +17,11 @@ * * @property-read bool $loggedIn * @property-read ?IIdentity $identity - * @property-read string|int|null $id - * @property-read list $roles - * @property-read ?int $logoutReason - * @property Authenticator $authenticator - * @property Authorizator $authorizator + * @property-deprecated string|int|null $id + * @property-deprecated list $roles + * @property-deprecated ?int $logoutReason + * @property-deprecated Authenticator $authenticator + * @property-deprecated Authorizator $authorizator */ class User { From ec6e2ecc754de2ca6f7e10ac5736fcfa39aa5d5f Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sat, 23 May 2026 04:00:44 +0200 Subject: [PATCH 11/13] IdentityHandler: make getGuestIdentity() a regular interface method (BC break) Promotes the optional @method to a required method, so User no longer needs method_exists() to call it. BC break: existing IdentityHandler implementations must now declare getGuestIdentity(). --- src/Security/IdentityHandler.php | 6 +++++- src/Security/User.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Security/IdentityHandler.php b/src/Security/IdentityHandler.php index ed9956f..0252386 100644 --- a/src/Security/IdentityHandler.php +++ b/src/Security/IdentityHandler.php @@ -10,7 +10,6 @@ /** * Serializes and restores identity to/from persistent storage. - * @method ?IIdentity getGuestIdentity() */ interface IdentityHandler { @@ -23,4 +22,9 @@ function sleepIdentity(IIdentity $identity): IIdentity; * Called after identity is read from storage. Typically refreshes roles or validates the token. Returns null to force logout. */ function wakeupIdentity(IIdentity $identity): ?IIdentity; + + /** + * Returns the identity for an anonymous (not logged-in) user, or null if none. + */ + function getGuestIdentity(): ?IIdentity; } diff --git a/src/Security/User.php b/src/Security/User.php index 21387ac..f9c9742 100644 --- a/src/Security/User.php +++ b/src/Security/User.php @@ -178,7 +178,7 @@ private function resolveGuestIdentity(): ?IIdentity { if (!$this->guestIdentityResolved) { $this->guestIdentityResolved = true; - $this->guestIdentity = $this->authenticator instanceof IdentityHandler && method_exists($this->authenticator, 'getGuestIdentity') + $this->guestIdentity = $this->authenticator instanceof IdentityHandler ? $this->authenticator->getGuestIdentity() : null; } From 53bc7d6f057db6abd758b1ede96be16bf255643d Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 6 Oct 2022 17:59:54 +0200 Subject: [PATCH 12/13] CookieIdentity WIP --- src/Bridges/SecurityHttp/CookieIdentity.php | 57 +++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/Bridges/SecurityHttp/CookieIdentity.php diff --git a/src/Bridges/SecurityHttp/CookieIdentity.php b/src/Bridges/SecurityHttp/CookieIdentity.php new file mode 100644 index 0000000..3ffd892 --- /dev/null +++ b/src/Bridges/SecurityHttp/CookieIdentity.php @@ -0,0 +1,57 @@ +uid = $uid; + } + + + public function getId(): string + { + return $this->uid; + } + + + /** + * @throws Nette\NotSupportedException + */ + public function getRoles(): array + { + throw new Nette\NotSupportedException; + } + + + /** + * @return array + * @throws Nette\NotSupportedException + */ + public function getData(): array + { + throw new Nette\NotSupportedException; + } +} From b475caa022fbca93e45a7c7a59da2e07bdc7012f Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sat, 23 Nov 2024 17:52:50 +0100 Subject: [PATCH 13/13] deprecated wip --- src/Security/Authenticator.php | 8 ++++---- src/Security/Authorizator.php | 6 +++--- src/Security/User.php | 8 ++++---- src/Security/UserStorage.php | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Security/Authenticator.php b/src/Security/Authenticator.php index 42c0cab..0da73f5 100644 --- a/src/Security/Authenticator.php +++ b/src/Security/Authenticator.php @@ -20,16 +20,16 @@ interface Authenticator Failure = 3, NotApproved = 4; - /** @deprecated use Authenticator::IdentityNotFound */ + #[\Deprecated('use Authenticator::IdentityNotFound')] public const IDENTITY_NOT_FOUND = self::IdentityNotFound; - /** @deprecated use Authenticator::InvalidCredential */ + #[\Deprecated('use Authenticator::InvalidCredential')] public const INVALID_CREDENTIAL = self::InvalidCredential; - /** @deprecated use Authenticator::Failure */ + #[\Deprecated('use Authenticator::Failure')] public const FAILURE = self::Failure; - /** @deprecated use Authenticator::NotApproved */ + #[\Deprecated('use Authenticator::NotApproved')] public const NOT_APPROVED = self::NotApproved; /** diff --git a/src/Security/Authorizator.php b/src/Security/Authorizator.php index ca2d450..e942b84 100644 --- a/src/Security/Authorizator.php +++ b/src/Security/Authorizator.php @@ -22,13 +22,13 @@ interface Authorizator /** Permission type: deny */ public const Deny = false; - /** @deprecated use Authorizator::All */ + #[\Deprecated('use Authorizator::All')] public const ALL = self::All; - /** @deprecated use Authorizator::Allow */ + #[\Deprecated('use Authorizator::Allow')] public const ALLOW = self::Allow; - /** @deprecated use Authorizator::Deny */ + #[\Deprecated('use Authorizator::Deny')] public const DENY = self::Deny; /** diff --git a/src/Security/User.php b/src/Security/User.php index f9c9742..c42df7c 100644 --- a/src/Security/User.php +++ b/src/Security/User.php @@ -32,16 +32,16 @@ class User LogoutManual = 1, LogoutInactivity = 2; - /** @deprecated use User::LogoutManual */ + #[\Deprecated('use User::LogoutManual')] public const LOGOUT_MANUAL = self::LogoutManual; - /** @deprecated use User::LogoutManual */ + #[\Deprecated('use User::LogoutManual')] public const MANUAL = self::LogoutManual; - /** @deprecated use User::LogoutInactivity */ + #[\Deprecated('use User::LogoutInactivity')] public const LOGOUT_INACTIVITY = self::LogoutInactivity; - /** @deprecated use User::LogoutInactivity */ + #[\Deprecated('use User::LogoutInactivity')] public const INACTIVITY = self::LogoutInactivity; /** role for an unauthenticated user, unless a guest identity provides its own roles */ diff --git a/src/Security/UserStorage.php b/src/Security/UserStorage.php index 82e83c7..64a397d 100644 --- a/src/Security/UserStorage.php +++ b/src/Security/UserStorage.php @@ -13,10 +13,10 @@ */ interface UserStorage { - /** @deprecated use User::LogoutManual */ + #[\Deprecated('use User::LogoutManual')] public const LOGOUT_MANUAL = 1; - /** @deprecated use User::LogoutInactivity */ + #[\Deprecated('use User::LogoutInactivity')] public const LOGOUT_INACTIVITY = 2; /**