File tree Expand file tree Collapse file tree 10 files changed +20
-13
lines changed
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions Expand file tree Collapse file tree 10 files changed +20
-13
lines changed Original file line number Diff line number Diff line change 44
55namespace MartinGeorgiev \Doctrine \ORM \Query \AST \Functions ;
66
7+ use Doctrine \ORM \Query \AST \Node ;
78use MartinGeorgiev \Doctrine \ORM \Query \AST \Functions \Exception \InvalidArgumentForVariadicFunctionException ;
89
910/**
@@ -23,7 +24,7 @@ protected function customizeFunction(): void
2324 $ this ->setFunctionPrototype ('ARRAY[%s] ' );
2425 }
2526
26- protected function validateArguments (array $ arguments ): void
27+ protected function validateArguments (Node ... $ arguments ): void
2728 {
2829 $ argumentCount = \count ($ arguments );
2930 if ($ argumentCount === 0 ) {
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ protected function feedParserWithNodes(Parser $parser): void
5151 $ lookaheadType = DoctrineLexer::getLookaheadType ($ lexer );
5252 }
5353
54- $ this ->validateArguments ($ this ->nodes );
54+ $ this ->validateArguments (... $ this ->nodes ); // @phpstan-ignore-line
5555 }
5656
5757 public function getSql (SqlWalker $ sqlWalker ): string
@@ -67,9 +67,7 @@ public function getSql(SqlWalker $sqlWalker): string
6767 /**
6868 * Validates the arguments passed to the function.
6969 *
70- * @param mixed[] $arguments The array of arguments to validate
71- *
7270 * @throws InvalidArgumentForVariadicFunctionException
7371 */
74- abstract protected function validateArguments (array $ arguments ): void ;
72+ abstract protected function validateArguments (Node ... $ arguments ): void ;
7573}
Original file line number Diff line number Diff line change 44
55namespace MartinGeorgiev \Doctrine \ORM \Query \AST \Functions ;
66
7+ use Doctrine \ORM \Query \AST \Node ;
78use MartinGeorgiev \Doctrine \ORM \Query \AST \Functions \Exception \InvalidArgumentForVariadicFunctionException ;
89
910/**
@@ -21,7 +22,7 @@ protected function customizeFunction(): void
2122 $ this ->setFunctionPrototype ('greatest(%s) ' );
2223 }
2324
24- protected function validateArguments (array $ arguments ): void
25+ protected function validateArguments (Node ... $ arguments ): void
2526 {
2627 $ argumentCount = \count ($ arguments );
2728 if ($ argumentCount < 2 ) {
Original file line number Diff line number Diff line change 44
55namespace MartinGeorgiev \Doctrine \ORM \Query \AST \Functions ;
66
7+ use Doctrine \ORM \Query \AST \Node ;
78use MartinGeorgiev \Doctrine \ORM \Query \AST \Functions \Exception \InvalidArgumentForVariadicFunctionException ;
89
910/**
@@ -21,7 +22,7 @@ protected function customizeFunction(): void
2122 $ this ->setFunctionPrototype ('json_build_object(%s) ' );
2223 }
2324
24- protected function validateArguments (array $ arguments ): void
25+ protected function validateArguments (Node ... $ arguments ): void
2526 {
2627 $ argumentCount = \count ($ arguments );
2728 if ($ argumentCount === 0 || $ argumentCount % 2 !== 0 ) {
Original file line number Diff line number Diff line change 44
55namespace MartinGeorgiev \Doctrine \ORM \Query \AST \Functions ;
66
7+ use Doctrine \ORM \Query \AST \Node ;
78use MartinGeorgiev \Doctrine \ORM \Query \AST \Functions \Exception \InvalidArgumentForVariadicFunctionException ;
89
910/**
@@ -21,7 +22,7 @@ protected function customizeFunction(): void
2122 $ this ->setFunctionPrototype ('jsonb_build_object(%s) ' );
2223 }
2324
24- protected function validateArguments (array $ arguments ): void
25+ protected function validateArguments (Node ... $ arguments ): void
2526 {
2627 $ argumentCount = \count ($ arguments );
2728 if ($ argumentCount === 0 || $ argumentCount % 2 !== 0 ) {
Original file line number Diff line number Diff line change 44
55namespace MartinGeorgiev \Doctrine \ORM \Query \AST \Functions ;
66
7+ use Doctrine \ORM \Query \AST \Node ;
78use MartinGeorgiev \Doctrine \ORM \Query \AST \Functions \Exception \InvalidArgumentForVariadicFunctionException ;
89
910/**
@@ -21,7 +22,7 @@ protected function customizeFunction(): void
2122 $ this ->setFunctionPrototype ('least(%s) ' );
2223 }
2324
24- protected function validateArguments (array $ arguments ): void
25+ protected function validateArguments (Node ... $ arguments ): void
2526 {
2627 $ argumentCount = \count ($ arguments );
2728 if ($ argumentCount < 2 ) {
Original file line number Diff line number Diff line change 44
55namespace MartinGeorgiev \Doctrine \ORM \Query \AST \Functions ;
66
7+ use Doctrine \ORM \Query \AST \Node ;
78use MartinGeorgiev \Doctrine \ORM \Query \AST \Functions \Exception \InvalidArgumentForVariadicFunctionException ;
89
910/**
@@ -20,7 +21,7 @@ protected function customizeFunction(): void
2021 $ this ->setFunctionPrototype ('ROW(%s) ' );
2122 }
2223
23- protected function validateArguments (array $ arguments ): void
24+ protected function validateArguments (Node ... $ arguments ): void
2425 {
2526 $ argumentCount = \count ($ arguments );
2627 if ($ argumentCount === 0 ) {
Original file line number Diff line number Diff line change 44
55namespace MartinGeorgiev \Doctrine \ORM \Query \AST \Functions ;
66
7+ use Doctrine \ORM \Query \AST \Node ;
78use MartinGeorgiev \Doctrine \ORM \Query \AST \Functions \Exception \InvalidArgumentForVariadicFunctionException ;
89
910/**
@@ -21,7 +22,7 @@ protected function customizeFunction(): void
2122 $ this ->setFunctionPrototype ('to_tsquery(%s) ' );
2223 }
2324
24- protected function validateArguments (array $ arguments ): void
25+ protected function validateArguments (Node ... $ arguments ): void
2526 {
2627 $ argumentCount = \count ($ arguments );
2728 if ($ argumentCount < 1 || $ argumentCount > 2 ) {
Original file line number Diff line number Diff line change 44
55namespace MartinGeorgiev \Doctrine \ORM \Query \AST \Functions ;
66
7+ use Doctrine \ORM \Query \AST \Node ;
78use MartinGeorgiev \Doctrine \ORM \Query \AST \Functions \Exception \InvalidArgumentForVariadicFunctionException ;
89
910/**
@@ -23,7 +24,7 @@ protected function customizeFunction(): void
2324 $ this ->setFunctionPrototype ('to_tsvector(%s) ' );
2425 }
2526
26- protected function validateArguments (array $ arguments ): void
27+ protected function validateArguments (Node ... $ arguments ): void
2728 {
2829 $ argumentCount = \count ($ arguments );
2930 if ($ argumentCount < 1 || $ argumentCount > 2 ) {
Original file line number Diff line number Diff line change 44
55namespace MartinGeorgiev \Doctrine \ORM \Query \AST \Functions ;
66
7+ use Doctrine \ORM \Query \AST \Node ;
78use MartinGeorgiev \Doctrine \ORM \Query \AST \Functions \Exception \InvalidArgumentForVariadicFunctionException ;
89
910/**
@@ -22,7 +23,7 @@ protected function customizeFunction(): void
2223 $ this ->setFunctionPrototype ('unaccent(%s) ' );
2324 }
2425
25- protected function validateArguments (array $ arguments ): void
26+ protected function validateArguments (Node ... $ arguments ): void
2627 {
2728 $ argumentCount = \count ($ arguments );
2829 if ($ argumentCount < 1 || $ argumentCount > 2 ) {
You can’t perform that action at this time.
0 commit comments