@@ -121,11 +121,13 @@ public function setDigits(?int $digits): TwoFactorUser
121121 return $ this ;
122122 }
123123
124+ #[\Override]
124125 public function isTotpAuthenticationEnabled (): bool
125126 {
126127 return (bool ) $ this ->secret && null !== $ this ->activatedAt ;
127128 }
128129
130+ #[\Override]
129131 public function getTotpAuthenticationUsername (): string
130132 {
131133 if (null === $ this ->user ) {
@@ -135,12 +137,14 @@ public function getTotpAuthenticationUsername(): string
135137 return $ this ->user ->getUserIdentifier ();
136138 }
137139
140+ #[\Override]
138141 public function getTotpAuthenticationConfiguration (): ?TotpConfigurationInterface
139142 {
140143 // You could persist the other configuration options in the user entity to make it individual per user.
141144 return new TotpConfiguration ($ this ->secret , $ this ->getAlgorithm (), $ this ->getPeriod (), $ this ->getDigits ());
142145 }
143146
147+ #[\Override]
144148 public function isGoogleAuthenticatorEnabled (): bool
145149 {
146150 return (bool ) $ this ->secret
@@ -151,6 +155,7 @@ public function isGoogleAuthenticatorEnabled(): bool
151155 ;
152156 }
153157
158+ #[\Override]
154159 public function getGoogleAuthenticatorUsername (): string
155160 {
156161 if (null === $ this ->user ) {
@@ -160,6 +165,7 @@ public function getGoogleAuthenticatorUsername(): string
160165 return $ this ->user ->getUserIdentifier ();
161166 }
162167
168+ #[\Override]
163169 public function getGoogleAuthenticatorSecret (): ?string
164170 {
165171 return $ this ->secret ;
@@ -168,11 +174,12 @@ public function getGoogleAuthenticatorSecret(): ?string
168174 /**
169175 * Check if it is a valid backup code.
170176 */
177+ #[\Override]
171178 public function isBackupCode (string $ code ): bool
172179 {
173180 // Loop over all backup codes and check if the code is valid
174181 foreach ($ this ->backupCodes as $ backupCode ) {
175- if (password_verify ($ code , $ backupCode )) {
182+ if (password_verify ($ code , ( string ) $ backupCode )) {
176183 return true ;
177184 }
178185 }
@@ -183,11 +190,12 @@ public function isBackupCode(string $code): bool
183190 /**
184191 * Invalidate a backup code.
185192 */
193+ #[\Override]
186194 public function invalidateBackupCode (string $ code ): void
187195 {
188196 // Loop over all backup codes and check if the code is valid to invalidate it
189197 foreach ($ this ->backupCodes as $ key => $ backupCode ) {
190- if (password_verify ($ code , $ backupCode )) {
198+ if (password_verify ($ code , ( string ) $ backupCode )) {
191199 unset($ this ->backupCodes [$ key ]);
192200 $ this ->backupCodes = array_values ($ this ->backupCodes );
193201 }
@@ -204,6 +212,7 @@ public function addBackUpCode(string $backUpCode): void
204212 }
205213 }
206214
215+ #[\Override]
207216 public function getTrustedTokenVersion (): int
208217 {
209218 return $ this ->trustedVersion ;
0 commit comments