Skip to content

Commit 7618ec4

Browse files
authored
Add missing return types for Countable, ArrayAccess, IteratorAggregate (#286)
1 parent cd85076 commit 7618ec4

5 files changed

Lines changed: 30 additions & 30 deletions

File tree

src/API/Type/ArrayOfFoldersType.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,23 @@ public function getAllFolders()
8686
return $this->allFolders;
8787
}
8888

89-
public function count()
89+
public function count(): int
9090
{
9191
return count($this->getAllFolders());
9292
}
9393

94-
public function offsetExists($offset)
94+
public function offsetExists($offset): bool
9595
{
9696
return isset($this->getAllFolders()[$offset]);
9797
}
9898

99-
public function offsetGet($offset)
99+
public function offsetGet($offset): mixed
100100
{
101101
$this->getAllFolders();
102102
return isset($this->allFolders[$offset]) ? $this->allFolders[$offset] : null;
103103
}
104104

105-
public function offsetSet($offset, $value)
105+
public function offsetSet($offset, $value): void
106106
{
107107
$this->getAllFolders();
108108

@@ -113,13 +113,13 @@ public function offsetSet($offset, $value)
113113
}
114114
}
115115

116-
public function offsetUnset($offset)
116+
public function offsetUnset($offset): void
117117
{
118118
$this->getAllFolders();
119119
unset($this->allFolders[$offset]);
120120
}
121121

122-
public function getIterator()
122+
public function getIterator(): \Traversable
123123
{
124124
$this->getAllFolders();
125125
return new \ArrayIterator($this->allFolders);

src/API/Type/ArrayOfRealItemsType.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,23 +117,23 @@ public function getItems()
117117
return $this->itemsArray;
118118
}
119119

120-
public function count()
120+
public function count(): int
121121
{
122122
return count($this->getItems());
123123
}
124124

125-
public function offsetExists($offset)
125+
public function offsetExists($offset): bool
126126
{
127127
return isset($this->getItems()[$offset]);
128128
}
129129

130-
public function offsetGet($offset)
130+
public function offsetGet($offset): mixed
131131
{
132132
$this->getItems();
133133
return isset($this->itemsArray[$offset]) ? $this->itemsArray[$offset] : null;
134134
}
135135

136-
public function offsetSet($offset, $value)
136+
public function offsetSet($offset, $value): void
137137
{
138138
$this->getItems();
139139

@@ -144,13 +144,13 @@ public function offsetSet($offset, $value)
144144
}
145145
}
146146

147-
public function offsetUnset($offset)
147+
public function offsetUnset($offset): void
148148
{
149149
$this->getItems();
150150
unset($this->itemsArray[$offset]);
151151
}
152152

153-
public function getIterator()
153+
public function getIterator(): \Traversable
154154
{
155155
$this->getItems();
156156
return new \ArrayIterator($this->itemsArray);

src/API/Type/FindFolderParentType.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,22 @@ class FindFolderParentType extends Type implements Countable, ArrayAccess, Itera
5353
*/
5454
protected $folders = null;
5555

56-
public function count()
56+
public function count(): int
5757
{
5858
return count($this->folders);
5959
}
6060

61-
public function offsetExists($offset)
61+
public function offsetExists($offset): bool
6262
{
6363
return isset($this->folders[$offset]);
6464
}
6565

66-
public function offsetGet($offset)
66+
public function offsetGet($offset): mixed
6767
{
6868
return isset($this->folders[$offset]) ? $this->folders[$offset] : null;
6969
}
7070

71-
public function offsetSet($offset, $value)
71+
public function offsetSet($offset, $value): void
7272
{
7373
if (is_null($offset)) {
7474
array_push($this->folders, $value);
@@ -77,12 +77,12 @@ public function offsetSet($offset, $value)
7777
}
7878
}
7979

80-
public function offsetUnset($offset)
80+
public function offsetUnset($offset): void
8181
{
8282
unset($this->folders[$offset]);
8383
}
8484

85-
public function getIterator()
85+
public function getIterator(): \Traversable
8686
{
8787
return new \ArrayIterator($this->folders->getIterator());
8888
}

src/API/Type/FindItemParentType.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,24 @@ class FindItemParentType extends Type implements Countable, ArrayAccess, Iterato
5858
*/
5959
protected $lastRequest = null;
6060

61-
public function count()
61+
public function count(): int
6262
{
6363
return count($this->items);
6464
}
6565

66-
public function offsetExists($offset)
66+
public function offsetExists($offset): bool
6767
{
6868
$arrayAccessName = ($this->items != null ? 'items' : 'groups');
6969
return isset($this->{$arrayAccessName}[$offset]);
7070
}
7171

72-
public function offsetGet($offset)
72+
public function offsetGet($offset): mixed
7373
{
7474
$arrayAccessName = ($this->items != null ? 'items' : 'groups');
7575
return isset($this->{$arrayAccessName}[$offset]) ? $this->{$arrayAccessName}[$offset] : null;
7676
}
7777

78-
public function offsetSet($offset, $value)
78+
public function offsetSet($offset, $value): void
7979
{
8080
$arrayAccessName = ($this->items != null ? 'items' : 'groups');
8181

@@ -86,13 +86,13 @@ public function offsetSet($offset, $value)
8686
}
8787
}
8888

89-
public function offsetUnset($offset)
89+
public function offsetUnset($offset): void
9090
{
9191
$arrayAccessName = ($this->items != null ? 'items' : 'groups');
9292
unset($this->{$arrayAccessName}[$offset]);
9393
}
9494

95-
public function getIterator()
95+
public function getIterator(): \Traversable
9696
{
9797
$arrayAccessName = ($this->items != null ? 'items' : 'groups');
9898
return new \ArrayIterator($this->{$arrayAccessName}->getIterator());

src/API/Type/GroupedItemsType.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ class GroupedItemsType extends Type implements Countable, ArrayAccess, IteratorA
3131
*/
3232
protected $groupSummary = null;
3333

34-
public function count()
34+
public function count(): int
3535
{
3636
return count($this->items);
3737
}
3838

39-
public function offsetExists($offset)
39+
public function offsetExists($offset): bool
4040
{
4141
return isset($this->items[$offset]);
4242
}
4343

44-
public function offsetGet($offset)
44+
public function offsetGet($offset): mixed
4545
{
4646
return isset($this->items[$offset]) ? $this->items[$offset] : null;
4747
}
4848

49-
public function offsetSet($offset, $value)
49+
public function offsetSet($offset, $value): void
5050
{
5151
if (is_null($offset)) {
5252
$this->items[] = $value;
@@ -55,12 +55,12 @@ public function offsetSet($offset, $value)
5555
}
5656
}
5757

58-
public function offsetUnset($offset)
58+
public function offsetUnset($offset): void
5959
{
6060
unset($this->items[$offset]);
6161
}
6262

63-
public function getIterator()
63+
public function getIterator(): \Traversable
6464
{
6565
return new \ArrayIterator($this->items->getIterator());
6666
}

0 commit comments

Comments
 (0)