comparison plugins/libcalendaring/libvcalendar.php @ 58:082a19037887 default tip

More cleaning up php8 Warnings/deprecations
author Charlie Root
date Wed, 15 Oct 2025 14:06:01 -0400
parents 91f005a4f7e9
children
comparison
equal deleted inserted replaced
57:ade98a608cd3 58:082a19037887
1378 } 1378 }
1379 1379
1380 1380
1381 /*** Implement PHP 5 Iterator interface to make foreach work ***/ 1381 /*** Implement PHP 5 Iterator interface to make foreach work ***/
1382 1382
1383 function current() 1383 function current(): mixed
1384 { 1384 {
1385 return $this->objects[$this->iteratorkey]; 1385 return $this->objects[$this->iteratorkey];
1386 } 1386 }
1387 1387
1388 function key() 1388 function key(): mixed
1389 { 1389 {
1390 return $this->iteratorkey; 1390 return $this->iteratorkey;
1391 } 1391 }
1392 1392
1393 #[ReturnTypeWillChange]
1393 function next() 1394 function next()
1395 # HST: should be void per Iterator, but returns a value, and e.g.
1396 # libcalendaring_recurrence uses it:
1397 # 146: while (($next = $this->next()
1394 { 1398 {
1395 $this->iteratorkey++; 1399 $this->iteratorkey++;
1396 1400
1397 // read next chunk if we're reading from a file 1401 // read next chunk if we're reading from a file
1398 if (!$this->objects[$this->iteratorkey] && $this->fp) { 1402 if (!$this->objects[$this->iteratorkey] && $this->fp) {
1400 } 1404 }
1401 1405
1402 return $this->valid(); 1406 return $this->valid();
1403 } 1407 }
1404 1408
1405 function rewind() 1409 function rewind(): void
1406 { 1410 {
1407 $this->iteratorkey = 0; 1411 $this->iteratorkey = 0;
1408 } 1412 }
1409 1413
1410 function valid() 1414 function valid(): bool
1411 { 1415 {
1412 return !empty($this->objects[$this->iteratorkey]); 1416 return !empty($this->objects[$this->iteratorkey]);
1413 } 1417 }
1414 1418
1415 } 1419 }