Skip to content

Commit d7a6f0b

Browse files
authored
Merge pull request #2 from silvenger/upd-storage-trait
upd UseStorage trait
2 parents 2a2c335 + 5cfbdc6 commit d7a6f0b

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/Structures/Collections/ArrayCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ private function getProperty(mixed $target, string|int $keyName, bool $throwOnMi
301301
* @return static
302302
* @psalm-return static<TKey,T>
303303
*/
304-
public function filter(Closure $func = null): static
304+
public function filter(?Closure $func = null): static
305305
{
306306
return $this->createFrom(array_filter($this->elements, $func, ARRAY_FILTER_USE_BOTH));
307307
}

src/Traits/HasPrePostActions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function addCallbackAction(string $key, callable $action): self
1616
return $this;
1717
}
1818

19-
public function getCallbackActions(string $key = null): array
19+
public function getCallbackActions(?string $key = null): array
2020
{
2121
return $key ?
2222
$this->executeCallbacks[$key] ?? []

src/Traits/UseStorage.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
*/
1818
trait UseStorage
1919
{
20-
private Storage $storage;
20+
private Storage $storage {
21+
get {
22+
return $this->storage ??= new Storage();
23+
}
24+
}
2125

2226
protected function propertyExists(string $name): bool
2327
{

0 commit comments

Comments
 (0)