aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Notification
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2025-03-31 13:06:46 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2025-03-31 13:06:46 +0000
commitc84ab6d428a7f69ef6305cb9ba10df89d0ef2e2e (patch)
tree258c487d8f871c2e8a4ca85aab498bc7285c084b /includes/Notification
parent976a3a5519bb55bf58c2642b76db39155c4abee9 (diff)
parent8bcddbfe9616b0967c1bf9ab1c9ab619e4b7e105 (diff)
downloadmediawikicore-c84ab6d428a7f69ef6305cb9ba10df89d0ef2e2e.tar.gz
mediawikicore-c84ab6d428a7f69ef6305cb9ba10df89d0ef2e2e.zip
Merge "Notifications: Minor cleanup"
Diffstat (limited to 'includes/Notification')
-rw-r--r--includes/Notification/Middleware/SuppressNotificationByTypeMiddleware.php3
-rw-r--r--includes/Notification/MiddlewareChain.php13
-rw-r--r--includes/Notification/Notification.php15
-rw-r--r--includes/Notification/NotificationEnvelope.php5
-rw-r--r--includes/Notification/NotificationMiddlewareInterface.php1
-rw-r--r--includes/Notification/NotificationsBatch.php1
-rw-r--r--includes/Notification/TitleAware.php1
7 files changed, 8 insertions, 31 deletions
diff --git a/includes/Notification/Middleware/SuppressNotificationByTypeMiddleware.php b/includes/Notification/Middleware/SuppressNotificationByTypeMiddleware.php
index 96b77540d0b4..3f56fb69be64 100644
--- a/includes/Notification/Middleware/SuppressNotificationByTypeMiddleware.php
+++ b/includes/Notification/Middleware/SuppressNotificationByTypeMiddleware.php
@@ -18,7 +18,6 @@ class SuppressNotificationByTypeMiddleware implements NotificationMiddlewareInte
/**
* Suppress sending specific notification
- * @param string $notificationTypeToSuppress
*/
public function __construct( string $notificationTypeToSuppress ) {
$this->notificationToSuppress = $notificationTypeToSuppress;
@@ -26,8 +25,6 @@ class SuppressNotificationByTypeMiddleware implements NotificationMiddlewareInte
/**
* Decide whether we want to remove notification from the list
- * @param NotificationEnvelope $envelope
- * @return bool
*/
protected function shouldKeep( NotificationEnvelope $envelope ): bool {
return $envelope->getNotification()->getType() !== $this->notificationToSuppress;
diff --git a/includes/Notification/MiddlewareChain.php b/includes/Notification/MiddlewareChain.php
index eba6408a0121..26f8081f799b 100644
--- a/includes/Notification/MiddlewareChain.php
+++ b/includes/Notification/MiddlewareChain.php
@@ -24,13 +24,9 @@ class MiddlewareChain {
$this->middlewareSpecs = $specs;
}
- /**
- * @param NotificationsBatch $batch
- * @return NotificationsBatch
- */
public function process( NotificationsBatch $batch ): NotificationsBatch {
if ( $this->isProcessing ) {
- // If you need to send an additional notification from middleware
+ // If you need to send an additional notification from middleware,
// use NotificationBatch::add() instead of calling NotificationService from middleware
throw new MiddlewareException(
"Middleware cannot re-trigger the notification processing while it is already in progress. "
@@ -52,12 +48,7 @@ class MiddlewareChain {
return $batch;
}
- /**
- * @param NotificationsBatch $batch
- * @param int $index
- * @return void
- */
- private function callNext( NotificationsBatch $batch, $index ): void {
+ private function callNext( NotificationsBatch $batch, int $index ): void {
if ( $index < count( $this->middleware ) ) {
$this->middleware[$index]->handle(
$batch,
diff --git a/includes/Notification/Notification.php b/includes/Notification/Notification.php
index 7f1740f39df3..b08cf50cbe75 100644
--- a/includes/Notification/Notification.php
+++ b/includes/Notification/Notification.php
@@ -15,10 +15,10 @@ class Notification {
/**
* @TODO Idea: handle future types in format `namespace.type`, like `mediawiki.message`,
- * `growth.welcome`. This way we can easily "override" some notifications, for example
- * we can have `echo.mention`, and the `echo.mention` could supersede `mediawiki.mention`. Also
- * it will be more difficult for notifications to conflict and we will be able to easily filter
- * apply logic depends on the namespace (for example hide if extension not present).
+ * `growth.welcome`. This way we can easily "override" some notifications, for example,
+ * we can have `echo.mention`, and the `echo.mention` could supersede `mediawiki.mention`. Also,
+ * it will be more difficult for notifications to conflict, and we will be able to easily filter
+ * apply logic depends on the namespace (for example, hide if extension not present).
*
* @var string Required, Read-only - The Notification type
*/
@@ -32,7 +32,7 @@ class Notification {
private array $custom;
/**
- * Base for Notifications. Type is the only required property and any additional data can be
+ * Base for Notifications. Type is the only required property, and any additional data can be
* passed via $custom array.
*
* @see WikiNotification in case you want a Notification with Agent and Title
@@ -46,8 +46,7 @@ class Notification {
}
/**
- * Get Notification type
- * @return string
+ * Get the Notification type
*/
public function getType(): string {
return $this->type;
@@ -62,7 +61,6 @@ class Notification {
*
* @param string $key
* @param scalar|array|JsonCodecable $value
- * @return void
*/
public function setProperty( string $key, $value ): void {
$this->custom[$key] = $value;
@@ -70,7 +68,6 @@ class Notification {
/**
* Retrieve Notification properties
- * @return array
*/
public function getProperties(): array {
return $this->custom;
diff --git a/includes/Notification/NotificationEnvelope.php b/includes/Notification/NotificationEnvelope.php
index a11f88ae1e3f..718e73fdced2 100644
--- a/includes/Notification/NotificationEnvelope.php
+++ b/includes/Notification/NotificationEnvelope.php
@@ -26,9 +26,6 @@ class NotificationEnvelope {
/**
* Syntax sugar, allows easy check if two envelopes point to the same thing
- *
- * @param NotificationEnvelope $envelope
- * @return bool
*/
public function equals( NotificationEnvelope $envelope ): bool {
return $envelope === $this;
@@ -39,8 +36,6 @@ class NotificationEnvelope {
*
* Utility method for a very common check where middleware filters Notifications from
* specific agent.
- *
- * @return bool
*/
public function hasAgent(): bool {
return $this->notification instanceof AgentAware;
diff --git a/includes/Notification/NotificationMiddlewareInterface.php b/includes/Notification/NotificationMiddlewareInterface.php
index 4957e2728223..9ff7c097547e 100644
--- a/includes/Notification/NotificationMiddlewareInterface.php
+++ b/includes/Notification/NotificationMiddlewareInterface.php
@@ -12,7 +12,6 @@ interface NotificationMiddlewareInterface {
*
* @param NotificationsBatch $batch
* @param callable():void $next Call this method to continue the chain
- * @return void
*/
public function handle( NotificationsBatch $batch, callable $next ): void;
diff --git a/includes/Notification/NotificationsBatch.php b/includes/Notification/NotificationsBatch.php
index f7963cd6edd8..06d68cd16cf3 100644
--- a/includes/Notification/NotificationsBatch.php
+++ b/includes/Notification/NotificationsBatch.php
@@ -30,7 +30,6 @@ class NotificationsBatch implements Countable, IteratorAggregate {
/**
* @param callable(NotificationEnvelope): bool $callback Filter, return true to preserve the $envelope
- * @return void
*/
public function filter( $callback ): void {
$this->envelopes =
diff --git a/includes/Notification/TitleAware.php b/includes/Notification/TitleAware.php
index 0727514d9c8e..5c77f1ac5455 100644
--- a/includes/Notification/TitleAware.php
+++ b/includes/Notification/TitleAware.php
@@ -14,7 +14,6 @@ interface TitleAware {
/**
* Get the PageIdentity of the related page
- * @return PageIdentity
*/
public function getTitle(): PageIdentity;