Skip to content

Commit 2bdf93b

Browse files
committed
Declare return types for font collection iterator methods
This also modifies the return of the `next` method to be null as defined by the interface.
1 parent 8a96df1 commit 2bdf93b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/FontLib/TrueType/Collection.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Collection extends BinaryStream implements Iterator, Countable {
3030
protected $version;
3131
protected $numFonts;
3232

33-
function parse() {
33+
function parse() : void {
3434
if (isset($this->numFonts)) {
3535
return;
3636
}
@@ -51,7 +51,7 @@ function parse() {
5151
* @throws OutOfBoundsException
5252
* @return File
5353
*/
54-
function getFont($fontId) {
54+
function getFont($fontId) : File {
5555
$this->parse();
5656

5757
if (!isset($this->collectionOffsets[$fontId])) {
@@ -69,29 +69,29 @@ function getFont($fontId) {
6969
return $this->collection[$fontId] = $font;
7070
}
7171

72-
function current() {
72+
function current() : File {
7373
return $this->getFont($this->position);
7474
}
7575

76-
function key() {
76+
function key() : int {
7777
return $this->position;
7878
}
7979

80-
function next() {
81-
return ++$this->position;
80+
function next() : void {
81+
++$this->position;
8282
}
8383

84-
function rewind() {
84+
function rewind() : void {
8585
$this->position = 0;
8686
}
8787

88-
function valid() {
88+
function valid() : bool {
8989
$this->parse();
9090

9191
return isset($this->collectionOffsets[$this->position]);
9292
}
9393

94-
function count() {
94+
function count(): int {
9595
$this->parse();
9696

9797
return $this->numFonts;

0 commit comments

Comments
 (0)