66
77use daos \DatabaseInterface ;
88use daos \ItemOptions ;
9- use DateTime ;
109use DateTimeImmutable ;
1110use helpers \Configuration ;
1211use helpers \HtmlString ;
@@ -206,9 +205,9 @@ public function updateLastSeen(array $itemIds): void {
206205 /**
207206 * cleanup orphaned and old items
208207 *
209- * @param ?DateTime $date date to delete all items older than this value
208+ * @param ?DateTimeImmutable $date date to delete all items older than this value
210209 */
211- public function cleanup (?DateTime $ date ): void {
210+ public function cleanup (?DateTimeImmutable $ date ): void {
212211 $ this ->database ->exec ('DELETE FROM ' . $ this ->configuration ->dbPrefix . 'items
213212 WHERE source NOT IN (
214213 SELECT id FROM ' . $ this ->configuration ->dbPrefix . 'sources) ' );
@@ -226,7 +225,7 @@ public function cleanup(?DateTime $date): void {
226225 *
227226 * @param ItemOptions $options search, offset and filter params
228227 *
229- * @return array<array{id: int, datetime: DateTime , title: string, content: string, unread: bool, starred: bool, source: int, thumbnail: string, icon: string, uid: string, link: string, updatetime: DateTime , author: string, sourcetitle: string, tags: string[]}> items as array
228+ * @return array<array{id: int, datetime: DateTimeImmutable , title: string, content: string, unread: bool, starred: bool, source: int, thumbnail: string, icon: string, uid: string, link: string, updatetime: DateTimeImmutable , author: string, sourcetitle: string, tags: string[]}> items as array
230229 */
231230 public function get (ItemOptions $ options ): array {
232231 $ params = [];
@@ -375,12 +374,12 @@ public function hasMore(): bool {
375374 * Obtain new or changed items in the database for synchronization with clients.
376375 *
377376 * @param int $sinceId id of last seen item
378- * @param DateTime $notBefore cut off time stamp
379- * @param DateTime $since timestamp of last seen item
377+ * @param DateTimeImmutable $notBefore cut off time stamp
378+ * @param DateTimeImmutable $since timestamp of last seen item
380379 *
381- * @return array<array{id: int, datetime: DateTime , title: string, content: string, unread: bool, starred: bool, source: int, thumbnail: string, icon: string, uid: string, link: string, updatetime: DateTime , author: string, sourcetitle: string, tags: string[]}> of items
380+ * @return array<array{id: int, datetime: DateTimeImmutable , title: string, content: string, unread: bool, starred: bool, source: int, thumbnail: string, icon: string, uid: string, link: string, updatetime: DateTimeImmutable , author: string, sourcetitle: string, tags: string[]}> of items
382381 */
383- public function sync (int $ sinceId , DateTime $ notBefore , DateTime $ since , int $ howMany ): array {
382+ public function sync (int $ sinceId , DateTimeImmutable $ notBefore , DateTimeImmutable $ since , int $ howMany ): array {
384383 $ query = 'SELECT
385384 items.id, datetime, items.title AS title, content, unread, starred, source, thumbnail, icon, uid, link, updatetime, author, sources.title as sourcetitle, sources.tags as tags
386385 FROM ' . $ this ->configuration ->dbPrefix . 'items AS items, ' . $ this ->configuration ->dbPrefix . 'sources AS sources
@@ -575,11 +574,11 @@ public function lastUpdate(): ?DateTimeImmutable {
575574 /**
576575 * returns the statuses of items last update
577576 *
578- * @param DateTime $since minimal date of returned items
577+ * @param DateTimeImmutable $since minimal date of returned items
579578 *
580579 * @return array<array{id: int, unread: bool, starred: bool}> of unread, starred, etc. status of specified items
581580 */
582- public function statuses (DateTime $ since ): array {
581+ public function statuses (DateTimeImmutable $ since ): array {
583582 $ res = $ this ->database ->exec (
584583 'SELECT id, unread, starred
585584 FROM ' . $ this ->configuration ->dbPrefix . 'items
@@ -627,7 +626,7 @@ public function bulkStatusUpdate(array $statuses): void {
627626
628627 // sanitize update time
629628 if (array_key_exists ('datetime ' , $ status )) {
630- $ updateDate = new \DateTime ($ status ['datetime ' ]);
629+ $ updateDate = new \DateTimeImmutable ($ status ['datetime ' ]);
631630 } else {
632631 $ updateDate = null ;
633632 }
0 commit comments