[CORE][Event] Make all events return \EventResult, enforced at container build time
This commit is contained in:
@@ -34,6 +34,7 @@ use App\Entity\Note;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\ClientException;
|
||||
use DateTime;
|
||||
use EventResult;
|
||||
use Plugin\ActivityPub\Entity\ActivitypubActivity;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
@@ -135,7 +136,7 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
*
|
||||
* @return bool Event hook
|
||||
*/
|
||||
public function onAddRoute(Router $r)
|
||||
public function onAddRoute(Router $r): EventResult
|
||||
{
|
||||
$r->connect(id: 'delete_note_action', uri_path: '/object/note/{note_id<\d+>}/delete', target: Controller\DeleteNote::class);
|
||||
|
||||
@@ -154,7 +155,7 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
*
|
||||
* @return bool Event hook
|
||||
*/
|
||||
public function onAddExtraNoteActions(Request $request, Note $note, array &$actions)
|
||||
public function onAddExtraNoteActions(Request $request, Note $note, array &$actions): EventResult
|
||||
{
|
||||
if (\is_null($actor = Common::actor())) {
|
||||
return Event::next;
|
||||
@@ -227,7 +228,7 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
*
|
||||
* @return bool Returns `Event::stop` if handled, `Event::next` otherwise
|
||||
*/
|
||||
public function onNewActivityPubActivity(Actor $actor, AbstractObject $type_activity, AbstractObject $type_object, ?ActivitypubActivity &$ap_act): bool
|
||||
public function onNewActivityPubActivity(Actor $actor, AbstractObject $type_activity, AbstractObject $type_object, ?ActivitypubActivity &$ap_act): EventResult
|
||||
{
|
||||
return $this->activitypub_handler($actor, $type_activity, $type_object, $ap_act);
|
||||
}
|
||||
@@ -242,7 +243,7 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
*
|
||||
* @return bool Returns `Event::stop` if handled, `Event::next` otherwise
|
||||
*/
|
||||
public function onNewActivityPubActivityWithObject(Actor $actor, AbstractObject $type_activity, mixed $type_object, ?ActivitypubActivity &$ap_act): bool
|
||||
public function onNewActivityPubActivityWithObject(Actor $actor, AbstractObject $type_activity, mixed $type_object, ?ActivitypubActivity &$ap_act): EventResult
|
||||
{
|
||||
return $this->activitypub_handler($actor, $type_activity, $type_object, $ap_act);
|
||||
}
|
||||
@@ -255,7 +256,7 @@ class DeleteNote extends NoteHandlerPlugin
|
||||
*
|
||||
* @return bool Returns `Event::stop` if handled, `Event::next` otherwise
|
||||
*/
|
||||
public function onGSVerbToActivityStreamsTwoActivityType(string $verb, ?string &$gs_verb_to_activity_stream_two_verb): bool
|
||||
public function onGSVerbToActivityStreamsTwoActivityType(string $verb, ?string &$gs_verb_to_activity_stream_two_verb): EventResult
|
||||
{
|
||||
if ($verb === 'delete') {
|
||||
$gs_verb_to_activity_stream_two_verb = 'Delete';
|
||||
|
Reference in New Issue
Block a user