Skip to content

Commit 61d249d

Browse files
committed
fix
1 parent 720c89e commit 61d249d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/Caster/AbstractCastingCollection.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Php\Support\Laravel\Caster;
66

7+
use ArrayIterator;
78
use Illuminate\Contracts\Support\Arrayable;
89
use Illuminate\Contracts\Support\Jsonable;
910
use Illuminate\Support\Enumerable;
@@ -26,7 +27,7 @@ abstract class AbstractCastingCollection implements
2627
*
2728
* @var array
2829
*/
29-
protected $items = [];
30+
protected array $items = [];
3031

3132
public function __construct($value = null)
3233
{
@@ -294,11 +295,11 @@ public function all(): array
294295
/**
295296
* Get an iterator for the items.
296297
*
297-
* @return \ArrayIterator
298+
* @return ArrayIterator
298299
*/
299-
public function getIterator()
300+
public function getIterator(): ArrayIterator
300301
{
301-
return new \ArrayIterator($this->items);
302+
return new ArrayIterator($this->items);
302303
}
303304

304305
/**

src/Caster/HasCasts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
trait HasCasts
1212
{
13-
public function setAttribute($key, $value)
13+
public function setAttribute($key, $value): self
1414
{
1515
if ($value instanceof Caster) {
1616
$this->attributes[$key] = $value::castToDatabase($value);
@@ -110,7 +110,7 @@ public function castValue($type, $value)
110110
return $value;
111111
}
112112

113-
public function originalIsEquivalent($key)
113+
public function originalIsEquivalent($key): bool
114114
{
115115
if (!array_key_exists($key, $this->original)) {
116116
return false;

src/Caster/PgArray.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public static function castToDatabase($value): ?string
1313
return Arr::toPostgresArray(static::normalize($value));
1414
}
1515

16-
protected static function normalize($value)
16+
protected static function normalize($value): array
1717
{
1818
return array_filter($value);
1919
}
2020

21-
public function castFromDatabase(?string $value)
21+
public function castFromDatabase(?string $value): array
2222
{
2323
return Arr::fromPostgresArray($value);
2424
}

0 commit comments

Comments
 (0)