[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

@@ -47,6 +47,7 @@ use Component\Attachment\Entity\AttachmentToNote;
use Component\Conversation\Conversation;
use Component\Language\Entity\Language;
use Component\Notification\Entity\Attention;
use EventResult;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request;
@@ -54,7 +55,7 @@ class Posting extends Component
{
public const route = 'posting_form_action';
public function onAddRoute(Router $r): bool
public function onAddRoute(Router $r): EventResult
{
$r->connect(self::route, '/form/posting', Controller\Posting::class);
return Event::next;
@@ -70,7 +71,7 @@ class Posting extends Component
* @throws RedirectException
* @throws ServerException
*/
public function onAddMainRightPanelBlock(Request $request, array &$res): bool
public function onAddMainRightPanelBlock(Request $request, array &$res): EventResult
{
if (\is_null($user = Common::user()) || preg_match('(feed|conversation|group|view)', $request->get('_route')) === 0) {
return Event::next;
@@ -298,7 +299,7 @@ class Posting extends Component
return [$activity, $note, $effective_attentions];
}
public function onRenderNoteContent(string $content, string $content_type, ?string &$rendered, Actor $author, ?string $language = null, array &$mentions = [])
public function onRenderNoteContent(string $content, string $content_type, ?string &$rendered, Actor $author, ?string $language = null, array &$mentions = []): EventResult
{
switch ($content_type) {
case 'text/plain':