Dan-nl has submitted this change and it was merged.
Change subject: Couple of type hints
......................................................................
Couple of type hints
Added @throws
Added explicit class member
Change-Id: I46d14116441a5a59e311d5cbe57530e6e1a47725
---
M includes/Handlers/UploadHandler.php
M includes/Handlers/Xml/XmlDetectHandler.php
M includes/Handlers/Xml/XmlHandler.php
M includes/Helpers/GWTFileBackend.php
M includes/Hooks/Hooks.php
M includes/Jobs/UploadMetadataJob.php
M includes/Models/Mapping.php
M includes/Utils.php
8 files changed, 22 insertions(+), 6 deletions(-)
Approvals:
Dan-nl: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Handlers/UploadHandler.php
b/includes/Handlers/UploadHandler.php
index d5adf4f..ef856a8 100644
--- a/includes/Handlers/UploadHandler.php
+++ b/includes/Handlers/UploadHandler.php
@@ -494,6 +494,7 @@
* @param {array} $whitelisted_post
*
* @return {bool}
+ * @throws {MWException}
*/
public function saveMediafileViaJob(
array $user_options, array $options, array $whitelisted_post
diff --git a/includes/Handlers/Xml/XmlDetectHandler.php
b/includes/Handlers/Xml/XmlDetectHandler.php
index c60aec4..b0eae41 100644
--- a/includes/Handlers/Xml/XmlDetectHandler.php
+++ b/includes/Handlers/Xml/XmlDetectHandler.php
@@ -13,7 +13,6 @@
GWToolset\GWTException,
GWToolset\Utils,
GWToolset\Models\Mapping,
- GWToolset\Models\MediawikiTemplate,
Html,
MWException,
Sanitizer,
diff --git a/includes/Handlers/Xml/XmlHandler.php
b/includes/Handlers/Xml/XmlHandler.php
index c7c3932..4dd3d5a 100644
--- a/includes/Handlers/Xml/XmlHandler.php
+++ b/includes/Handlers/Xml/XmlHandler.php
@@ -8,13 +8,18 @@
*/
namespace GWToolset\Handlers\Xml;
-use
-GWToolset\GWTException,
+use GWToolset\GWTException,
+ GWToolset\Helpers\GWTFileBackend,
Html,
MWException,
XMLReader;
abstract class XmlHandler {
+
+ /**
+ * @var {GWToolset\Helpers\GWTFileBackend}
+ */
+ protected $_GWTFileBackend;
public abstract function __construct();
@@ -127,7 +132,7 @@
while ( $XMLReader->read() ) {
if ( $XMLReader->nodeType === XMLReader::DOC_TYPE ) {
- if ( $this->_GWTFileBackend instanceof
\GWToolset\Helpers\GWTFileBackend ) {
+ if ( $this->_GWTFileBackend instanceof
GWTFileBackend ) {
$mwstore_relative_path =
$this->_GWTFileBackend->getMWStoreRelativePath();
if ( $mwstore_relative_path !== null ) {
diff --git a/includes/Helpers/GWTFileBackend.php
b/includes/Helpers/GWTFileBackend.php
index dab9dca..459008f 100644
--- a/includes/Helpers/GWTFileBackend.php
+++ b/includes/Helpers/GWTFileBackend.php
@@ -111,6 +111,7 @@
*
* @param {string} $mwstore_complete_file_path
* @return {Status}
+ * @throws {MWException}
*/
public function deleteFile( $mwstore_complete_file_path = null ) {
if ( empty( $mwstore_complete_file_path ) ) {
@@ -439,6 +440,7 @@
* sets up the file backend
*
* @param {array} $params
+ * @throws {MWException}
*/
protected function setupFileBackend( array $params ) {
if ( empty( $params['file-backend-name'] ) ) {
diff --git a/includes/Hooks/Hooks.php b/includes/Hooks/Hooks.php
index e12ef53..02a35f9 100644
--- a/includes/Hooks/Hooks.php
+++ b/includes/Hooks/Hooks.php
@@ -11,8 +11,8 @@
class Hooks {
/**
- * @param $list array
- * @return bool
+ * @param {array} $list
+ * @return {bool}
*/
public static function onCanonicalNamespaces( &$list ) {
$list[NS_GWTOOLSET] = 'GWToolset';
@@ -20,6 +20,10 @@
return true;
}
+ /**
+ * @param {array} $files
+ * @return {bool}
+ */
public static function onUnitTestsList( &$files ) {
global $wgGWToolsetDir;
$files = array_merge( $files, glob( $wgGWToolsetDir .
'/tests/phpunit/*Test.php' ) );
diff --git a/includes/Jobs/UploadMetadataJob.php
b/includes/Jobs/UploadMetadataJob.php
index 7c951aa..e9f09e8 100644
--- a/includes/Jobs/UploadMetadataJob.php
+++ b/includes/Jobs/UploadMetadataJob.php
@@ -56,6 +56,7 @@
}
/**
+ * @throws {MWException}
* @return {bool}
*/
protected function recreateMetadataJob() {
diff --git a/includes/Models/Mapping.php b/includes/Models/Mapping.php
index b08b40b..8a4831e 100644
--- a/includes/Models/Mapping.php
+++ b/includes/Models/Mapping.php
@@ -77,6 +77,8 @@
*
* @return {array}
* the keys and values within the array are not filtered
+ *
+ * @throws {GWTException}
*/
public function getJsonAsArray( array &$options = array() ) {
try {
diff --git a/includes/Utils.php b/includes/Utils.php
index 2cf97d8..f645267 100644
--- a/includes/Utils.php
+++ b/includes/Utils.php
@@ -281,6 +281,7 @@
* @param {int} $params['max']
* @param {int} $params['default']
* @return {int}
+ * @throws {MWException}
*/
public static function sanitizeNumericRange( $value, $params ) {
if ( !isset( $params['min'] ) ) {
@@ -325,6 +326,7 @@
/**
* @param {string} $string
* @return {string|null}
+ * @throws {MWException}
*/
public static function sanitizeString( $string ) {
// is_string thought some form fields were booleans instead of
strings
--
To view, visit https://gerrit.wikimedia.org/r/102455
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I46d14116441a5a59e311d5cbe57530e6e1a47725
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: Dan-nl <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits