From c0589715c104763d987df68f12cc97abc05d85ee Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Tue, 14 Feb 2023 11:26:47 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B04756=20-=20Ease=20extensibility=20for=20?= =?UTF-8?q?CRUD=20operations=20:=20Event=20Service=20-=20Fix=20RegisterLis?= =?UTF-8?q?tener()=20signature=20and=20calls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/compiler.class.inc.php | 2 +- sources/Application/Service/Events/EventService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index f0dbda64e..e66f9ad9b 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -3784,7 +3784,7 @@ EOF; $sEventSource = $aListener['source']; $sContext = $aListener['context']; $sRank = $aListener['rank']; - $sRegister .= "\nCombodo\iTop\Service\Events\EventService::RegisterListener(\"$sEventName\", '$sClassName::$sCallback', $sEventSource, null, $sContext, $sRank, '$sModuleId');"; + $sRegister .= "\nCombodo\iTop\Service\Events\EventService::RegisterListener(\"$sEventName\", '$sClassName::$sCallback', $sEventSource, [], $sContext, $sRank, '$sModuleId');"; $sCallbackFct = $aListener['content']; $sMethods .= "\n $sCallbackFct\n\n"; } diff --git a/sources/Application/Service/Events/EventService.php b/sources/Application/Service/Events/EventService.php index f88d0eac9..877dd9b50 100644 --- a/sources/Application/Service/Events/EventService.php +++ b/sources/Application/Service/Events/EventService.php @@ -64,7 +64,7 @@ final class EventService * @return string Id of the registration * */ - public static function RegisterListener(string $sEvent, callable $callback, $sEventSource = null, $aCallbackData = [], $context = null, float $fPriority = 0.0, $sModuleId = ''): string + public static function RegisterListener(string $sEvent, callable $callback, $sEventSource = null, array $aCallbackData = [], $context = null, float $fPriority = 0.0, $sModuleId = ''): string { if (!is_callable($callback, false, $sName)) { return false;