[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

@@ -42,6 +42,7 @@ use App\Util\Exception\ServerException;
use App\Util\Exception\TemporaryFileException;
use App\Util\Formatting;
use App\Util\TemporaryFile;
use EventResult;
use Exception;
use FFMpeg\FFMpeg as ffmpeg;
use FFMpeg\FFProbe as ffprobe;
@@ -59,7 +60,7 @@ class VideoEncoder extends Plugin
return GSFile::mimetypeMajor($mimetype) === 'video' || $mimetype === 'image/gif';
}
public function onFileMetaAvailable(array &$event_map, string $mimetype): bool
public function onFileMetaAvailable(array &$event_map, string $mimetype): EventResult
{
if (!self::shouldHandle($mimetype)) {
return Event::next;
@@ -69,7 +70,7 @@ class VideoEncoder extends Plugin
return Event::next;
}
public function onFileSanitizerAvailable(array &$event_map, string $mimetype): bool
public function onFileSanitizerAvailable(array &$event_map, string $mimetype): EventResult
{
if ($mimetype !== 'image/gif') {
return Event::next;
@@ -79,7 +80,7 @@ class VideoEncoder extends Plugin
return Event::next;
}
public function onFileResizerAvailable(array &$event_map, string $mimetype): bool
public function onFileResizerAvailable(array &$event_map, string $mimetype): EventResult
{
if ($mimetype !== 'image/gif') {
return Event::next;
@@ -139,7 +140,7 @@ class VideoEncoder extends Plugin
/**
* Generates the view for attachments of type Video
*/
public function onViewAttachment(array $vars, array &$res): bool
public function onViewAttachment(array $vars, array &$res): EventResult
{
if ($vars['attachment']->getMimetypeMajor() !== 'video') {
return Event::next;
@@ -289,7 +290,7 @@ class VideoEncoder extends Plugin
/**
* @throws ServerException
*/
public function onPluginVersion(array &$versions): bool
public function onPluginVersion(array &$versions): EventResult
{
$versions[] = ['name' => 'FFmpeg',
'version' => self::version(),