From eae81c9a88cf02732cd1593b8fa5bde63b86db30 Mon Sep 17 00:00:00 2001
From: CosmicAlpha <cosmic.alpha24@gmail.com>
Date: Sat, 11 Nov 2023 19:51:02 -0700
Subject: [PATCH 1/2] Add null check

---
 MediaWikiUserpageCustomField.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/MediaWikiUserpageCustomField.php b/MediaWikiUserpageCustomField.php
index 06e7bfd..6d3efe9 100644
--- a/MediaWikiUserpageCustomField.php
+++ b/MediaWikiUserpageCustomField.php
@@ -15,9 +15,11 @@ public function getFieldKey() {
 
 	public function getFieldName() {
 		$account = $this->getExternalAccount();
-		$uri = $account->getAccountURI();
-		if ( strpos( $uri, 'wikitide.org' ) !== false ) {
-			return pht( 'WikiTide User' );
+		if ( $account !== null ) {
+			$uri = $account->getAccountURI();
+			if ( strpos( $uri, 'wikitide.org' ) !== false ) {
+				return pht( 'WikiTide User' );
+			}
 		}
 
 		return pht( 'WikiForge User' );

From b3ed134a18b466f0861e79eef152eec8db3dd138 Mon Sep 17 00:00:00 2001
From: github-actions <github-actions@users.noreply.github.com>
Date: Sun, 12 Nov 2023 02:51:21 +0000
Subject: [PATCH 2/2] CI: lint code to MediaWiki standards

Check commit and GitHub actions for more details
---
 PhutilMediaWikiAuthAdapter.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PhutilMediaWikiAuthAdapter.php b/PhutilMediaWikiAuthAdapter.php
index 6997bce..17a9bff 100644
--- a/PhutilMediaWikiAuthAdapter.php
+++ b/PhutilMediaWikiAuthAdapter.php
@@ -132,7 +132,7 @@ private function getUserInfo() {
 			// We gen this so we can check for replay below:
 			$nonce = Filesystem::readRandomCharacters( 32 );
 
-			list( $body ) = $this->newOAuth1Future( $uri )
+			[ $body ] = $this->newOAuth1Future( $uri )
 				->setMethod( 'GET' )
 				->setNonce( $nonce )
 				->addHeader( 'User-Agent', __CLASS__ )
@@ -205,7 +205,7 @@ private function decodeAndVerifyJWT( $jwt, $nonce ) {
 
 	/** decode a JWT and verify the signature is valid */
 	private function decodeJWT( $jwt ) {
-		list( $headb64, $bodyb64, $sigb64 ) = explode( '.', $jwt );
+		[ $headb64, $bodyb64, $sigb64 ] = explode( '.', $jwt );
 
 		$header = json_decode( $this->urlsafeB64Decode( $headb64 ) );
 		$body = json_decode( $this->urlsafeB64Decode( $bodyb64 ) );