diff --git a/src/Kql/Kql.php b/src/Kql/Kql.php index c48e732..55d1016 100644 --- a/src/Kql/Kql.php +++ b/src/Kql/Kql.php @@ -110,8 +110,11 @@ public static function run($input, $model = null) return static::select($result, $select, $options); } - public static function select($data, $select, array $options = []) - { + public static function select( + $data, + array|string|null $select = null, + array $options = [] + ) { if ($select === null) { return static::render($data); } @@ -159,8 +162,11 @@ public static function selectFromArray(array $array, array $select): array /** * @internal */ - public static function selectFromCollection(Collection $collection, array|string $select, array $options = []) - { + public static function selectFromCollection( + Collection $collection, + array|string $select, + array $options = [] + ): array { if ($options['pagination'] ?? false) { $collection = $collection->paginate($options['pagination']); } @@ -190,8 +196,10 @@ public static function selectFromCollection(Collection $collection, array|string /** * @internal */ - public static function selectFromObject(object $object, array|string $select) - { + public static function selectFromObject( + object $object, + array|string $select + ): array { // replace actual object with intercepting proxy class $object = Interceptor::replace($object); $result = []; diff --git a/tests/Kql/KqlTest.php b/tests/Kql/KqlTest.php index 70bbfe9..ef6bf34 100644 --- a/tests/Kql/KqlTest.php +++ b/tests/Kql/KqlTest.php @@ -138,7 +138,7 @@ public function testRunForbiddenMethod() public function testSelect() { // no select, returns data via ::render - $result = Kql::select('foo', null); + $result = Kql::select('foo'); $this->assertSame('foo', $result); // help