@@ -66,7 +66,7 @@ class Push {
6666 */
6767 protected array $ userStatuses = [];
6868 /**
69- * @psalm-var array<string, list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, appTypes : string, activated: bool, activation_token: string}>>
69+ * @psalm-var array<string, list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, app_types : string, activated: bool, activation_token: string}>>
7070 */
7171 protected array $ userWebPushDevices = [];
7272 /**
@@ -175,23 +175,20 @@ public function flushPayloads(): void {
175175 }
176176
177177 /**
178- * @param array $devices
179- * @psalm-param $devices list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, appTypes: string, activated: bool, activation_token: string}>
180- * @param string $app
181- * @return array
182- * @psalm-return list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, appTypes: string, activated: bool, activation_token: string}>
178+ * @psalm-param list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, app_types: string, activated: bool, activation_token: string}> $devices
179+ * @psalm-return list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, app_types: string, activated: bool, activation_token: string}>
183180 */
184181 public function filterWebPushDeviceList (array $ devices , string $ app ): array {
185182 // Consider all 3 options as 'talk'
186183 if (\in_array ($ app , ['spreed ' , 'talk ' , 'admin_notification_talk ' ], true )) {
187184 $ app = 'talk ' ;
188185 }
189186
190- return array_filter ($ devices , function ($ device ) use ($ app ) {
187+ return array_values ( array_filter ($ devices , function ($ device ) use ($ app ) {
191188 $ appTypes = explode (', ' , $ device ['app_types ' ]);
192189 return $ device ['activated ' ] && (\in_array ($ app , $ appTypes )
193190 || (\in_array ('all ' , $ appTypes ) && !\in_array ('- ' . $ app , $ appTypes )));
194- });
191+ })) ;
195192 }
196193
197194
@@ -299,6 +296,9 @@ public function pushToDevice(int $id, INotification $notification, ?OutputInterf
299296 $ this ->proxyPushToDevice ($ id , $ user , $ proxyDevices , $ notification , $ output );
300297 }
301298
299+ /**
300+ * @param list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, app_types: string, activated: bool, activation_token: string}> $devices
301+ */
302302 public function webPushToDevice (int $ id , IUser $ user , array $ devices , INotification $ notification , ?OutputInterface $ output = null ): void {
303303 if (empty ($ devices )) {
304304 $ this ->printInfo ('<comment>No web push devices found for user</comment> ' );
@@ -1042,7 +1042,7 @@ protected function getProxyDevicesForUsers(array $userIds): array {
10421042
10431043 /**
10441044 * @param string $uid
1045- * @return list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, appTypes : string, activated: bool, activation_token: string}>
1045+ * @return list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, app_types : string, activated: bool, activation_token: string}>
10461046 */
10471047 protected function getWebPushDevicesForUser (string $ uid ): array {
10481048 $ query = $ this ->db ->getQueryBuilder ();
@@ -1051,6 +1051,7 @@ protected function getWebPushDevicesForUser(string $uid): array {
10511051 ->where ($ query ->expr ()->eq ('uid ' , $ query ->createNamedParameter ($ uid )));
10521052
10531053 $ result = $ query ->executeQuery ();
1054+ /** @var list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, app_types: string, activated: bool, activation_token: string}> $devices */
10541055 $ devices = $ result ->fetchAll ();
10551056 $ result ->closeCursor ();
10561057
@@ -1059,7 +1060,7 @@ protected function getWebPushDevicesForUser(string $uid): array {
10591060
10601061 /**
10611062 * @param string[] $userIds
1062- * @return array<string, list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, appTypes : string, activated: bool, activation_token: string}>>
1063+ * @return array<string, list<array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, app_types : string, activated: bool, activation_token: string}>>
10631064 */
10641065 protected function getWebPushDevicesForUsers (array $ userIds ): array {
10651066 $ query = $ this ->db ->getQueryBuilder ();
@@ -1070,6 +1071,7 @@ protected function getWebPushDevicesForUsers(array $userIds): array {
10701071 $ devices = [];
10711072 $ result = $ query ->executeQuery ();
10721073 while ($ row = $ result ->fetch ()) {
1074+ /** @psalm-var array{id: int, uid: string, token: int, endpoint: string, ua_public: string, auth: string, app_types: string, activated: bool, activation_token: string} $row */
10731075 if (!isset ($ devices [$ row ['uid ' ]])) {
10741076 $ devices [$ row ['uid ' ]] = [];
10751077 }
0 commit comments