diff --git a/components/FreeNetwork/Util/LinkHeader.php b/components/FreeNetwork/Util/LinkHeader.php index 85467fa4d1..74ee8dac25 100644 --- a/components/FreeNetwork/Util/LinkHeader.php +++ b/components/FreeNetwork/Util/LinkHeader.php @@ -71,7 +71,7 @@ class LinkHeader $this->type = null; // remove uri-reference from header - $str = mb_substr($str, \mb_strlen($uri_reference[0])); + $str = mb_substr($str, mb_strlen($uri_reference[0])); // parse link-params $params = explode(';', $str); @@ -124,6 +124,5 @@ class LinkHeader } } } - } } diff --git a/plugins/DeleteNote/DeleteNote.php b/plugins/DeleteNote/DeleteNote.php index bdad033655..b85a6d19fb 100644 --- a/plugins/DeleteNote/DeleteNote.php +++ b/plugins/DeleteNote/DeleteNote.php @@ -1,6 +1,6 @@ 'delete', 'object_type' => 'note', 'object_id' => $note->getId()], return_null: true))) { + if (\is_null(DB::findOneBy(Activity::class, ['verb' => 'delete', 'object_type' => 'note', 'object_id' => $note->getId()], return_null: true))) { // If none found, then undertaker has a job to do return self::undertaker($actor, $note); } else { @@ -130,8 +119,6 @@ class DeleteNote extends NoteHandlerPlugin * Adds and connects the _delete_note_action_ route to * Controller\DeleteNote::class * - * @param \App\Core\Router\RouteLoader $r - * * @return bool Event hook */ public function onAddRoute(RouteLoader $r) @@ -147,31 +134,28 @@ class DeleteNote extends NoteHandlerPlugin * Adds an anchor link to the route _delete_note_action_ in the **Note card * template**. More specifically, in the **note_actions block**. * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \App\Entity\Note $note - * @param array $actions - * - * @return bool Event hook * @throws \App\Util\Exception\DuplicateFoundException * @throws \App\Util\Exception\NotFoundException * @throws \App\Util\Exception\ServerException + * + * @return bool Event hook */ public function onAddExtraNoteActions(Request $request, Note $note, array &$actions) { - if (is_null($actor = Common::actor())) { + if (\is_null($actor = Common::actor())) { return Event::next; } // Only add action if note wasn't already deleted! - if (is_null(DB::findOneBy(Activity::class, ['verb' => 'delete', 'object_type' => 'note', 'object_id' => $note->getId()], return_null: true)) + if (\is_null(DB::findOneBy(Activity::class, ['verb' => 'delete', 'object_type' => 'note', 'object_id' => $note->getId()], return_null: true)) // And has permissions && $actor->canAdmin($note->getActor())) { $delete_action_url = Router::url('delete_note_action', ['note_id' => $note->getId()]); - $query_string = $request->getQueryString(); + $query_string = $request->getQueryString(); $delete_action_url .= '?from=' . mb_substr($query_string, 2); $actions[] = [ - 'title' => _m('Delete note'), + 'title' => _m('Delete note'), 'classes' => '', - 'url' => $delete_action_url, + 'url' => $delete_action_url, ]; } @@ -190,7 +174,7 @@ class DeleteNote extends NoteHandlerPlugin * * @return bool Returns `Event::stop` if handled, `Event::next` otherwise */ - private function activitypub_handler(Actor $actor, \ActivityPhp\Type\AbstractObject $type_activity, mixed $type_object, ?\Plugin\ActivityPub\Entity\ActivitypubActivity &$ap_act): bool + private function activitypub_handler(Actor $actor, AbstractObject $type_activity, mixed $type_object, ?ActivitypubActivity &$ap_act): bool { if ($type_activity->get('type') !== 'Delete' || !($type_object instanceof Note)) { @@ -221,7 +205,7 @@ class DeleteNote extends NoteHandlerPlugin * * @return bool Returns `Event::stop` if handled, `Event::next` otherwise */ - public function onNewActivityPubActivity(Actor $actor, \ActivityPhp\Type\AbstractObject $type_activity, \ActivityPhp\Type\AbstractObject $type_object, ?\Plugin\ActivityPub\Entity\ActivitypubActivity &$ap_act): bool + public function onNewActivityPubActivity(Actor $actor, AbstractObject $type_activity, AbstractObject $type_object, ?ActivitypubActivity &$ap_act): bool { return $this->activitypub_handler($actor, $type_activity, $type_object, $ap_act); } @@ -236,7 +220,7 @@ class DeleteNote extends NoteHandlerPlugin * * @return bool Returns `Event::stop` if handled, `Event::next` otherwise */ - public function onNewActivityPubActivityWithObject(Actor $actor, \ActivityPhp\Type\AbstractObject $type_activity, mixed $type_object, ?\Plugin\ActivityPub\Entity\ActivitypubActivity &$ap_act): bool + public function onNewActivityPubActivityWithObject(Actor $actor, AbstractObject $type_activity, mixed $type_object, ?ActivitypubActivity &$ap_act): bool { return $this->activitypub_handler($actor, $type_activity, $type_object, $ap_act); } diff --git a/plugins/RepeatNote/Entity/NoteRepeat.php b/plugins/RepeatNote/Entity/NoteRepeat.php index e38c370c45..6685b062d2 100644 --- a/plugins/RepeatNote/Entity/NoteRepeat.php +++ b/plugins/RepeatNote/Entity/NoteRepeat.php @@ -76,9 +76,7 @@ class NoteRepeat extends Entity return $this->repeat_of; } - /** - * @param Note $note * @return bool Returns true if Note provided is a repeat of another Note */ public static function isNoteRepeat(Note $note): bool diff --git a/src/Util/Bitmap.php b/src/Util/Bitmap.php index a4c15d65aa..3565aa2b05 100644 --- a/src/Util/Bitmap.php +++ b/src/Util/Bitmap.php @@ -89,6 +89,6 @@ abstract class Bitmap public static function isValue(int $value): bool { - return in_array($value, (new ReflectionClass(static::class))->getConstants()); + return \in_array($value, (new ReflectionClass(static::class))->getConstants()); } }