Skip to content

Commit

Permalink
fix: issues found by phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks authored and renovate[bot] committed Sep 7, 2023
1 parent 1a796b0 commit 66d06f5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions inc/class-datetimeutils.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace WildWolf\WordPress\TwoFactorWebAuthn;

abstract class DateTimeUtils {
public static function format_date_time( int $dt ) : string {
public static function format_date_time( int $dt ): string {
$date_format = (string) get_option( 'date_format', 'Y-m-d' );
$time_format = (string) get_option( 'time_format', 'H:i:s' );
return date_i18n( $date_format . ' ' . $time_format, $dt, true );
}

public static function format_date_time_full( int $dt ) : string {
public static function format_date_time_full( int $dt ): string {
return gmdate( 'Y-m-d H:i:s', $dt );
}
}
2 changes: 1 addition & 1 deletion inc/class-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function get_u2f_app_id(): string {
* @psalm-param array<string,mixed> $params
* @psalm-suppress PossiblyUnusedParam
*/
public static function render( string $view, array $params = [] ): void {
public static function render( string $view, array $params = [] ): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
/** @psalm-suppress UnresolvableInclude */
require __DIR__ . '/../views/' . $view . '.php'; // NOSONAR
}
Expand Down
1 change: 1 addition & 0 deletions inc/class-webauthn-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function generate_and_save_handle(): UserHandle {
);

if ( false === $result ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escape when printing
throw new UnexpectedValueException( __( 'Unable to save the user handle to the database.', 'two-factor-provider-webauthn' ) );
}

Expand Down
4 changes: 2 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
<exclude name="WordPress.PHP.DisallowShortTernary.Found"/>
<exclude name="Universal.Operators.DisallowShortTernary.Found"/>
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" />
</rule>

<config name="testVersion" value="7.4-"/>
Expand Down
5 changes: 3 additions & 2 deletions views/user-profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

use WildWolf\WordPress\TwoFactorWebAuthn\Key_Table;

/** @psalm-var array{user: WP_User} $params */
defined( 'ABSPATH' ) || die();

defined( 'ABSPATH' ) || die(); ?>
/** @psalm-var array{user: WP_User} $params */
?>

<div id="webauthn-security-keys-section">
<h3><?php esc_html_e( 'Security Keys (WebAuthn)', 'two-factor-provider-webauthn' ); ?></h3>
Expand Down

0 comments on commit 66d06f5

Please sign in to comment.