[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

@@ -32,6 +32,7 @@ use App\Util\Exception\ServerException;
use App\Util\Exception\TemporaryFileException;
use App\Util\Formatting;
use App\Util\TemporaryFile;
use EventResult;
use Exception;
use Jcupitt\Vips;
use SplFileInfo;
@@ -59,7 +60,7 @@ class ImageEncoder extends Plugin
return GSFile::mimetypeMajor($mimetype) === 'image';
}
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;
@@ -68,7 +69,7 @@ class ImageEncoder extends Plugin
return Event::next;
}
public function onFileSanitizerAvailable(array &$event_map, string $mimetype): bool
public function onFileSanitizerAvailable(array &$event_map, string $mimetype): EventResult
{
if (!self::shouldHandle($mimetype)) {
return Event::next;
@@ -77,7 +78,7 @@ class ImageEncoder extends Plugin
return Event::next;
}
public function onFileResizerAvailable(array &$event_map, string $mimetype): bool
public function onFileResizerAvailable(array &$event_map, string $mimetype): EventResult
{
if (!self::shouldHandle($mimetype)) {
return Event::next;
@@ -179,7 +180,7 @@ class ImageEncoder extends Plugin
/**
* Generates the view for attachments of type Image
*/
public function onViewAttachment(array $vars, array &$res): bool
public function onViewAttachment(array $vars, array &$res): EventResult
{
if (!self::shouldHandle($vars['attachment']->getMimetype())) {
return Event::next;
@@ -260,7 +261,7 @@ class ImageEncoder extends Plugin
*
* @return bool true hook value
*/
public function onPluginVersion(array &$versions): bool
public function onPluginVersion(array &$versions): EventResult
{
$versions[] = [
'name' => 'ImageEncoder',