[TOOLS] Continue raising PHPStan level to 6
This commit is contained in:
@@ -71,10 +71,10 @@ class Notification extends Component
|
||||
* Example of $targets:
|
||||
* [42, $actor_alice, $actor_bob] // Avoid repeating actors or ids
|
||||
*
|
||||
* @param Actor $sender The one responsible for this activity, take care not to include it in targets
|
||||
* @param Activity $activity The activity responsible for the object being given to known to targets
|
||||
* @param array $targets Attentions, Mentions, any other source. Should never be empty, you usually want to register an attention to every $sender->getSubscribers()
|
||||
* @param null|string $reason An optional reason explaining why this notification exists
|
||||
* @param Actor $sender The one responsible for this activity, take care not to include it in targets
|
||||
* @param Activity $activity The activity responsible for the object being given to known to targets
|
||||
* @param non-empty-array<Actor|int> $targets Attentions, Mentions, any other source. Should never be empty, you usually want to register an attention to every $sender->getSubscribers()
|
||||
* @param null|string $reason An optional reason explaining why this notification exists
|
||||
*/
|
||||
public function onNewNotification(Actor $sender, Activity $activity, array $targets, ?string $reason = null): EventResult
|
||||
{
|
||||
@@ -103,12 +103,19 @@ class Notification extends Component
|
||||
return Event::next;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed[] $retry_args
|
||||
*/
|
||||
public function onQueueNotificationLocal(Actor $sender, Activity $activity, Actor $target, ?string $reason, array &$retry_args): EventResult
|
||||
{
|
||||
// TODO: use https://symfony.com/doc/current/notifier.html
|
||||
return Event::stop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Actor[] $targets
|
||||
* @param mixed[] $retry_args
|
||||
*/
|
||||
public function onQueueNotificationRemote(Actor $sender, Activity $activity, array $targets, ?string $reason, array &$retry_args): EventResult
|
||||
{
|
||||
if (FreeNetwork::notify($sender, $activity, $targets, $reason)) {
|
||||
@@ -122,7 +129,9 @@ class Notification extends Component
|
||||
* Bring given Activity to Targets' knowledge.
|
||||
* This will flush a Notification to DB.
|
||||
*
|
||||
* @return true if successful, false otherwise
|
||||
* @param Actor[] $targets
|
||||
*
|
||||
* @return bool true if successful, false otherwise
|
||||
*/
|
||||
public static function notify(Actor $sender, Activity $activity, array $targets, ?string $reason = null): bool
|
||||
{
|
||||
@@ -134,7 +143,7 @@ class Notification extends Component
|
||||
continue;
|
||||
}
|
||||
if (Event::handle('NewNotificationShould', [$activity, $target]) === Event::next) {
|
||||
if ($sender->getId() === $target->getId()
|
||||
if ($sender->getId() === $target->getId()
|
||||
|| $activity->getActorId() === $target->getId()) {
|
||||
// The target already knows about this, no need to bother with a notification
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user