@@ -94,7 +94,7 @@ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
9494 if ($ this ->activityManager ->isFormattingFilteredObject ()) {
9595 try {
9696 return $ this ->parseShortVersion ($ event , $ previousEvent );
97- } catch (\ InvalidArgumentException $ e ) {
97+ } catch (UnknownActivityException ) {
9898 // Ignore and simply use the long version...
9999 }
100100 }
@@ -114,10 +114,10 @@ protected function setIcon(IEvent $event, string $icon, string $app = 'files') {
114114 * @param IEvent $event
115115 * @param IEvent|null $previousEvent
116116 * @return IEvent
117- * @throws \InvalidArgumentException
117+ * @throws UnknownActivityException
118118 * @since 11.0.0
119119 */
120- public function parseShortVersion (IEvent $ event , ?IEvent $ previousEvent = null ) {
120+ public function parseShortVersion (IEvent $ event , ?IEvent $ previousEvent = null ): IEvent {
121121 $ parsedParameters = $ this ->getParameters ($ event );
122122
123123 if ($ event ->getSubject () === 'created_by ' ) {
@@ -139,7 +139,7 @@ public function parseShortVersion(IEvent $event, ?IEvent $previousEvent = null)
139139 $ subject = $ this ->l ->t ('Moved by {user} ' );
140140 $ this ->setIcon ($ event , 'change ' );
141141 } else {
142- throw new \ InvalidArgumentException ();
142+ throw new UnknownActivityException ();
143143 }
144144
145145 if (!isset ($ parsedParameters ['user ' ])) {
@@ -156,10 +156,10 @@ public function parseShortVersion(IEvent $event, ?IEvent $previousEvent = null)
156156 * @param IEvent $event
157157 * @param IEvent|null $previousEvent
158158 * @return IEvent
159- * @throws \InvalidArgumentException
159+ * @throws UnknownActivityException
160160 * @since 11.0.0
161161 */
162- public function parseLongVersion (IEvent $ event , ?IEvent $ previousEvent = null ) {
162+ public function parseLongVersion (IEvent $ event , ?IEvent $ previousEvent = null ): IEvent {
163163 $ this ->fileIsEncrypted = false ;
164164 $ parsedParameters = $ this ->getParameters ($ event );
165165
@@ -253,7 +253,7 @@ public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) {
253253 $ subject = $ this ->l ->t ('{user} moved {oldfile} to {newfile} ' );
254254 $ this ->setIcon ($ event , 'change ' );
255255 } else {
256- throw new \ InvalidArgumentException ();
256+ throw new UnknownActivityException ();
257257 }
258258
259259 if ($ this ->fileIsEncrypted ) {
@@ -292,9 +292,9 @@ protected function setSubjects(IEvent $event, string $subject, array $parameters
292292 /**
293293 * @param IEvent $event
294294 * @return array
295- * @throws \InvalidArgumentException
295+ * @throws UnknownActivityException
296296 */
297- protected function getParameters (IEvent $ event ) {
297+ protected function getParameters (IEvent $ event ): array {
298298 $ parameters = $ event ->getSubjectParameters ();
299299 switch ($ event ->getSubject ()) {
300300 case 'created_self ' :
@@ -347,9 +347,9 @@ protected function getParameters(IEvent $event) {
347347 * @param array|string $parameter
348348 * @param IEvent|null $event
349349 * @return array
350- * @throws \InvalidArgumentException
350+ * @throws UnknownActivityException
351351 */
352- protected function getFile ($ parameter , ?IEvent $ event = null ) {
352+ protected function getFile ($ parameter , ?IEvent $ event = null ): array {
353353 if (is_array ($ parameter )) {
354354 $ path = reset ($ parameter );
355355 $ id = (string )key ($ parameter );
@@ -358,7 +358,7 @@ protected function getFile($parameter, ?IEvent $event = null) {
358358 $ path = $ parameter ;
359359 $ id = $ event ->getObjectId ();
360360 } else {
361- throw new \ InvalidArgumentException ('Could not generate file parameter ' );
361+ throw new UnknownActivityException ('Could not generate file parameter ' );
362362 }
363363
364364 $ encryptionContainer = $ this ->getEndToEndEncryptionContainer ($ id , $ path );
0 commit comments