Skip to content

Commit df7541f

Browse files
authored
Merge pull request #810 from masteradhoc/phpstan-fixes
Fix various phpstan issues
2 parents c8fcc8c + b8d4ad5 commit df7541f

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

providers/class-two-factor-backup-codes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private function get_backup_code_length( $user ) {
272272
* @param array $args Optional arguments for assigning new codes.
273273
* @return array
274274
*/
275-
public function generate_codes( $user, $args = '' ) {
275+
public function generate_codes( $user, $args = array() ) {
276276
$codes = array();
277277
$codes_hashed = array();
278278

providers/class-two-factor-totp.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function enqueue_assets( $hook_suffix ) {
185185
* @since 0.8.0
186186
*
187187
* @param WP_REST_Request $request The Rest Request object.
188-
* @return array Success array.
188+
* @return WP_Error|array Array of data on success, WP_Error on error.
189189
*/
190190
public function rest_delete_totp( $request ) {
191191
$user_id = $request['user_id'];
@@ -654,15 +654,15 @@ public static function get_authcode_valid_ticktime( $key, $authcode, $hash = sel
654654
$ticks = range( - $max_ticks, $max_ticks );
655655
usort( $ticks, array( __CLASS__, 'abssort' ) );
656656

657-
$time = floor( self::time() / $time_step );
657+
$time = (int) floor( self::time() / $time_step );
658658

659659
$digits = strlen( $authcode );
660660

661661
foreach ( $ticks as $offset ) {
662-
$log_time = $time + $offset;
662+
$log_time = (int) ( $time + $offset );
663663
if ( hash_equals( self::calc_totp( $key, $log_time, $digits, $hash, $time_step ), $authcode ) ) {
664664
// Return the tick timestamp.
665-
return $log_time * self::DEFAULT_TIME_STEP_SEC;
665+
return (int) ( $log_time * self::DEFAULT_TIME_STEP_SEC );
666666
}
667667
}
668668

0 commit comments

Comments
 (0)