Skip to content

Commit 3838f28

Browse files
committed
Correct type hints
1 parent d3c3b64 commit 3838f28

File tree

11 files changed

+18
-54
lines changed

11 files changed

+18
-54
lines changed

src/Collection.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,9 @@ public function count(): int
7878
/**
7979
* Append new item to collection
8080
*
81-
* @param mixed $item
8281
* @return CollectionInterface<int|string, mixed>
8382
*/
84-
public function push($item): CollectionInterface
83+
public function push(mixed $item): CollectionInterface
8584
{
8685
$this->items[] = $item;
8786

@@ -115,7 +114,7 @@ public function last(): mixed
115114
/**
116115
* Return item at given position starting at 0
117116
*/
118-
public function getAtPosition(int $key = 0, $default = null): mixed
117+
public function getAtPosition(int $key = 0, mixed $default = null): mixed
119118
{
120119
if ($this->count() == 0) {
121120
return $default;
@@ -134,7 +133,7 @@ public function getAtPosition(int $key = 0, $default = null): mixed
134133
*
135134
* @see CollectionInterface::get()
136135
*/
137-
public function get(int|string $query, $default = null): mixed
136+
public function get(int|string $query, mixed $default = null): mixed
138137
{
139138
if ($this->count() == 0) {
140139
return $default;

src/Geometry/Bezier.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -144,42 +144,32 @@ public function count(): int
144144

145145
/**
146146
* Determine if point exists at given offset
147-
*
148-
* @param mixed $offset
149147
*/
150-
public function offsetExists($offset): bool
148+
public function offsetExists(mixed $offset): bool
151149
{
152150
return array_key_exists($offset, $this->points);
153151
}
154152

155153
/**
156154
* Return point at given offset
157-
*
158-
* @param mixed $offset
159-
* @return PointInterface
160155
*/
161-
public function offsetGet($offset): mixed
156+
public function offsetGet(mixed $offset): mixed
162157
{
163158
return $this->points[$offset];
164159
}
165160

166161
/**
167162
* Set point at given offset
168-
*
169-
* @param mixed $offset
170-
* @param PointInterface $value
171163
*/
172-
public function offsetSet($offset, $value): void
164+
public function offsetSet(mixed $offset, mixed $value): void
173165
{
174166
$this->points[$offset] = $value;
175167
}
176168

177169
/**
178170
* Unset offset at given offset
179-
*
180-
* @param mixed $offset
181171
*/
182-
public function offsetUnset($offset): void
172+
public function offsetUnset(mixed $offset): void
183173
{
184174
unset($this->points[$offset]);
185175
}

src/Geometry/Polygon.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,42 +120,32 @@ public function count(): int
120120

121121
/**
122122
* Determine if point exists at given offset
123-
*
124-
* @param mixed $offset
125123
*/
126-
public function offsetExists($offset): bool
124+
public function offsetExists(mixed $offset): bool
127125
{
128126
return array_key_exists($offset, $this->points);
129127
}
130128

131129
/**
132130
* Return point at given offset
133-
*
134-
* @param mixed $offset
135-
* @return PointInterface
136131
*/
137-
public function offsetGet($offset): mixed
132+
public function offsetGet(mixed $offset): mixed
138133
{
139134
return $this->points[$offset];
140135
}
141136

142137
/**
143138
* Set point at given offset
144-
*
145-
* @param mixed $offset
146-
* @param PointInterface $value
147139
*/
148-
public function offsetSet($offset, $value): void
140+
public function offsetSet(mixed $offset, mixed $value): void
149141
{
150142
$this->points[$offset] = $value;
151143
}
152144

153145
/**
154146
* Unset offset at given offset
155-
*
156-
* @param mixed $offset
157147
*/
158-
public function offsetUnset($offset): void
148+
public function offsetUnset(mixed $offset): void
159149
{
160150
unset($this->points[$offset]);
161151
}

src/InputHandler.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class InputHandler implements InputHandlerInterface
6666
* Create new input handler instance with given decoder classnames
6767
*
6868
* @param array<string|DecoderInterface> $decoders
69-
* @param DriverInterface $driver
7069
* @return void
7170
*/
7271
public function __construct(array $decoders = [], ?DriverInterface $driver = null)

src/Interfaces/CollectionInterface.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,19 @@ public function has(int|string $key): bool;
1919
/**
2020
* Add item to collection
2121
*
22-
* @param mixed $item
2322
* @return CollectionInterface<int|string, mixed>
2423
*/
25-
public function push($item): self;
24+
public function push(mixed $item): self;
2625

2726
/**
2827
* Return item for given key or return default is key does not exist
29-
*
30-
* @param mixed $default
3128
*/
32-
public function get(int|string $key, $default = null): mixed;
29+
public function get(int|string $key, mixed $default = null): mixed;
3330

3431
/**
3532
* Return item at given numeric position starting at 0
36-
*
37-
* @param mixed $default
3833
*/
39-
public function getAtPosition(int $key = 0, $default = null): mixed;
34+
public function getAtPosition(int $key = 0, mixed $default = null): mixed;
4035

4136
/**
4237
* Return first item in collection

src/Interfaces/ColorProcessorInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ interface ColorProcessorInterface
1212
* Turn given color in the driver's color implementation
1313
*
1414
* @throws ColorException
15-
* @return mixed
1615
*/
17-
public function colorToNative(ColorInterface $color);
16+
public function colorToNative(ColorInterface $color): mixed;
1817

1918
/**
2019
* Turn the given driver's definition of a color into a color object

src/Interfaces/FontInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ public function lineHeight(): float;
113113

114114
/**
115115
* Set the wrap width with which the text is rendered
116-
*
117-
* @param int $width
118116
*/
119117
public function setWrapWidth(?int $width): self;
120118

src/Interfaces/FrameInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ public function native(): mixed;
1515

1616
/**
1717
* Set image data of drame in driver specific format
18-
*
19-
* @param mixed $native
2018
*/
21-
public function setNative($native): self;
19+
public function setNative(mixed $native): self;
2220

2321
/**
2422
* Transform frame into an image

src/Interfaces/InputHandlerInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ interface InputHandlerInterface
1111
/**
1212
* Try to decode the given input with each decoder of the the handler chain
1313
*
14-
* @param mixed $input
1514
* @throws RuntimeException
1615
*/
17-
public function handle($input): ImageInterface|ColorInterface;
16+
public function handle(mixed $input): ImageInterface|ColorInterface;
1817
}

src/Typography/Line.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class Line implements IteratorAggregate, Countable, Stringable
2727
/**
2828
* Create new text line object with given text & position
2929
*
30-
* @param string $text
3130
* @return void
3231
*/
3332
public function __construct(

0 commit comments

Comments
 (0)