diff --git a/src/Structures/Collections/ArrayCollection.php b/src/Structures/Collections/ArrayCollection.php index ed6e8de..c2ce55c 100644 --- a/src/Structures/Collections/ArrayCollection.php +++ b/src/Structures/Collections/ArrayCollection.php @@ -301,7 +301,7 @@ private function getProperty(mixed $target, string|int $keyName, bool $throwOnMi * @return static * @psalm-return static */ - public function filter(Closure $func = null): static + public function filter(?Closure $func = null): static { return $this->createFrom(array_filter($this->elements, $func, ARRAY_FILTER_USE_BOTH)); } diff --git a/src/Traits/HasPrePostActions.php b/src/Traits/HasPrePostActions.php index 6241b7b..f2f6e7a 100644 --- a/src/Traits/HasPrePostActions.php +++ b/src/Traits/HasPrePostActions.php @@ -16,7 +16,7 @@ public function addCallbackAction(string $key, callable $action): self return $this; } - public function getCallbackActions(string $key = null): array + public function getCallbackActions(?string $key = null): array { return $key ? $this->executeCallbacks[$key] ?? [] diff --git a/src/Traits/UseStorage.php b/src/Traits/UseStorage.php index 9f727bd..1e52881 100644 --- a/src/Traits/UseStorage.php +++ b/src/Traits/UseStorage.php @@ -17,7 +17,11 @@ */ trait UseStorage { - private Storage $storage; + private Storage $storage { + get { + return $this->storage ??= new Storage(); + } + } protected function propertyExists(string $name): bool {