From 069b9b819819327b229cb4325de690089433755d Mon Sep 17 00:00:00 2001 From: James Morrison Date: Fri, 26 Jan 2024 21:37:24 +0000 Subject: [PATCH] Skip vendor directory for linting; fixed a couple of minor WordPress-Extra standards issues. --- .github/workflows/lint.yml | 2 +- includes/classes/Plugin.php | 8 ++++---- includes/core.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f1e97fd..4a81621 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,4 +22,4 @@ jobs: - name: composer install run: composer install - name: PHPCS check - run: ./vendor/bin/phpcs --standard=WordPress-Extra . + run: ./vendor/bin/phpcs --standard=WordPress-Extra --ignore=vendor . diff --git a/includes/classes/Plugin.php b/includes/classes/Plugin.php index 1cbb927..4407668 100644 --- a/includes/classes/Plugin.php +++ b/includes/classes/Plugin.php @@ -62,10 +62,10 @@ public static function get_instance() { */ public function setup() { // Process SSO login on the 1st hook available on the login page. - add_action( 'login_head', [ $this, 'process_login' ] ); + add_action( 'login_head', array( $this, 'process_login' ) ); // Logout from Cloudflare Access once WP logout is complete. - add_filter( 'logout_redirect', [ $this, 'set_cloudflare_access_logout_url' ], 10, 3 ); + add_filter( 'logout_redirect', array( $this, 'set_cloudflare_access_logout_url' ), 10, 3 ); } /** @@ -100,12 +100,12 @@ public function process_login() { // If a matching user is not found and create an account if ( ! is_a( $user, '\WP_User' ) && CF_ACCESS_CREATE_ACCOUNT ?? false ) { $user_id = wp_insert_user( - [ + array( 'user_login' => $jwt->email, 'user_email' => $jwt->email, 'user_pass' => wp_generate_password( 128, true, true ), 'role' => $this->validate_new_user_role( CF_ACCESS_NEW_USER_ROLE ) ?? 'subscriber', - ] + ) ); if ( ! is_wp_error( $user_id ) ) { diff --git a/includes/core.php b/includes/core.php index 23825c7..3caa35e 100644 --- a/includes/core.php +++ b/includes/core.php @@ -13,8 +13,8 @@ * @return void */ function setup() { - $n = function( $function ) { - return __NAMESPACE__ . "\\$function"; + $n = function ( $_fn ) { + return __NAMESPACE__ . "\\$_fn"; }; add_action( 'init', $n( 'i18n' ) );