Skip to content

Commit

Permalink
Fix Psalm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Dec 2, 2022
1 parent 7a8bcec commit b5639df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inc/class-inputfactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private static function get_attributes( array $params ): string {
}

/**
* @psalm-param HelpArgs $args
* @psalm-param HelpArgs&mixed[] $args
*/
private static function render_help( array $args ): void {
if ( ! empty( $args['help'] ) ) {
Expand Down
1 change: 1 addition & 0 deletions inc/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function init(): void {
/**
* @psalm-param array<class-string,string> $providers
* @psalm-return array<class-string,string>
* @psalm-suppress MoreSpecificReturnType, LessSpecificReturnStatement
*/
public function two_factor_providers( array $providers ): array {
$providers[ TwoFactor_Provider_WebAuthn::class ] = __DIR__ . '/class-twofactor-provider-webauthn.php';
Expand Down
1 change: 0 additions & 1 deletion inc/class-webauthn-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public function get_label() {
* @return void
*/
public function authentication_page( $user ) {
/** @psalm-suppress UnresolvableInclude */
require_once ABSPATH . '/wp-admin/includes/template.php';

if ( ! is_ssl() ) {
Expand Down
11 changes: 11 additions & 0 deletions stubs/wordpress.stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,15 @@ function wp_send_json_error( $data = null, $status_code = null, $options = 0 ) {
* @psalm-return never-return
*/
function wp_send_json( $response, $status_code = null, $options = 0 ) {}

/**
* @param string $id
* @param string $title
* @param callable $callback
* @param string $page
* @param string $section
* @psalm-param array{class?: string, label_for?: string, ...} $args
* @return void
*/
function add_settings_field( $id, $title, $callback, $page, $section = 'default', $args = array() ) {}
}

0 comments on commit b5639df

Please sign in to comment.