[CORE][Event] Make all events return \EventResult, enforced at container build time

This commit is contained in:
2022-04-03 21:40:32 +01:00
parent aef1fac536
commit d4b7e990ce
60 changed files with 345 additions and 239 deletions

View File

@@ -26,6 +26,7 @@ use App\Core\Modules\Plugin;
use App\Entity\Note;
use App\Util\Common;
use App\Util\Formatting;
use EventResult;
use Symfony\Component\HttpFoundation\Request;
class TreeNotes extends Plugin
@@ -34,7 +35,7 @@ class TreeNotes extends Plugin
* Formatting notes without taking a direct reply out of context
* Show whole conversation in conversation related routes.
*/
public function onFormatNoteList(array $notes_in, array &$notes_out, Request $request)
public function onFormatNoteList(array $notes_in, array &$notes_out, Request $request): EventResult
{
if (str_starts_with($request->get('_route'), 'conversation')) {
$parents = $this->conversationFormat($notes_in);
@@ -42,6 +43,7 @@ class TreeNotes extends Plugin
} else {
$notes_out = $this->feedFormatTree($notes_in);
}
return Event::stop;
}
/**
@@ -122,7 +124,7 @@ class TreeNotes extends Plugin
];
}
public function onAppendNoteBlock(Request $request, array $conversation, array &$res): bool
public function onAppendNoteBlock(Request $request, array $conversation, array &$res): EventResult
{
if (\array_key_exists('replies', $conversation)) {
$res[] = Formatting::twigRenderFile(