From 29103eecdebb2e77a20cbd8e27c3a3fabc9f8cc9 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Mon, 19 Aug 2024 21:36:23 +0200 Subject: [PATCH] Add missing documentation to class properties Change-Id: Ic7872cd2539dc79f88c70548cbd82d9de98f66b0 --- .phpcs.xml | 6 +----- FancyCaptcha/includes/FancyCaptcha.php | 6 ++++-- FancyCaptcha/includes/HTMLFancyCaptchaField.php | 1 + QuestyCaptcha/includes/QuestyCaptcha.php | 6 ++++-- ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php | 7 +++++-- SimpleCaptcha/SimpleCaptcha.php | 1 + Turnstile/includes/Turnstile.php | 7 +++++-- hCaptcha/includes/HCaptcha.php | 10 ++++++++-- includes/Hooks.php | 1 + includes/Store/CaptchaHashStore.php | 1 + 10 files changed, 31 insertions(+), 15 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index 5bcdea434..b915cf830 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,10 +1,6 @@ - - - - - + . diff --git a/FancyCaptcha/includes/FancyCaptcha.php b/FancyCaptcha/includes/FancyCaptcha.php index 957aedec0..387c7418f 100644 --- a/FancyCaptcha/includes/FancyCaptcha.php +++ b/FancyCaptcha/includes/FancyCaptcha.php @@ -22,8 +22,10 @@ use UnderflowException; * FancyCaptcha for displaying captchas precomputed by captcha.py */ class FancyCaptcha extends SimpleCaptcha { - // used for fancycaptcha-edit, fancycaptcha-addurl, fancycaptcha-badlogin, - // fancycaptcha-accountcreate, fancycaptcha-create, fancycaptcha-sendemail via getMessage() + /** + * @var string used for fancycaptcha-edit, fancycaptcha-addurl, fancycaptcha-badlogin, + * fancycaptcha-accountcreate, fancycaptcha-create, fancycaptcha-sendemail via getMessage() + */ protected static $messagePrefix = 'fancycaptcha-'; /** diff --git a/FancyCaptcha/includes/HTMLFancyCaptchaField.php b/FancyCaptcha/includes/HTMLFancyCaptchaField.php index 630fa2112..6be96803f 100644 --- a/FancyCaptcha/includes/HTMLFancyCaptchaField.php +++ b/FancyCaptcha/includes/HTMLFancyCaptchaField.php @@ -16,6 +16,7 @@ class HTMLFancyCaptchaField extends HTMLFormField { /** @var bool */ protected $showCreateHelp; + /** @var string */ protected $mClass = 'captcha'; /** diff --git a/QuestyCaptcha/includes/QuestyCaptcha.php b/QuestyCaptcha/includes/QuestyCaptcha.php index 05ce415cb..cccef4297 100644 --- a/QuestyCaptcha/includes/QuestyCaptcha.php +++ b/QuestyCaptcha/includes/QuestyCaptcha.php @@ -19,8 +19,10 @@ use MediaWiki\Html\Html; use Xml; class QuestyCaptcha extends SimpleCaptcha { - // used for questycaptcha-edit, questycaptcha-addurl, questycaptcha-badlogin, - // questycaptcha-createaccount, questycaptcha-create, questycaptcha-sendemail via getMessage() + /** + * @var string used for questycaptcha-edit, questycaptcha-addurl, questycaptcha-badlogin, + * questycaptcha-createaccount, questycaptcha-create, questycaptcha-sendemail via getMessage() + */ protected static $messagePrefix = 'questycaptcha-'; /** diff --git a/ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php b/ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php index 162185231..e359948b2 100644 --- a/ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php +++ b/ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php @@ -16,10 +16,13 @@ use MediaWiki\Request\WebRequest; use MediaWiki\Status\Status; class ReCaptchaNoCaptcha extends SimpleCaptcha { - // used for renocaptcha-edit, renocaptcha-addurl, renocaptcha-badlogin, renocaptcha-createaccount, - // renocaptcha-create, renocaptcha-sendemail via getMessage() + /** + * @var string used for renocaptcha-edit, renocaptcha-addurl, renocaptcha-badlogin, renocaptcha-createaccount, + * renocaptcha-create, renocaptcha-sendemail via getMessage() + */ protected static $messagePrefix = 'renocaptcha-'; + /** @var string|null */ private $error = null; /** diff --git a/SimpleCaptcha/SimpleCaptcha.php b/SimpleCaptcha/SimpleCaptcha.php index 3d06ef59c..c265fb43e 100644 --- a/SimpleCaptcha/SimpleCaptcha.php +++ b/SimpleCaptcha/SimpleCaptcha.php @@ -45,6 +45,7 @@ use WikiPage; * Demo CAPTCHA (not for production usage) and base class for real CAPTCHAs */ class SimpleCaptcha { + /** @var string */ protected static $messagePrefix = 'captcha-'; /** @var bool Override to force showing the CAPTCHA to users who don't have "skipcaptcha" right. */ diff --git a/Turnstile/includes/Turnstile.php b/Turnstile/includes/Turnstile.php index ca2201de7..355b4e326 100644 --- a/Turnstile/includes/Turnstile.php +++ b/Turnstile/includes/Turnstile.php @@ -16,10 +16,13 @@ use MediaWiki\Request\WebRequest; use MediaWiki\Status\Status; class Turnstile extends SimpleCaptcha { - // used for turnstile-edit, turnstile-addurl, turnstile-badlogin, turnstile-createaccount, - // turnstile-create, turnstile-sendemail via getMessage() + /** + * @var string used for turnstile-edit, turnstile-addurl, turnstile-badlogin, turnstile-createaccount, + * turnstile-create, turnstile-sendemail via getMessage() + */ protected static $messagePrefix = 'turnstile-'; + /** @var string|null */ private $error = null; /** diff --git a/hCaptcha/includes/HCaptcha.php b/hCaptcha/includes/HCaptcha.php index b699f6f2e..a27afe630 100644 --- a/hCaptcha/includes/HCaptcha.php +++ b/hCaptcha/includes/HCaptcha.php @@ -5,6 +5,7 @@ namespace MediaWiki\Extension\ConfirmEdit\hCaptcha; use ApiBase; use FormatJson; use MediaWiki\Auth\AuthenticationRequest; +use MediaWiki\Config\Config; use MediaWiki\Context\RequestContext; use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest; use MediaWiki\Extension\ConfirmEdit\Hooks; @@ -18,14 +19,19 @@ use MediaWiki\Request\WebRequest; use MediaWiki\Status\Status; class HCaptcha extends SimpleCaptcha { - // used for hcaptcha-edit, hcaptcha-addurl, hcaptcha-badlogin, hcaptcha-createaccount, - // hcaptcha-create, hcaptcha-sendemail via getMessage() + /** + * @var string used for hcaptcha-edit, hcaptcha-addurl, hcaptcha-badlogin, hcaptcha-createaccount, + * hcaptcha-create, hcaptcha-sendemail via getMessage() + */ protected static $messagePrefix = 'hcaptcha-'; + /** @var string|null */ private $error = null; + /** @var Config */ private $hCaptchaConfig; + /** @var string */ private $siteKey; public function __construct() { diff --git a/includes/Hooks.php b/includes/Hooks.php index 73dd5a385..a1012c5d8 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -53,6 +53,7 @@ class Hooks implements AuthChangeFormFieldsHook { + /** @var bool */ protected static $instanceCreated = false; private WANObjectCache $cache; diff --git a/includes/Store/CaptchaHashStore.php b/includes/Store/CaptchaHashStore.php index d98b97c21..f66617f4d 100644 --- a/includes/Store/CaptchaHashStore.php +++ b/includes/Store/CaptchaHashStore.php @@ -3,6 +3,7 @@ namespace MediaWiki\Extension\ConfirmEdit\Store; class CaptchaHashStore extends CaptchaStore { + /** @var array */ protected $data = []; /**