Discussion:
[MediaWiki-commits] [Gerrit] mediawiki...EducationProgram[master]: Slightly improve some type hints in PHPDoc blocks
Thiemo Kreuz (WMDE) (Code Review)
2017-12-28 11:49:37 UTC
Permalink
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400573 )

Change subject: Slightly improve some type hints in PHPDoc blocks
......................................................................

Slightly improve some type hints in PHPDoc blocks

Change-Id: I2b0962e293fe9e00a8b3f5933c22f8509d85039a
---
M includes/Extension.php
M includes/rows/RevisionedObject.php
M includes/specials/SpecialEducationProgram.php
M includes/tables/IORMTable.php
M tests/phpunit/Events/RecentPageEventGrouperTest.php
5 files changed, 14 insertions(+), 17 deletions(-)


git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram refs/changes/73/400573/1

diff --git a/includes/Extension.php b/includes/Extension.php
index 8a9f08a..b4f1677 100644
--- a/includes/Extension.php
+++ b/includes/Extension.php
@@ -104,7 +104,6 @@
}

/**
- *
* Get the singleton NotificationsManager. If it doesn't exist yet, we
* create it and set it up.
*
diff --git a/includes/rows/RevisionedObject.php b/includes/rows/RevisionedObject.php
index 4250866..d698696 100644
--- a/includes/rows/RevisionedObject.php
+++ b/includes/rows/RevisionedObject.php
@@ -32,7 +32,6 @@
protected $storeRevisions = true;

/**
- *
* @since 0.1
* @var RevisionAction|bool false
*/
@@ -498,7 +497,6 @@

/**
* Set a field to the value of the corresponding field in the provided object.
- *
*
* @since 0.1
* @param string $fieldName
diff --git a/includes/specials/SpecialEducationProgram.php b/includes/specials/SpecialEducationProgram.php
index d5ebdc9..762e019 100644
--- a/includes/specials/SpecialEducationProgram.php
+++ b/includes/specials/SpecialEducationProgram.php
@@ -211,7 +211,7 @@
*
* @since 0.1
*
- * @param array $terms
+ * @param array[] $terms
*
* @return string
*/
@@ -252,7 +252,7 @@
*
* @since 0.1
*
- * @return array
+ * @return array[]
*/
protected function getTermData() {
$termNames = Courses::singleton()->selectFields( 'term', [], [ 'DISTINCT' ] );
@@ -313,12 +313,12 @@
*
* @since 0.1
*
- * @param array $students
- * @param array $oas
- * @param array $cas
- * @param array $instructors
+ * @param int[] $students
+ * @param int[] $oas
+ * @param int[] $cas
+ * @param int[] $instructors
*
- * @return array
+ * @return float[]
*/
protected function getByGender( array $students, array $oas, array $cas, array $instructors ) {
$genders = $this->getGenders(
@@ -340,10 +340,10 @@
*
* @since 0.1
*
- * @param array $users The users
- * @param array $genders An array mapping user id to gender
+ * @param int[] $users User IDs
+ * @param string[] $genders An array mapping user id to gender
*
- * @return array
+ * @return float[]
*/
protected function getGenderDistribution( array $users, array $genders ) {
$distribution = [ 'unknown' => 0, 'male' => 0, 'female' => 0 ];
@@ -366,9 +366,9 @@
*
* @since 0.1
*
- * @param array $userIds
+ * @param int[] $userIds
*
- * @return array
+ * @return string[]
*/
protected function getGenders( array $userIds ) {
$dbr = wfGetDB( DB_REPLICA );
diff --git a/includes/tables/IORMTable.php b/includes/tables/IORMTable.php
index e904b1a..94783ca 100644
--- a/includes/tables/IORMTable.php
+++ b/includes/tables/IORMTable.php
@@ -380,7 +380,7 @@
*
* @see LoadBalancer::reuseConnection
*
- * @param Database $db The database
+ * @param Database $db
*
* @since 1.20
*/
diff --git a/tests/phpunit/Events/RecentPageEventGrouperTest.php b/tests/phpunit/Events/RecentPageEventGrouperTest.php
index 3904497..e8307d8 100644
--- a/tests/phpunit/Events/RecentPageEventGrouperTest.php
+++ b/tests/phpunit/Events/RecentPageEventGrouperTest.php
@@ -42,7 +42,7 @@
$groupedEvents = $grouper->groupEvents( [] );

$this->assertInternalType( 'array', $groupedEvents );
- $this->assertCount( 0, $groupedEvents );
+ $this->assertEmpty( $groupedEvents );
}

/**
--
To view, visit https://gerrit.wikimedia.org/r/400573
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b0962e293fe9e00a8b3f5933c22f8509d85039a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <***@wikimedia.de>
jenkins-bot (Code Review)
2017-12-30 21:38:40 UTC
Permalink
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/400573 )

Change subject: Slightly improve some type hints in PHPDoc blocks
......................................................................


Slightly improve some type hints in PHPDoc blocks

Change-Id: I2b0962e293fe9e00a8b3f5933c22f8509d85039a
---
M includes/Extension.php
M includes/rows/RevisionedObject.php
M includes/specials/SpecialEducationProgram.php
M includes/tables/IORMTable.php
M tests/phpunit/Events/RecentPageEventGrouperTest.php
5 files changed, 14 insertions(+), 17 deletions(-)

Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified



diff --git a/includes/Extension.php b/includes/Extension.php
index 8a9f08a..b4f1677 100644
--- a/includes/Extension.php
+++ b/includes/Extension.php
@@ -104,7 +104,6 @@
}

/**
- *
* Get the singleton NotificationsManager. If it doesn't exist yet, we
* create it and set it up.
*
diff --git a/includes/rows/RevisionedObject.php b/includes/rows/RevisionedObject.php
index 4250866..d698696 100644
--- a/includes/rows/RevisionedObject.php
+++ b/includes/rows/RevisionedObject.php
@@ -32,7 +32,6 @@
protected $storeRevisions = true;

/**
- *
* @since 0.1
* @var RevisionAction|bool false
*/
@@ -498,7 +497,6 @@

/**
* Set a field to the value of the corresponding field in the provided object.
- *
*
* @since 0.1
* @param string $fieldName
diff --git a/includes/specials/SpecialEducationProgram.php b/includes/specials/SpecialEducationProgram.php
index d5ebdc9..762e019 100644
--- a/includes/specials/SpecialEducationProgram.php
+++ b/includes/specials/SpecialEducationProgram.php
@@ -211,7 +211,7 @@
*
* @since 0.1
*
- * @param array $terms
+ * @param array[] $terms
*
* @return string
*/
@@ -252,7 +252,7 @@
*
* @since 0.1
*
- * @return array
+ * @return array[]
*/
protected function getTermData() {
$termNames = Courses::singleton()->selectFields( 'term', [], [ 'DISTINCT' ] );
@@ -313,12 +313,12 @@
*
* @since 0.1
*
- * @param array $students
- * @param array $oas
- * @param array $cas
- * @param array $instructors
+ * @param int[] $students
+ * @param int[] $oas
+ * @param int[] $cas
+ * @param int[] $instructors
*
- * @return array
+ * @return float[]
*/
protected function getByGender( array $students, array $oas, array $cas, array $instructors ) {
$genders = $this->getGenders(
@@ -340,10 +340,10 @@
*
* @since 0.1
*
- * @param array $users The users
- * @param array $genders An array mapping user id to gender
+ * @param int[] $users User IDs
+ * @param string[] $genders An array mapping user id to gender
*
- * @return array
+ * @return float[]
*/
protected function getGenderDistribution( array $users, array $genders ) {
$distribution = [ 'unknown' => 0, 'male' => 0, 'female' => 0 ];
@@ -366,9 +366,9 @@
*
* @since 0.1
*
- * @param array $userIds
+ * @param int[] $userIds
*
- * @return array
+ * @return string[]
*/
protected function getGenders( array $userIds ) {
$dbr = wfGetDB( DB_REPLICA );
diff --git a/includes/tables/IORMTable.php b/includes/tables/IORMTable.php
index e904b1a..94783ca 100644
--- a/includes/tables/IORMTable.php
+++ b/includes/tables/IORMTable.php
@@ -380,7 +380,7 @@
*
* @see LoadBalancer::reuseConnection
*
- * @param Database $db The database
+ * @param Database $db
*
* @since 1.20
*/
diff --git a/tests/phpunit/Events/RecentPageEventGrouperTest.php b/tests/phpunit/Events/RecentPageEventGrouperTest.php
index 3904497..e8307d8 100644
--- a/tests/phpunit/Events/RecentPageEventGrouperTest.php
+++ b/tests/phpunit/Events/RecentPageEventGrouperTest.php
@@ -42,7 +42,7 @@
$groupedEvents = $grouper->groupEvents( [] );

$this->assertInternalType( 'array', $groupedEvents );
- $this->assertCount( 0, $groupedEvents );
+ $this->assertEmpty( $groupedEvents );
}

/**
--
To view, visit https://gerrit.wikimedia.org/r/400573
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2b0962e293fe9e00a8b3f5933c22f8509d85039a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <***@wikimedia.de>
Gerrit-Reviewer: AndyRussG <***@gmail.com>
Gerrit-Reviewer: Jeroen De Dauw <***@gmail.com>
Gerrit-Reviewer: Legoktm <***@member.fsf.org>
Gerrit-Reviewer: jenkins-bot <>
Loading...