From a6be51ca3a7f4ea637339835f47058c3c6f4d470 Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Fri, 1 Mar 2024 10:12:48 +0100 Subject: [PATCH] Add missing PhpDoc --- phpstan-baseline.neon | 10 ---------- src/Query/Mysql/Acos.php | 10 ++++++++++ src/Query/Mysql/AddTime.php | 13 ++++++++++++- src/Query/Mysql/AesDecrypt.php | 11 +++++++++++ src/Query/Mysql/AesEncrypt.php | 11 +++++++++++ src/Query/Mysql/AnyValue.php | 9 +++++++++ src/Query/Mysql/Ascii.php | 11 +++++++++++ src/Query/Mysql/Asin.php | 10 ++++++++++ src/Query/Mysql/Atan.php | 12 ++++++++++++ src/Query/Mysql/Atan2.php | 12 ++++++++++++ src/Query/Mysql/Binary.php | 13 ++++++++++++- src/Query/Mysql/BitCount.php | 10 ++++++++++ src/Query/Mysql/BitXor.php | 10 +++++++++- src/Query/Mysql/Cast.php | 8 +++++--- src/Query/Mysql/Ceil.php | 10 ++++++++++ src/Query/Mysql/CharLength.php | 12 +++++++++++- src/Query/Mysql/Collate.php | 5 +++++ src/Query/Mysql/ConcatWs.php | 16 ++++++++++++++-- src/Query/Mysql/ConvertTz.php | 14 +++++++++++++- src/Query/Mysql/Cos.php | 11 +++++++++++ src/Query/Mysql/Cot.php | 10 ++++++++++ src/Query/Mysql/CountIf.php | 14 +++++++++++++- src/Query/Mysql/Crc32.php | 12 +++++++++++- src/Query/Mysql/Date.php | 12 +++++++++++- src/Query/Mysql/DateAdd.php | 12 ++++++++++++ src/Query/Mysql/DateDiff.php | 11 +++++++++++ src/Query/Mysql/DateFormat.php | 15 ++++++++++++++- src/Query/Mysql/DateSub.php | 10 +++++++++- src/Query/Mysql/Day.php | 8 ++++++++ src/Query/Mysql/DayName.php | 12 +++++++++++- src/Query/Mysql/DayOfWeek.php | 10 ++++++++++ src/Query/Mysql/DayOfYear.php | 10 +++++++++- src/Query/Mysql/Degrees.php | 11 +++++++++++ src/Query/Mysql/Div.php | 13 ++++++++++--- src/Query/Mysql/Exp.php | 10 ++++++++++ src/Query/Mysql/Extract.php | 14 +++++++++++++- src/Query/Mysql/Field.php | 14 +++++++++++++- src/Query/Mysql/FindInSet.php | 11 +++++++++++ src/Query/Mysql/Floor.php | 10 ++++++++++ src/Query/Mysql/Format.php | 9 ++++++++- src/Query/Mysql/FromBase64.php | 6 ++++-- src/Query/Mysql/FromUnixtime.php | 13 ++++++++++++- src/Query/Mysql/Greatest.php | 11 +++++++++++ src/Query/Mysql/GroupConcat.php | 16 ++++++++++++++++ src/Query/Mysql/Hex.php | 10 ++++++++++ src/Query/Mysql/Hour.php | 13 ++++++++++++- src/Query/Mysql/IfElse.php | 13 ++++++++++++- src/Query/Mysql/IfNull.php | 14 +++++++++++++- src/Query/Mysql/Inet6Aton.php | 3 +++ src/Query/Mysql/Inet6Ntoa.php | 3 +++ src/Query/Mysql/InetAton.php | 3 +++ src/Query/Mysql/InetNtoa.php | 3 +++ src/Query/Mysql/Instr.php | 3 +++ src/Query/Mysql/IsIpv4.php | 3 +++ src/Query/Mysql/IsIpv4Compat.php | 3 +++ src/Query/Mysql/IsIpv4Mapped.php | 3 +++ src/Query/Mysql/IsIpv6.php | 3 +++ src/Query/Mysql/JsonContains.php | 3 +++ src/Query/Mysql/JsonDepth.php | 3 +++ src/Query/Mysql/JsonLength.php | 3 +++ src/Query/Mysql/Lag.php | 5 +++++ src/Query/Mysql/LastDay.php | 2 ++ src/Query/Mysql/Lead.php | 3 +++ src/Query/Mysql/Least.php | 6 +++++- src/Query/Mysql/Log.php | 5 +++++ src/Query/Mysql/Log10.php | 5 +++++ src/Query/Mysql/Log2.php | 5 +++++ src/Query/Mysql/Lpad.php | 6 +++++- src/Query/Mysql/MakeDate.php | 3 +++ src/Query/Mysql/MatchAgainst.php | 3 +++ src/Query/Mysql/Md5.php | 6 +++++- src/Query/Mysql/Minute.php | 6 +++++- src/Query/Mysql/Month.php | 2 ++ src/Query/Mysql/MonthName.php | 6 +++++- src/Query/Mysql/Now.php | 3 +++ src/Query/Mysql/NullIf.php | 6 +++++- src/Query/Mysql/Over.php | 3 +++ src/Query/Mysql/PeriodDiff.php | 3 +++ src/Query/Mysql/Pi.php | 3 +++ src/Query/Mysql/Power.php | 5 +++++ src/Query/Mysql/Quarter.php | 6 +++++- src/Query/Mysql/Radians.php | 5 +++++ src/Query/Mysql/Rand.php | 7 +++++-- src/Query/Mysql/Regexp.php | 3 +++ src/Query/Mysql/Replace.php | 6 +++++- src/Query/Mysql/Round.php | 6 ++++++ src/Query/Mysql/Rpad.php | 6 +++++- src/Query/Mysql/SecToTime.php | 2 ++ src/Query/Mysql/Second.php | 6 +++++- src/Query/Mysql/Sha1.php | 6 +++++- src/Query/Mysql/Sha2.php | 8 +++++++- src/Query/Mysql/Sin.php | 5 +++++ src/Query/Mysql/Soundex.php | 6 +++++- src/Query/Mysql/Std.php | 8 +++++++- src/Query/Mysql/StdDev.php | 8 +++++++- src/Query/Mysql/StrToDate.php | 3 +++ src/Query/Mysql/SubstringIndex.php | 3 +++ src/Query/Mysql/Tan.php | 5 +++++ src/Query/Mysql/Time.php | 2 ++ src/Query/Mysql/TimeDiff.php | 3 +++ src/Query/Mysql/TimeToSec.php | 2 ++ src/Query/Mysql/TimestampAdd.php | 6 +++++- src/Query/Mysql/TimestampDiff.php | 6 +++++- src/Query/Mysql/Truncate.php | 9 ++++++++- src/Query/Mysql/Unhex.php | 5 +++++ src/Query/Mysql/UnixTimestamp.php | 2 ++ src/Query/Mysql/UtcTimestamp.php | 6 +++++- src/Query/Mysql/UuidShort.php | 3 +++ src/Query/Mysql/Variance.php | 7 +++++-- src/Query/Mysql/Week.php | 2 ++ src/Query/Mysql/WeekDay.php | 6 +++++- src/Query/Mysql/WeekOfYear.php | 3 +++ src/Query/Mysql/Year.php | 6 +++++- src/Query/Mysql/YearMonth.php | 3 +++ src/Query/Mysql/YearWeek.php | 6 +++++- src/Query/Oracle/Floor.php | 2 ++ src/Query/Postgresql/AtTimeZoneFunction.php | 10 ++++++++++ src/Query/Postgresql/CountFilterFunction.php | 10 ++++++++++ src/Query/Postgresql/Date.php | 5 +++++ src/Query/Postgresql/DateFormat.php | 14 +++++++++++++- src/Query/Postgresql/DatePart.php | 13 ++++++++++++- src/Query/Postgresql/DateTrunc.php | 10 ++++++++++ src/Query/Postgresql/Day.php | 9 +++++++++ src/Query/Postgresql/ExtractFunction.php | 9 +++++++++ src/Query/Postgresql/Greatest.php | 11 +++++++++++ src/Query/Postgresql/Hour.php | 9 +++++++++ src/Query/Postgresql/Least.php | 9 +++++++++ src/Query/Postgresql/Minute.php | 9 +++++++++ src/Query/Postgresql/Month.php | 9 +++++++++ src/Query/Postgresql/RegexpReplace.php | 7 +++++++ src/Query/Postgresql/Second.php | 9 +++++++++ src/Query/Postgresql/StrToDate.php | 10 ++++++++++ src/Query/Postgresql/StringAgg.php | 12 ++++++++++++ src/Query/Postgresql/Year.php | 9 +++++++++ src/Query/Sqlite/Round.php | 3 +++ 135 files changed, 952 insertions(+), 67 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1be4cd71..0ea5c0db 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -29,13 +29,3 @@ parameters: message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lead\\:\\:\\$offset \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" count: 1 path: src/Query/Mysql/Lead.php - - - - message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Rand\\:\\:\\$expression \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\SimpleArithmeticExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" - count: 1 - path: src/Query/Mysql/Rand.php - - - - message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Variance\\:\\:\\$arithmeticExpression \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\SimpleArithmeticExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" - count: 1 - path: src/Query/Mysql/Variance.php diff --git a/src/Query/Mysql/Acos.php b/src/Query/Mysql/Acos.php index 68b9c8e3..92dfa4a8 100644 --- a/src/Query/Mysql/Acos.php +++ b/src/Query/Mysql/Acos.php @@ -3,12 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * AcosFunction ::= "ACOS" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_acos + * + * @example SELECT ACOS(2) + * @example SELECT ACOS(foo.bar) FROM entity + */ class Acos extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/AddTime.php b/src/Query/Mysql/AddTime.php index 08d84caa..ac9ef3a3 100644 --- a/src/Query/Mysql/AddTime.php +++ b/src/Query/Mysql/AddTime.php @@ -3,15 +3,26 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Pascal Wacker */ +/** + * AddTimeFunction ::= "ADDTIME" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_addtime + * + * @author Pascal Wacker + * @example SELECT ADDTIME('2019-03-01 14:35:00', '01:02:03') + * @example SELECT ADDTIME(foo.bar, '01:02:03') FROM entity + */ class AddTime extends FunctionNode { + /** @var Node|string */ public $date; + /** @var Node|string */ public $time; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/AesDecrypt.php b/src/Query/Mysql/AesDecrypt.php index 3816b323..d28541f0 100644 --- a/src/Query/Mysql/AesDecrypt.php +++ b/src/Query/Mysql/AesDecrypt.php @@ -3,16 +3,27 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; +use Doctrine\ORM\Query\AST\Subselect; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * AesDecryptFunction ::= "AES_DECRYPT" "(" StringExpression "," StringExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/encryption-functions.html#function_aes-decrypt + * + * @example SELECT AES_DECRYPT(foo.crypt, foo.key) FROM entity + */ class AesDecrypt extends FunctionNode { + /** @var Node|Subselect|string */ public $field = ''; + /** @var Node|Subselect|string */ public $key = ''; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/AesEncrypt.php b/src/Query/Mysql/AesEncrypt.php index 6f2c390c..391a42c3 100644 --- a/src/Query/Mysql/AesEncrypt.php +++ b/src/Query/Mysql/AesEncrypt.php @@ -3,16 +3,27 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; +use Doctrine\ORM\Query\AST\Subselect; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * AesEncryptFunction ::= "AES_ENCRYPT" "(" StringExpression "," StringExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/encryption-functions.html#function_aes-encrypt + * + * @example SELECT AES_ENCRYPT(foo.to_crypt, foo.key) FROM entity + */ class AesEncrypt extends FunctionNode { + /** @var Node|Subselect|string */ public $field = ''; + /** @var Node|Subselect|string */ public $key = ''; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/AnyValue.php b/src/Query/Mysql/AnyValue.php index 68283a31..c4c88c8b 100644 --- a/src/Query/Mysql/AnyValue.php +++ b/src/Query/Mysql/AnyValue.php @@ -3,14 +3,23 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * AnyValueFunction ::= "ANY_VALUE" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_any-value + * + * @example SELECT ANY_VALUE(foo.bar) FROM entity + */ class AnyValue extends FunctionNode { + /** @var Node */ public $value; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/Ascii.php b/src/Query/Mysql/Ascii.php index d4d26d20..01459767 100644 --- a/src/Query/Mysql/Ascii.php +++ b/src/Query/Mysql/Ascii.php @@ -2,13 +2,24 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * AsciiFunction ::= "ASCII" "(" ArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_ascii + * + * @example SELECT ASCII(foo.bar) FROM entity + * @example SELECT ASCII('2') + * @example SELECT ASCII(2) + */ class Ascii extends FunctionNode { + /** @var ArithmeticExpression */ private $string; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Asin.php b/src/Query/Mysql/Asin.php index d60e5daf..8ade1ac1 100644 --- a/src/Query/Mysql/Asin.php +++ b/src/Query/Mysql/Asin.php @@ -3,12 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * AsinFunction ::= "ASIN" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_asin + * + * @example SELECT ASIN(foo.bar) FROM entity + * @example SELECT ASIN(0.2) + */ class Asin extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Atan.php b/src/Query/Mysql/Atan.php index 0f58b4d3..af1e32a4 100644 --- a/src/Query/Mysql/Atan.php +++ b/src/Query/Mysql/Atan.php @@ -3,15 +3,27 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\QueryException; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * AtanFunction ::= "ATAN" "(" SimpleArithmeticExpression [ "," SimpleArithmeticExpression ] ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_atan + * + * @example SELECT ATAN(foo.bar) FROM entity + * @example SELECT ATAN(-2, 2) + * @example SELECT ATAN(PI(), 2) + */ class Atan extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; + /** @var Node|string */ public $optionalSecondExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Atan2.php b/src/Query/Mysql/Atan2.php index 691d5f32..51954903 100644 --- a/src/Query/Mysql/Atan2.php +++ b/src/Query/Mysql/Atan2.php @@ -3,14 +3,26 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * Atan2Function ::= "ATAN2" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_atan2 + * + * @example SELECT ATAN2(-2, 2) + * @example SELECT ATAN2(PI(), 2) + * @example SELECT ATAN2(foo.bar, 2) FROM entity + */ class Atan2 extends FunctionNode { + /** @var Node|string */ public $firstExpression; + /** @var Node|string */ public $secondExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Binary.php b/src/Query/Mysql/Binary.php index 9941b623..bcb1166d 100644 --- a/src/Query/Mysql/Binary.php +++ b/src/Query/Mysql/Binary.php @@ -3,13 +3,24 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Sarjono Mukti Aji */ +/** + * BinaryFunction ::= "BINARY" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/cast-functions.html#operator_binary + * + * @author Sarjono Mukti Aji + * @example SELECT BINARY(foo.bar) FROM entity + * @example SELECT BINARY("string") + * @example SELECT BINARY(2) + */ class Binary extends FunctionNode { + /** @var Node */ private $stringPrimary; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/BitCount.php b/src/Query/Mysql/BitCount.php index a2be1811..d663abde 100644 --- a/src/Query/Mysql/BitCount.php +++ b/src/Query/Mysql/BitCount.php @@ -3,12 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * BitCountFunction ::= "BIT_COUNT" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/bit-functions.html#function_bit-count + * + * @example SELECT BIT_COUNT(foo.bar) FROM entity + * @example SELECT BIT_COUNT(2) + */ class BitCount extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/BitXor.php b/src/Query/Mysql/BitXor.php index 42326a50..dd03f0ee 100644 --- a/src/Query/Mysql/BitXor.php +++ b/src/Query/Mysql/BitXor.php @@ -3,17 +3,25 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; /** - * "BIT_XOR" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * BitXorFunction ::= "BIT_XOR" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/aggregate-functions.html#function_bit-xor + * + * @example SELECT BIT_XOR(foo.bar, 2) FROM entity + * @example SELECT BIT_XOR(2, 2) */ class BitXor extends FunctionNode { + /** @var Node|string */ public $firstArithmetic; + /** @var Node|string */ public $secondArithmetic; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Cast.php b/src/Query/Mysql/Cast.php index 07a214ec..facd3776 100644 --- a/src/Query/Mysql/Cast.php +++ b/src/Query/Mysql/Cast.php @@ -15,15 +15,17 @@ use function sprintf; /** - * "CAST" "(" "$fieldIdentifierExpression" "AS" "$castingTypeExpression" ")" + * "CAST" "(" SimpleArithmeticExpression "AS" Identifier [ "(" Literal { "," Literal }* ")" ] ")" * * @link https://dev.mysql.com/doc/refman/en/cast-functions.html#function_cast * - * @example SELECT CAST(foo.bar AS SIGNED) FROM dual; + * @example SELECT CAST(foo.bar AS SIGNED) FROM entity + * @example SELECT CAST(foo.bar AS UNSIGNED) FROM entity + * @example SELECT CAST(foo.bar AS DECIMAL(2, 2)) FROM entity */ class Cast extends FunctionNode { - /** @var Node */ + /** @var Node|string */ protected $fieldIdentifierExpression; /** @var string */ diff --git a/src/Query/Mysql/Ceil.php b/src/Query/Mysql/Ceil.php index 62aaa5ec..394259ad 100644 --- a/src/Query/Mysql/Ceil.php +++ b/src/Query/Mysql/Ceil.php @@ -3,12 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * CeilFunction ::= "CEIL" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_ceil + * + * @example SELECT CEIL(foo.bar) FROM entity + * @example SELECT CEIL(2) + */ class Ceil extends FunctionNode { + /** @var Node|string */ private $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/CharLength.php b/src/Query/Mysql/CharLength.php index 671021b2..382c97d0 100644 --- a/src/Query/Mysql/CharLength.php +++ b/src/Query/Mysql/CharLength.php @@ -2,14 +2,24 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Metod */ +/** + * CharLengthFunction ::= "CHAR_LENGTH" "(" ArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_char-length + * + * @author Metod + * @example SELECT CHAR_LENGTH(foo.bar) FROM entity + * @example SELECT CHAR_LENGTH("string") + */ class CharLength extends FunctionNode { + /** @var ArithmeticExpression */ private $expr1; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Collate.php b/src/Query/Mysql/Collate.php index 98d485d6..368c794b 100644 --- a/src/Query/Mysql/Collate.php +++ b/src/Query/Mysql/Collate.php @@ -11,9 +11,14 @@ use function sprintf; /** + * CollateFunction ::= "COLLATE" "(" StringPrimary "," Identifier ")" + * * @link https://dev.mysql.com/doc/refman/en/charset-collate.html * * @author Peter Tanath + * + * @example SELECT COLLATE("string", latin1_german2_ci) + * @example SELECT COLLATE(foo.bar, latin1_german2_ci) FROM entity */ class Collate extends FunctionNode { diff --git a/src/Query/Mysql/ConcatWs.php b/src/Query/Mysql/ConcatWs.php index b351b687..2b5dd347 100644 --- a/src/Query/Mysql/ConcatWs.php +++ b/src/Query/Mysql/ConcatWs.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; @@ -12,11 +13,22 @@ use function sprintf; use function strtolower; -/** @author Andrew Mackrodt */ +/** + * ConcatWsFunction ::= "CONCAT_WS" "(" ArithmeticExpression "," FunctionDeclaration | ArithmeticExpression "," FunctionDeclaration | ArithmeticExpression [{ "," FunctionDeclaration | ArithmeticExpression }*] [ "NOTEMPTY" ] ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_concat-ws + * + * @author Andrew Mackrodt + * @example SELECT CONCAT_WS(",", foo.bar, foo.bar2) FROM entity + * @example SELECT CONCAT_WS(",", foo.bar, foo.bar2, foo.bar3) FROM entity + * @example SELECT CONCAT_WS(",", foo.bar, foo.bar2, "NOTEMPTY") FROM entity + */ class ConcatWs extends FunctionNode { + /** @var array */ private $values = []; + /** @var bool */ private $notEmpty = false; public function parse(Parser $parser): void @@ -73,7 +85,7 @@ public function getSql(SqlWalker $sqlWalker): string $nodeSql = $sqlWalker->walkArithmeticPrimary($this->values[$i]); if ($this->notEmpty) { - // Exclude empty strings from the concatenation. + // Exclude empty strings from the concatenation. $nodeSql = sprintf("NULLIF(%s, '')", $nodeSql); } diff --git a/src/Query/Mysql/ConvertTz.php b/src/Query/Mysql/ConvertTz.php index 34c74231..f80bef1c 100644 --- a/src/Query/Mysql/ConvertTz.php +++ b/src/Query/Mysql/ConvertTz.php @@ -2,20 +2,32 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; -/** @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_convert-tz */ +/** + * ConvertTzFunction ::= "CONVERT_TZ" "(" ArithmeticExpression "," StringPrimary "," StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_convert-tz + * + * @example SELECT CONVERT_TZ(foo.bar, "GMT", "CEST") FROM entity + * @example SELECT CONVERT_TZ("2024-02-06 12:00:00", "GMT", "CEST") + */ class ConvertTz extends FunctionNode { + /** @var ArithmeticExpression */ protected $dateExpression; + /** @var Node */ protected $fromTz; + /** @var Node */ protected $toTz; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Cos.php b/src/Query/Mysql/Cos.php index b3f1e2f3..a2f21b8e 100644 --- a/src/Query/Mysql/Cos.php +++ b/src/Query/Mysql/Cos.php @@ -3,12 +3,23 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * CosFunction ::= "COS" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_cos + * + * @example SELECT COS(foo.bar) FROM entity + * @example SELECT COS(2) + * @example SELECT COS(PI()) + */ class Cos extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Cot.php b/src/Query/Mysql/Cot.php index 84bdcab9..7acc6e68 100644 --- a/src/Query/Mysql/Cot.php +++ b/src/Query/Mysql/Cot.php @@ -3,12 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * CotFunction ::= "COT" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_cot + * + * @example SELECT COT(5) + * @example SELECT COT(foo.bar) FROM entity + */ class Cot extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/CountIf.php b/src/Query/Mysql/CountIf.php index 9e5714bf..870cc7c8 100644 --- a/src/Query/Mysql/CountIf.php +++ b/src/Query/Mysql/CountIf.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; @@ -10,13 +11,24 @@ use function sprintf; use function strtolower; -/** @author Andrew Mackrodt */ +/** + * CountIfFunction ::= "COUNTIF" "(" ArithmeticExpression "," ArithmeticExpression [ "INVERSE" ] ")" + * + * @link https://dev.mysql.com/doc/refman/en/counting-rows.html + * + * @author Andrew Mackrodt + * @example SELECT COUNTIF(2, 3) + * @example SELECT COUNTIF(2, 3 INVERSE) + */ class CountIf extends FunctionNode { + /** @var ArithmeticExpression */ private $expr1; + /** @var ArithmeticExpression */ private $expr2; + /** @var bool */ private $inverse = false; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/Crc32.php b/src/Query/Mysql/Crc32.php index 59c08f69..2ec60ca3 100644 --- a/src/Query/Mysql/Crc32.php +++ b/src/Query/Mysql/Crc32.php @@ -3,13 +3,23 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Igor Timoshenko */ +/** + * Crc32Function ::= "CRC32" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_crc32 + * + * @author Igor Timoshenko + * @example SELECT CRC32(foo.bar) FROM entity + * @example SELECT CRC32("string") + */ class Crc32 extends FunctionNode { + /** @var Node */ public $stringPrimary; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Date.php b/src/Query/Mysql/Date.php index 90bbd418..e1eaeed7 100644 --- a/src/Query/Mysql/Date.php +++ b/src/Query/Mysql/Date.php @@ -3,13 +3,23 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Steve Lacey */ +/** + * DateFunction ::= "DATE" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_date + * + * @author Steve Lacey + * @example SELECT DATE("2024-05-06") + * @example SELECT DATE(foo.bar) + */ class Date extends FunctionNode { + /** @var Node|string */ public $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/DateAdd.php b/src/Query/Mysql/DateAdd.php index a17a3a8d..f9e74faf 100644 --- a/src/Query/Mysql/DateAdd.php +++ b/src/Query/Mysql/DateAdd.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\QueryException; @@ -12,12 +13,23 @@ use function is_string; use function strtoupper; +/** + * DateAddFunction ::= "DATEADD" "(" ArithmeticFactor "," ArithmeticFactor "," StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_date-add + * + * @example SELECT DATEADD(2, 5, "MINUTE") FROM entity + * @example SELECT DATEADD(foo.bar, 5, "MINUTE") FROM entity + */ class DateAdd extends FunctionNode { + /** @var AST\Node|string|AST\ArithmeticFactor */ public $firstDateExpression = null; + /** @var AST\Node|string|AST\ArithmeticFactor */ public $intervalExpression = null; + /** @todo fix phpstan error var AST\Node */ public $unit = null; protected static $allowedUnits = [ diff --git a/src/Query/Mysql/DateDiff.php b/src/Query/Mysql/DateDiff.php index 5442ed76..2d749d55 100644 --- a/src/Query/Mysql/DateDiff.php +++ b/src/Query/Mysql/DateDiff.php @@ -3,14 +3,25 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * DateDiffFunction ::= "DATE_DIFF" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_datediff + * + * @example SELECT DATE_DIFF("2024-05-06", "2024-05-07") + * @example SELECT DATE_DIFF(foo.bar, foo.bar2) FROM entity + */ class DateDiff extends FunctionNode { + /** @var Node|string */ public $firstDateExpression = null; + /** @var Node|string */ public $secondDateExpression = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/DateFormat.php b/src/Query/Mysql/DateFormat.php index c6693747..2bed8b85 100644 --- a/src/Query/Mysql/DateFormat.php +++ b/src/Query/Mysql/DateFormat.php @@ -2,16 +2,29 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Steve Lacey */ +/** + * DateFormatFunction ::= "DATEFORMAT" "(" ArithmeticExpression "," StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_date-format + * + * @author Steve Lacey + * + * @example SELECT DATEFORMAT("2024-05-06", "%a") + * @example SELECT DATEFORMAT(foo.bar, "%H") FROM entity + */ class DateFormat extends FunctionNode { + /** @var ArithmeticExpression */ public $dateExpression = null; + /** @var Node */ public $patternExpression = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/DateSub.php b/src/Query/Mysql/DateSub.php index 795e10c4..412f82c5 100644 --- a/src/Query/Mysql/DateSub.php +++ b/src/Query/Mysql/DateSub.php @@ -9,7 +9,15 @@ use function is_string; use function strtoupper; -/** @author Vas N */ +/** + * DateSubFunction ::= "DATESUB" "(" ArithmeticFactor "," ArithmeticFactor "," StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_date-sub + * + * @author Vas N + * @example SELECT DATESUB(foo.bar, 5, "MINUTE") FROM entity + * @example SELECT DATESUB(2, 5, "MINUTE") + */ class DateSub extends DateAdd { /** @throws QueryException */ diff --git a/src/Query/Mysql/Day.php b/src/Query/Mysql/Day.php index 2705df41..ee993519 100644 --- a/src/Query/Mysql/Day.php +++ b/src/Query/Mysql/Day.php @@ -3,16 +3,24 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; /** + * DayFunction ::= "DAY" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_day + * * @author Rafael Kassner * @author Sarjono Mukti Aji + * @example SELECT DAY(foo.bar) FROM entity + * @example SELECT DAY("2023-05-06") */ class Day extends FunctionNode { + /** @var Node|string */ public $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/DayName.php b/src/Query/Mysql/DayName.php index 37a0b57d..1eae72ea 100644 --- a/src/Query/Mysql/DayName.php +++ b/src/Query/Mysql/DayName.php @@ -3,13 +3,23 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Steve Lacey */ +/** + * DayNameFunction ::= "DAYNAME" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_dayname + * + * @author Steve Lacey + * @example SELECT DAYNAME(foo.bar) FROM entity + * @example SELECT DAYNAME("2023-05-06") + */ class DayName extends FunctionNode { + /** @var Node|string */ public $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/DayOfWeek.php b/src/Query/Mysql/DayOfWeek.php index 6162920d..1bf861b2 100644 --- a/src/Query/Mysql/DayOfWeek.php +++ b/src/Query/Mysql/DayOfWeek.php @@ -3,12 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * DayOfWeekFunction ::= "DAYOFWEEK" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_dayofweek + * + * @example SELECT DAYOFWEEK(foo.bar) FROM entity + * @example SELECT DAYOFWEEK("2023-05-06") + */ class DayOfWeek extends FunctionNode { + /** @var Node|string */ public $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/DayOfYear.php b/src/Query/Mysql/DayOfYear.php index 855bb843..5e48576e 100644 --- a/src/Query/Mysql/DayOfYear.php +++ b/src/Query/Mysql/DayOfYear.php @@ -8,9 +8,17 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * DayOfYearFunction ::= "DAYOFYEAR" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_dayofyear + * + * @example SELECT DAYOFYEAR(foo.bar) FROM entity + * @example SELECT DAYOFYEAR("2023-05-06") + */ class DayOfYear extends FunctionNode { - /** @var Node */ + /** @var Node|string */ public $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Degrees.php b/src/Query/Mysql/Degrees.php index ee947a4f..10e9ff54 100644 --- a/src/Query/Mysql/Degrees.php +++ b/src/Query/Mysql/Degrees.php @@ -3,12 +3,23 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * DegreesFunction ::= "DEGREES" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_degrees + * + * @example SELECT DEGREES(PI()) + * @example SELECT DEGREES(PI() / 4) + * @example SELECT DEGREES(foo.bar) FROM entity + */ class Degrees extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Div.php b/src/Query/Mysql/Div.php index f19a3c53..788c0720 100644 --- a/src/Query/Mysql/Div.php +++ b/src/Query/Mysql/Div.php @@ -8,13 +8,20 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @link https://dev.mysql.com/doc/refman/en/arithmetic-functions.html#operator_div */ +/** + * DivFunction ::= "DIV" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/arithmetic-functions.html#operator_div + * + * @example SELECT DIV(2, 5) + * @example SELECT DIV(foo.bar, foo.bar2) FROM entity + */ class Div extends FunctionNode { - /** @var Node */ + /** @var Node|string */ private $dividend; - /** @var Node */ + /** @var Node|string */ private $divisor; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Exp.php b/src/Query/Mysql/Exp.php index cb4b48ea..5a84649f 100644 --- a/src/Query/Mysql/Exp.php +++ b/src/Query/Mysql/Exp.php @@ -3,12 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * ExpFunction ::= "EXP" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_exp + * + * @example SELECT EXP(2) + * @example SELECT EXP(foo.bar) FROM entity + */ class Exp extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Extract.php b/src/Query/Mysql/Extract.php index 0d2419a3..aad5acc3 100644 --- a/src/Query/Mysql/Extract.php +++ b/src/Query/Mysql/Extract.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\QueryException; use Doctrine\ORM\Query\SqlWalker; @@ -10,11 +11,22 @@ use function in_array; use function strtoupper; -/** @author Ahwalian Masykur */ +/** + * ExtractFunction ::= "EXTRACT" "(" Identifier "FROM" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_extract + * + * @author Ahwalian Masykur + * + * @example SELECT EXTRACT("MINUTE" FROM foo.bar) FROM entity + * @example SELECT EXTRACT("YEAR" FROM "2024-05-06") + */ class Extract extends DateAdd { + /** @var Node|string */ public $date = null; + /** @var int|string */ public $unit = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/Field.php b/src/Query/Mysql/Field.php index ba8b219a..01a70ee8 100644 --- a/src/Query/Mysql/Field.php +++ b/src/Query/Mysql/Field.php @@ -3,17 +3,29 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function count; -/** @author Jeremy Hicks */ +/** + * FieldFunction ::= "FIELD" "(" ArithmeticPrimary "," ArithmeticPrimary [{ "," ArithmeticPrimary }*] ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_field + * + * @author Jeremy Hicks + * + * @example SELECT FIELD("str", foo.bar) FROM entity + * @example SELECT FIELD("str", foo.bar, foo.bar2, foo.bar3) FROM entity + */ class Field extends FunctionNode { + /** @var Node|string */ private $field = null; + /** @var array */ private $values = []; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/FindInSet.php b/src/Query/Mysql/FindInSet.php index 80115f20..f552c93a 100644 --- a/src/Query/Mysql/FindInSet.php +++ b/src/Query/Mysql/FindInSet.php @@ -3,14 +3,25 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * FindInSetFunction ::= "FIND_IN_SET" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_find-in-set + * + * @example SELECT FIND_IN_SET(foo.bar, foo.bar2) FROM entity + * @example SELECT FIND_IN_SET("str", "a,b,str") FROM entity + */ class FindInSet extends FunctionNode { + /** @var Node|string */ public $needle = null; + /** @var Node|string */ public $haystack = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/Floor.php b/src/Query/Mysql/Floor.php index f323a60b..22a4210c 100644 --- a/src/Query/Mysql/Floor.php +++ b/src/Query/Mysql/Floor.php @@ -3,12 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * FloorFunction ::= "FLOOR" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_floor + * + * @example SELECT FLOOR(3.14) + * @example SELECT FLOOR(foo.bar) FROM entity + */ class Floor extends FunctionNode { + /** @var Node|string */ private $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Format.php b/src/Query/Mysql/Format.php index 498db9c2..5c1e1c2d 100644 --- a/src/Query/Mysql/Format.php +++ b/src/Query/Mysql/Format.php @@ -3,15 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Wally Noveno */ +/** + * "FORMAT" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")" + * + * @author Wally Noveno + */ class Format extends FunctionNode { + /** @var Node|string */ public $numberExpression = null; + /** @var Node|string */ public $patternExpression = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/FromBase64.php b/src/Query/Mysql/FromBase64.php index 6cdc709f..d5361ff2 100644 --- a/src/Query/Mysql/FromBase64.php +++ b/src/Query/Mysql/FromBase64.php @@ -3,19 +3,21 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; /** - * "FROM_BASE64" "(" "$fieldIdentifierExpression" ")" + * FromBase64Function ::= "FROM_BASE64" "(" ArithmeticPrimary ")" * * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_from-base64 * - * @example SELECT FROM_BASE64(foo) FROM dual; + * @example SELECT FROM_BASE64(foo.bar) FROM entity */ class FromBase64 extends FunctionNode { + /** @var Node|string */ public $field = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/FromUnixtime.php b/src/Query/Mysql/FromUnixtime.php index 30079330..47011409 100644 --- a/src/Query/Mysql/FromUnixtime.php +++ b/src/Query/Mysql/FromUnixtime.php @@ -3,15 +3,26 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Nima S */ +/** + * FromUnixTimeFunction ::= "FROM_UNIXTIME" "(" ArithmeticPrimary ["," ArithmeticPrimary] ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_from-unixtime + * + * @author Nima S + * @example SELECT FROM_UNIXTIME(123456789) + * @example SELECT FROM_UNIXTIME(foo.bar, "%Y") FROM entity + */ class FromUnixtime extends FunctionNode { + /** @var Node|string */ public $firstExpression = null; + /** @var Node|string */ public $secondExpression = null; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Greatest.php b/src/Query/Mysql/Greatest.php index 5a2fbdf1..c3348ecb 100644 --- a/src/Query/Mysql/Greatest.php +++ b/src/Query/Mysql/Greatest.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; @@ -10,13 +11,23 @@ use function count; /** + * GreatestFunction ::= "GREATEST" "(" ArithmeticExpression "," ArithmeticExpression [{ "," ArithmeticExpression }*] ")" + * + * @link https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html#function_greatest + * * @author Vas N * @author Guven Atbakan + * + * @example SELECT(1, 2) + * @example SELECT(1, 2, 100, 10) + * @example SELECT(foo.bar, foo.bar2) FROM entity */ class Greatest extends FunctionNode { + /** @var ArithmeticExpression */ private $field = null; + /** @var array */ private $values = []; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/GroupConcat.php b/src/Query/Mysql/GroupConcat.php index 6312414f..c9bbe654 100644 --- a/src/Query/Mysql/GroupConcat.php +++ b/src/Query/Mysql/GroupConcat.php @@ -3,6 +3,10 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; +use Doctrine\ORM\Query\AST\OrderByClause; +use Doctrine\ORM\Query\AST\PathExpression; +use Doctrine\ORM\Query\AST\Subselect; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; @@ -11,14 +15,26 @@ use function sprintf; use function strtolower; +/** + * GroupConcatFunction ::= "GROUP_CONCAT" "(" ["DISTINCT"] StringExpression|SingleValuedPathExpression [{ "," StringPrimary }*] [ OrderByClause ] [ "SEPARATOR" StringPrimary ] ")" + * + * @link https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_group-concat + * + * @example GROUP_CONCAT(foo.bar, foo.bar2) FROM entity + * @example GROUP_CONCAT(DISTINCT foo.bar, foo.bar2 ORDER BY foo.bar ASC, foo.bar2 DESC SEPARATOR ", ") FROM entity + */ class GroupConcat extends FunctionNode { + /** @var bool */ public $isDistinct = false; + /** @var array */ public $pathExp = null; + /** @var Node */ public $separator = null; + /** @var OrderByClause */ public $orderBy = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/Hex.php b/src/Query/Mysql/Hex.php index d9a48263..502e7de1 100644 --- a/src/Query/Mysql/Hex.php +++ b/src/Query/Mysql/Hex.php @@ -3,12 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * HexFunction ::= "HEX" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_hex + * + * @example SELECT HEX("string") + * @example SELECT HEX(foo.bar) FROM entity + */ class Hex extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Hour.php b/src/Query/Mysql/Hour.php index 5f2b9804..999dd7f3 100644 --- a/src/Query/Mysql/Hour.php +++ b/src/Query/Mysql/Hour.php @@ -3,13 +3,24 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Dawid Nowak */ +/** + * HourFunction ::= "HOUR" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_hour + * + * @author Dawid Nowak + * + * @example SELECT HOUR("12:50:15") + * @example SELECT HOUR(foo.bar) FROM entity + */ class Hour extends FunctionNode { + /** @var Node|string */ public $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/IfElse.php b/src/Query/Mysql/IfElse.php index a605a7dd..74ceb038 100644 --- a/src/Query/Mysql/IfElse.php +++ b/src/Query/Mysql/IfElse.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; @@ -9,9 +10,19 @@ use function sprintf; -/** @author Andrew Mackrodt */ +/** + * IfElseFunction ::= "IFELSE" "(" ConditionalExpression "," ArithmeticExpression "," ArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/flow-control-functions.html#function_if + * + * @author Andrew Mackrodt + * + * @example SELECT IFELSE(foo.bar > 2, 1, 0) FROM entity + * @example SELECT IFELSE(true, 0, 1) + */ class IfElse extends FunctionNode { + /** @var array */ private $expr = []; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/IfNull.php b/src/Query/Mysql/IfNull.php index 7fcebecf..bbcdf61c 100644 --- a/src/Query/Mysql/IfNull.php +++ b/src/Query/Mysql/IfNull.php @@ -2,16 +2,28 @@ namespace DoctrineExtensions\Query\Mysql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Andrew Mackrodt */ +/** + * IfNullFunction ::= "IFNULL" "(" ArithmeticExpression "," ArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/flow-control-functions.html#function_ifnull + * + * @author Andrew Mackrodt + * + * @example SELECT IFNULL(null, 2) + * @example SELECT IFNULL(foo.bar, 1) FROM entity + */ class IfNull extends FunctionNode { + /** @var ArithmeticExpression */ private $expr1; + /** @var ArithmeticExpression */ private $expr2; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/Inet6Aton.php b/src/Query/Mysql/Inet6Aton.php index 3f762a40..9dbae55e 100644 --- a/src/Query/Mysql/Inet6Aton.php +++ b/src/Query/Mysql/Inet6Aton.php @@ -9,6 +9,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "INET6_ATON" "(" StringPrimary ")" + */ class Inet6Aton extends FunctionNode { public $valueExpression = null; diff --git a/src/Query/Mysql/Inet6Ntoa.php b/src/Query/Mysql/Inet6Ntoa.php index f847baae..0c9d3be7 100644 --- a/src/Query/Mysql/Inet6Ntoa.php +++ b/src/Query/Mysql/Inet6Ntoa.php @@ -9,6 +9,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "INET6_NTOA" "(" StringPrimary ")" + */ class Inet6Ntoa extends FunctionNode { public $valueExpression = null; diff --git a/src/Query/Mysql/InetAton.php b/src/Query/Mysql/InetAton.php index 8038c1a8..08f82272 100644 --- a/src/Query/Mysql/InetAton.php +++ b/src/Query/Mysql/InetAton.php @@ -9,6 +9,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "INET_ATON" "(" StringPrimary ")" + */ class InetAton extends FunctionNode { public $valueExpression = null; diff --git a/src/Query/Mysql/InetNtoa.php b/src/Query/Mysql/InetNtoa.php index c5bde44e..aa4d1986 100644 --- a/src/Query/Mysql/InetNtoa.php +++ b/src/Query/Mysql/InetNtoa.php @@ -9,6 +9,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "INET_NTOA" "(" StringPrimary ")" + */ class InetNtoa extends FunctionNode { public $valueExpression = null; diff --git a/src/Query/Mysql/Instr.php b/src/Query/Mysql/Instr.php index 61596cc5..e3c2c227 100644 --- a/src/Query/Mysql/Instr.php +++ b/src/Query/Mysql/Instr.php @@ -9,6 +9,9 @@ use function sprintf; +/** + * "INSTR" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + */ class Instr extends FunctionNode { public $originalString = null; diff --git a/src/Query/Mysql/IsIpv4.php b/src/Query/Mysql/IsIpv4.php index 72e87fc3..475d4556 100644 --- a/src/Query/Mysql/IsIpv4.php +++ b/src/Query/Mysql/IsIpv4.php @@ -9,6 +9,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "IS_IPV4" "(" StringPrimary ")" + */ class IsIpv4 extends FunctionNode { public $valueExpression = null; diff --git a/src/Query/Mysql/IsIpv4Compat.php b/src/Query/Mysql/IsIpv4Compat.php index 544a2f14..e4569d4e 100644 --- a/src/Query/Mysql/IsIpv4Compat.php +++ b/src/Query/Mysql/IsIpv4Compat.php @@ -9,6 +9,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "NAME" "(" args ")" + */ class IsIpv4Compat extends FunctionNode { public $valueExpression = null; diff --git a/src/Query/Mysql/IsIpv4Mapped.php b/src/Query/Mysql/IsIpv4Mapped.php index 7aa6bc4c..9e85b2f9 100644 --- a/src/Query/Mysql/IsIpv4Mapped.php +++ b/src/Query/Mysql/IsIpv4Mapped.php @@ -9,6 +9,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "IS_IPV4_MAPPED" "(" StringPrimary ")" + */ class IsIpv4Mapped extends FunctionNode { public $valueExpression = null; diff --git a/src/Query/Mysql/IsIpv6.php b/src/Query/Mysql/IsIpv6.php index 19b7f74e..84ee1f81 100644 --- a/src/Query/Mysql/IsIpv6.php +++ b/src/Query/Mysql/IsIpv6.php @@ -9,6 +9,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "IS_IPV6" "(" StringPrimary ")" + */ class IsIpv6 extends FunctionNode { public $valueExpression = null; diff --git a/src/Query/Mysql/JsonContains.php b/src/Query/Mysql/JsonContains.php index 7406d399..23e2e0e1 100644 --- a/src/Query/Mysql/JsonContains.php +++ b/src/Query/Mysql/JsonContains.php @@ -9,6 +9,9 @@ use function sprintf; +/** + * "JSON_CONTAINS" "(" StringPrimary "," StringPrimary ["," StringPrimary] ")" + */ class JsonContains extends FunctionNode { protected $target; diff --git a/src/Query/Mysql/JsonDepth.php b/src/Query/Mysql/JsonDepth.php index b995b624..47c97e38 100644 --- a/src/Query/Mysql/JsonDepth.php +++ b/src/Query/Mysql/JsonDepth.php @@ -9,6 +9,9 @@ use function sprintf; +/** + * "JSON_DEPTH" "(" StringPrimary ")" + */ class JsonDepth extends FunctionNode { protected $target; diff --git a/src/Query/Mysql/JsonLength.php b/src/Query/Mysql/JsonLength.php index 5e39883e..d367aaea 100644 --- a/src/Query/Mysql/JsonLength.php +++ b/src/Query/Mysql/JsonLength.php @@ -9,6 +9,9 @@ use function sprintf; +/** + * "JSON_LENGTH" "(" StringPrimary ["," StringPrimary] ")" + */ class JsonLength extends FunctionNode { protected $target; diff --git a/src/Query/Mysql/Lag.php b/src/Query/Mysql/Lag.php index ced70dc1..c968ee21 100644 --- a/src/Query/Mysql/Lag.php +++ b/src/Query/Mysql/Lag.php @@ -10,6 +10,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "LAG" "(" StringExpression ["," ArithmeticPrimary ["," ArithmeticPrimary]] ")" + * + * @example SELECT LAG() + */ class Lag extends FunctionNode { /** @var AggregateExpression */ diff --git a/src/Query/Mysql/LastDay.php b/src/Query/Mysql/LastDay.php index faa832e2..09d7ac5a 100644 --- a/src/Query/Mysql/LastDay.php +++ b/src/Query/Mysql/LastDay.php @@ -8,6 +8,8 @@ use Doctrine\ORM\Query\TokenType; /** + * "LAST_DAY" "(" ArithmeticPrimary ")" + * * @author Rafael Kassner * @author Sarjono Mukti Aji */ diff --git a/src/Query/Mysql/Lead.php b/src/Query/Mysql/Lead.php index 9f43c736..c7ec2ab1 100644 --- a/src/Query/Mysql/Lead.php +++ b/src/Query/Mysql/Lead.php @@ -10,6 +10,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "LEAD" "(" StringExpression ["," ArithmeticPrimary ["," SimpleArithmeticExpression]] ")" + */ class Lead extends FunctionNode { /** @var AggregateExpression */ diff --git a/src/Query/Mysql/Least.php b/src/Query/Mysql/Least.php index 1347b2f0..fcca0040 100644 --- a/src/Query/Mysql/Least.php +++ b/src/Query/Mysql/Least.php @@ -9,7 +9,11 @@ use function count; -/** @author Vas N */ +/** + * "LEAST" "(" ArithmeticExpression {"," ArithmeticExpression}* ")" + * + * @author Vas N + */ class Least extends FunctionNode { private $field = null; diff --git a/src/Query/Mysql/Log.php b/src/Query/Mysql/Log.php index e2cbf699..a1ea015a 100644 --- a/src/Query/Mysql/Log.php +++ b/src/Query/Mysql/Log.php @@ -3,12 +3,17 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "LOG" "(" SimpleArithmeticExpression ")" + */ class Log extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Log10.php b/src/Query/Mysql/Log10.php index 691f85e5..83ef3fd9 100644 --- a/src/Query/Mysql/Log10.php +++ b/src/Query/Mysql/Log10.php @@ -3,12 +3,17 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "LOG10" "(" SimpleArithmeticExpression ")" + */ class Log10 extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Log2.php b/src/Query/Mysql/Log2.php index 2515b45a..ba24ca2e 100644 --- a/src/Query/Mysql/Log2.php +++ b/src/Query/Mysql/Log2.php @@ -3,12 +3,17 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "LOG2" "(" SimpleArithmeticExpression ")" + */ class Log2 extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Lpad.php b/src/Query/Mysql/Lpad.php index bb58823c..67799c72 100644 --- a/src/Query/Mysql/Lpad.php +++ b/src/Query/Mysql/Lpad.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Giulia Santoiemma */ +/** + * "LPAD" "(" ArithmeticPrimary "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @author Giulia Santoiemma + */ class Lpad extends FunctionNode { public $string = null; diff --git a/src/Query/Mysql/MakeDate.php b/src/Query/Mysql/MakeDate.php index 7cb17a56..f6adae82 100644 --- a/src/Query/Mysql/MakeDate.php +++ b/src/Query/Mysql/MakeDate.php @@ -7,6 +7,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "MAKEDATE" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + */ class MakeDate extends FunctionNode { public $year = null; diff --git a/src/Query/Mysql/MatchAgainst.php b/src/Query/Mysql/MatchAgainst.php index a555b4b0..19540d48 100644 --- a/src/Query/Mysql/MatchAgainst.php +++ b/src/Query/Mysql/MatchAgainst.php @@ -12,6 +12,9 @@ use function sprintf; use function strtolower; +/** + * ? + */ class MatchAgainst extends FunctionNode { /** @var array */ diff --git a/src/Query/Mysql/Md5.php b/src/Query/Mysql/Md5.php index 17299780..868c1da0 100644 --- a/src/Query/Mysql/Md5.php +++ b/src/Query/Mysql/Md5.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Andreas Gallien */ +/** + * "MD5" "(" StringPrimary ")" + * + * @author Andreas Gallien + */ class Md5 extends FunctionNode { public $stringPrimary; diff --git a/src/Query/Mysql/Minute.php b/src/Query/Mysql/Minute.php index ab174523..d1515f34 100644 --- a/src/Query/Mysql/Minute.php +++ b/src/Query/Mysql/Minute.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Martin Štekl */ +/** + * "MINUTE" "(" ArithmeticPrimary ")" + * + * @author Martin Štekl + */ class Minute extends FunctionNode { public $date; diff --git a/src/Query/Mysql/Month.php b/src/Query/Mysql/Month.php index 0d346cfd..14c7d748 100644 --- a/src/Query/Mysql/Month.php +++ b/src/Query/Mysql/Month.php @@ -8,6 +8,8 @@ use Doctrine\ORM\Query\TokenType; /** + * "MONTH" "(" ArithmeticPrimary ")" + * * @author Rafael Kassner * @author Sarjono Mukti Aji */ diff --git a/src/Query/Mysql/MonthName.php b/src/Query/Mysql/MonthName.php index 9668ad5f..aedf19df 100644 --- a/src/Query/Mysql/MonthName.php +++ b/src/Query/Mysql/MonthName.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Steve Lacey */ +/** + * "MONTHNAME" "(" ArithmeticPrimary ")" + * + * @author Steve Lacey + */ class MonthName extends FunctionNode { public $date; diff --git a/src/Query/Mysql/Now.php b/src/Query/Mysql/Now.php index cc33ada4..ffccea83 100644 --- a/src/Query/Mysql/Now.php +++ b/src/Query/Mysql/Now.php @@ -7,6 +7,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "NOW" "(" ")" + */ class Now extends FunctionNode { public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/NullIf.php b/src/Query/Mysql/NullIf.php index 5cc60802..61f873ea 100644 --- a/src/Query/Mysql/NullIf.php +++ b/src/Query/Mysql/NullIf.php @@ -9,7 +9,11 @@ use function sprintf; -/** @author Andrew Mackrodt */ +/** + * "NULLIF" "(" ArithmeticExpression "," ArithmeticExpression ")" + * + * @author Andrew Mackrodt + */ class NullIf extends FunctionNode { private $expr1; diff --git a/src/Query/Mysql/Over.php b/src/Query/Mysql/Over.php index 8eb125e1..7e1d327c 100644 --- a/src/Query/Mysql/Over.php +++ b/src/Query/Mysql/Over.php @@ -12,6 +12,9 @@ use function count; use function trim; +/** + * ArithmeticExpression "OVER" "(" [OrderByClause] ")" + */ class Over extends FunctionNode { /** @var ArithmeticExpression */ diff --git a/src/Query/Mysql/PeriodDiff.php b/src/Query/Mysql/PeriodDiff.php index ac7c792f..edc47d4b 100644 --- a/src/Query/Mysql/PeriodDiff.php +++ b/src/Query/Mysql/PeriodDiff.php @@ -7,6 +7,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "PERIOD_DIFF" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + */ class PeriodDiff extends FunctionNode { public $firstDateExpression = null; diff --git a/src/Query/Mysql/Pi.php b/src/Query/Mysql/Pi.php index f86dfc82..6f230735 100644 --- a/src/Query/Mysql/Pi.php +++ b/src/Query/Mysql/Pi.php @@ -7,6 +7,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "PI" "(" ")" + */ class Pi extends FunctionNode { public $arithmeticExpression; diff --git a/src/Query/Mysql/Power.php b/src/Query/Mysql/Power.php index 48a7ea0d..0f20b015 100644 --- a/src/Query/Mysql/Power.php +++ b/src/Query/Mysql/Power.php @@ -3,12 +3,17 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "POWER" "(" SimpleArithmeticExpression "," ArithmeticExpression ")" + */ class Power extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public $power; diff --git a/src/Query/Mysql/Quarter.php b/src/Query/Mysql/Quarter.php index 23d4da15..8cd5cdf0 100644 --- a/src/Query/Mysql/Quarter.php +++ b/src/Query/Mysql/Quarter.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Martin Štekl */ +/** + * "QUARTER" "(" ArithmeticPrimary ")" + * + * @author Martin Štekl + */ class Quarter extends FunctionNode { public $date; diff --git a/src/Query/Mysql/Radians.php b/src/Query/Mysql/Radians.php index e60105a3..f8337db9 100644 --- a/src/Query/Mysql/Radians.php +++ b/src/Query/Mysql/Radians.php @@ -3,12 +3,17 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "RADIANS" "(" SimpleArithmeticExpression ")" + */ class Radians extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Rand.php b/src/Query/Mysql/Rand.php index c28e3af0..74d35bb6 100644 --- a/src/Query/Mysql/Rand.php +++ b/src/Query/Mysql/Rand.php @@ -3,14 +3,17 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; -use Doctrine\ORM\Query\AST\SimpleArithmeticExpression; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "RAND" "(" [SimpleArithmeticExpression] ")" + */ class Rand extends FunctionNode { - /** @var SimpleArithmeticExpression */ + /** @var Node|string */ private $expression = null; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Regexp.php b/src/Query/Mysql/Regexp.php index 9d29b584..7a7aeb06 100644 --- a/src/Query/Mysql/Regexp.php +++ b/src/Query/Mysql/Regexp.php @@ -7,6 +7,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "(" StringPrimary "REGEXP" StringExpression ")" + */ class Regexp extends FunctionNode { public $value = null; diff --git a/src/Query/Mysql/Replace.php b/src/Query/Mysql/Replace.php index 22721d45..c71388e6 100644 --- a/src/Query/Mysql/Replace.php +++ b/src/Query/Mysql/Replace.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Jarek Kostrz */ +/** + * "REPLACE" "(" ArithmeticPrimary "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @author Jarek Kostrz + */ class Replace extends FunctionNode { public $search = null; diff --git a/src/Query/Mysql/Round.php b/src/Query/Mysql/Round.php index 3fbef6ef..712dedbc 100644 --- a/src/Query/Mysql/Round.php +++ b/src/Query/Mysql/Round.php @@ -3,14 +3,20 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "ROUND" "(" SimpleArithmeticExpression ["," ArithmeticPrimary] ")" + */ class Round extends FunctionNode { + /** @var Node|string */ private $firstExpression = null; + /** @var Node|string|null */ private $secondExpression = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/Rpad.php b/src/Query/Mysql/Rpad.php index 56d36ccd..1ce851bb 100644 --- a/src/Query/Mysql/Rpad.php +++ b/src/Query/Mysql/Rpad.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Giulia Santoiemma */ +/** + * "RPAD" "(" ArithmeticPrimary "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @author Giulia Santoiemma + */ class Rpad extends FunctionNode { public $string = null; diff --git a/src/Query/Mysql/SecToTime.php b/src/Query/Mysql/SecToTime.php index adcf073f..8bc4fef3 100644 --- a/src/Query/Mysql/SecToTime.php +++ b/src/Query/Mysql/SecToTime.php @@ -8,6 +8,8 @@ use Doctrine\ORM\Query\TokenType; /** + * "SEC_TO_TIME" "(" ArithmeticPrimary ")" + * * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_sec-to-time * * @example SELECT SEC_TO_TIME(2378); diff --git a/src/Query/Mysql/Second.php b/src/Query/Mysql/Second.php index de641074..46314914 100644 --- a/src/Query/Mysql/Second.php +++ b/src/Query/Mysql/Second.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Martin Štekl */ +/** + * "SECOND" "(" ArithmeticPrimary ")" + * + * @author Martin Štekl + */ class Second extends FunctionNode { public $date; diff --git a/src/Query/Mysql/Sha1.php b/src/Query/Mysql/Sha1.php index 4a9390bd..2ec84cd4 100644 --- a/src/Query/Mysql/Sha1.php +++ b/src/Query/Mysql/Sha1.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Andreas Gallien */ +/** + * "SHA1" "(" StringPrimary ")" + * + * @author Andreas Gallien + */ class Sha1 extends FunctionNode { public $stringPrimary; diff --git a/src/Query/Mysql/Sha2.php b/src/Query/Mysql/Sha2.php index 0f1e6ea7..76c60748 100644 --- a/src/Query/Mysql/Sha2.php +++ b/src/Query/Mysql/Sha2.php @@ -3,15 +3,21 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Andreas Gallien */ +/** + * "SHA2" "(" StringPrimary "," SimpleArithmeticExpression ")" + * + * @author Andreas Gallien + */ class Sha2 extends FunctionNode { public $stringPrimary; + /** @var Node|string */ public $simpleArithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Sin.php b/src/Query/Mysql/Sin.php index d2de1ce5..1619e831 100644 --- a/src/Query/Mysql/Sin.php +++ b/src/Query/Mysql/Sin.php @@ -3,12 +3,17 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "SIN" "(" SimpleArithmeticExpression ")" + */ class Sin extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Soundex.php b/src/Query/Mysql/Soundex.php index dce20b7b..f12cd54e 100644 --- a/src/Query/Mysql/Soundex.php +++ b/src/Query/Mysql/Soundex.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Steve Tauber */ +/** + * "SOUNDEX" "(" StringPrimary ")" + * + * @author Steve Tauber + */ class Soundex extends FunctionNode { public $stringPrimary; diff --git a/src/Query/Mysql/Std.php b/src/Query/Mysql/Std.php index 468fc0ec..a2a6cbc7 100644 --- a/src/Query/Mysql/Std.php +++ b/src/Query/Mysql/Std.php @@ -3,15 +3,21 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; -/** @author Toni Uebernickel */ +/** + * "STD" "(" SimpleArithmeticExpression ")" + * + * @author Toni Uebernickel + */ class Std extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/StdDev.php b/src/Query/Mysql/StdDev.php index e238ea98..8fd69a68 100644 --- a/src/Query/Mysql/StdDev.php +++ b/src/Query/Mysql/StdDev.php @@ -3,15 +3,21 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; -/** @author Joachim Schirrmacher */ +/** + * "STDDEV" "(" SimpleArithmeticExpression ")" + * + * @author Joachim Schirrmacher + */ class StdDev extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/StrToDate.php b/src/Query/Mysql/StrToDate.php index 0ad9d144..6a0bf947 100644 --- a/src/Query/Mysql/StrToDate.php +++ b/src/Query/Mysql/StrToDate.php @@ -7,6 +7,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "STR_TO_DATE" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + */ class StrToDate extends FunctionNode { public $dateString = null; diff --git a/src/Query/Mysql/SubstringIndex.php b/src/Query/Mysql/SubstringIndex.php index f690763f..76e213f2 100644 --- a/src/Query/Mysql/SubstringIndex.php +++ b/src/Query/Mysql/SubstringIndex.php @@ -9,6 +9,9 @@ use function sprintf; +/** + * "SUBSTRING_INDEX" "(" ArithmeticPrimary "," ArithmeticPrimary "," ArithmeticFactor ")" + */ class SubstringIndex extends FunctionNode { public $string = null; diff --git a/src/Query/Mysql/Tan.php b/src/Query/Mysql/Tan.php index 4d5a1472..79bea245 100644 --- a/src/Query/Mysql/Tan.php +++ b/src/Query/Mysql/Tan.php @@ -3,12 +3,17 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "TAN" "(" SimpleArithmeticExpression ")" + */ class Tan extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Time.php b/src/Query/Mysql/Time.php index aef5c42d..92356009 100644 --- a/src/Query/Mysql/Time.php +++ b/src/Query/Mysql/Time.php @@ -8,6 +8,8 @@ use Doctrine\ORM\Query\TokenType; /** + * "TIME" "(" ArithmeticPrimary ")" + * * @author Steve Lacey * @author James Rohacik */ diff --git a/src/Query/Mysql/TimeDiff.php b/src/Query/Mysql/TimeDiff.php index c8853087..0dff3b7f 100644 --- a/src/Query/Mysql/TimeDiff.php +++ b/src/Query/Mysql/TimeDiff.php @@ -9,6 +9,9 @@ use function sprintf; +/** + * "TIMEDIFF" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + */ class TimeDiff extends FunctionNode { public $firstDateExpression = null; diff --git a/src/Query/Mysql/TimeToSec.php b/src/Query/Mysql/TimeToSec.php index a1fe1d00..f4cfadf5 100644 --- a/src/Query/Mysql/TimeToSec.php +++ b/src/Query/Mysql/TimeToSec.php @@ -8,6 +8,8 @@ use Doctrine\ORM\Query\TokenType; /** + * "TIME_TO_SEC" "(" ArithmeticPrimary ")" + * * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_time-to-sec * * @example SELECT TIME_TO_SEC('22:23:00'); diff --git a/src/Query/Mysql/TimestampAdd.php b/src/Query/Mysql/TimestampAdd.php index 2121c3bb..9a2be8c8 100644 --- a/src/Query/Mysql/TimestampAdd.php +++ b/src/Query/Mysql/TimestampAdd.php @@ -9,7 +9,11 @@ use function sprintf; -/** @author Alessandro Tagliapietra */ +/** + * "TIMESTAMPADD" "(" Identifier "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @author Alessandro Tagliapietra + */ class TimestampAdd extends FunctionNode { public $firstDatetimeExpression = null; diff --git a/src/Query/Mysql/TimestampDiff.php b/src/Query/Mysql/TimestampDiff.php index 9afc99fd..7f39df5c 100644 --- a/src/Query/Mysql/TimestampDiff.php +++ b/src/Query/Mysql/TimestampDiff.php @@ -9,7 +9,11 @@ use function sprintf; -/** @author Przemek Sobstel */ +/** + * "TIMESTAMPDIFF" "(" Identifier "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @author Przemek Sobstel + */ class TimestampDiff extends FunctionNode { public $firstDatetimeExpression = null; diff --git a/src/Query/Mysql/Truncate.php b/src/Query/Mysql/Truncate.php index 9187fe98..0fc6f685 100644 --- a/src/Query/Mysql/Truncate.php +++ b/src/Query/Mysql/Truncate.php @@ -3,15 +3,22 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Evgeny Savich */ +/** + * "TRUNCATE" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")" + * + * @author Evgeny Savich + */ class Truncate extends FunctionNode { + /** @var Node|string */ public $numberExpression = null; + /** @var Node|string */ public $patternExpression = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/Unhex.php b/src/Query/Mysql/Unhex.php index ef511cd4..52e5f09a 100644 --- a/src/Query/Mysql/Unhex.php +++ b/src/Query/Mysql/Unhex.php @@ -3,12 +3,17 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "UNHEX" "(" SimpleArithmeticExpression ")" + */ class Unhex extends FunctionNode { + /** @var Node|string */ public $arithmeticExpression; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/UnixTimestamp.php b/src/Query/Mysql/UnixTimestamp.php index 6f5b81bb..a8005fd4 100644 --- a/src/Query/Mysql/UnixTimestamp.php +++ b/src/Query/Mysql/UnixTimestamp.php @@ -10,6 +10,8 @@ use function sprintf; /** + * "UNIX_TIMESTAMP" "(" [ArithmeticPrimary] ")" + * * @author Rafael Kassner * @author Oleg Khussainov */ diff --git a/src/Query/Mysql/UtcTimestamp.php b/src/Query/Mysql/UtcTimestamp.php index f0baba01..4d6fcdc0 100644 --- a/src/Query/Mysql/UtcTimestamp.php +++ b/src/Query/Mysql/UtcTimestamp.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Marius Krämer */ +/** + * "UTC_TIMESTAMP" "(" ")" + * + * @author Marius Krämer + */ class UtcTimestamp extends FunctionNode { public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/UuidShort.php b/src/Query/Mysql/UuidShort.php index 50011e5a..1f55bec7 100644 --- a/src/Query/Mysql/UuidShort.php +++ b/src/Query/Mysql/UuidShort.php @@ -7,6 +7,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "UUID_SHORT" "(" ")" + */ class UuidShort extends FunctionNode { public $arithmeticExpression; diff --git a/src/Query/Mysql/Variance.php b/src/Query/Mysql/Variance.php index df6ba3ec..870a04f1 100644 --- a/src/Query/Mysql/Variance.php +++ b/src/Query/Mysql/Variance.php @@ -3,16 +3,19 @@ namespace DoctrineExtensions\Query\Mysql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; -use Doctrine\ORM\Query\AST\SimpleArithmeticExpression; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * "VARIANCE" "(" SimpleArithmeticExpression ")" + */ class Variance extends FunctionNode { - /** @var SimpleArithmeticExpression */ + /** @var Node|string */ protected $arithmeticExpression; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/Week.php b/src/Query/Mysql/Week.php index 1bc0c575..a646e3ec 100644 --- a/src/Query/Mysql/Week.php +++ b/src/Query/Mysql/Week.php @@ -8,6 +8,8 @@ use Doctrine\ORM\Query\TokenType; /** + * "WEEK" "(" ArithmeticPrimary ["," Literal] ")" + * * @author Rafael Kassner * @author Sarjono Mukti Aji * @author Łukasz Nowicki diff --git a/src/Query/Mysql/WeekDay.php b/src/Query/Mysql/WeekDay.php index 17da16e4..5a12e372 100644 --- a/src/Query/Mysql/WeekDay.php +++ b/src/Query/Mysql/WeekDay.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Pavlo Cherniavskyi */ +/** + * "WEEKDAY" "(" ArithmeticPrimary ")" + * + * @author Pavlo Cherniavskyi + */ class WeekDay extends FunctionNode { private $date; diff --git a/src/Query/Mysql/WeekOfYear.php b/src/Query/Mysql/WeekOfYear.php index 708dafee..ca491252 100644 --- a/src/Query/Mysql/WeekOfYear.php +++ b/src/Query/Mysql/WeekOfYear.php @@ -7,6 +7,9 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "WEEKOFYEAR" "(" ArithmeticPrimary ")" + */ class WeekOfYear extends FunctionNode { private $date; diff --git a/src/Query/Mysql/Year.php b/src/Query/Mysql/Year.php index 29bcd586..e13f44e3 100644 --- a/src/Query/Mysql/Year.php +++ b/src/Query/Mysql/Year.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Rafael Kassner */ +/** + * "YEAR" "(" ArithmeticPrimary ")" + * + * @author Rafael Kassner + */ class Year extends FunctionNode { public $date; diff --git a/src/Query/Mysql/YearMonth.php b/src/Query/Mysql/YearMonth.php index 9db21a4b..158f7187 100644 --- a/src/Query/Mysql/YearMonth.php +++ b/src/Query/Mysql/YearMonth.php @@ -9,6 +9,9 @@ use function sprintf; +/** + * "EXTRACT" "(" "YEAR_MONTH" "FROM" ArithmeticPrimary ")" + */ class YearMonth extends FunctionNode { public $date; diff --git a/src/Query/Mysql/YearWeek.php b/src/Query/Mysql/YearWeek.php index d8c61e77..22e6d46d 100644 --- a/src/Query/Mysql/YearWeek.php +++ b/src/Query/Mysql/YearWeek.php @@ -7,7 +7,11 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Michael Kimpton */ +/** + * "YEARWEEK" "(" ArithmeticPrimary ["," Literal] ")" + * + * @author Michael Kimpton + */ class YearWeek extends FunctionNode { public $date; diff --git a/src/Query/Oracle/Floor.php b/src/Query/Oracle/Floor.php index 3f33e7a5..40e1b14c 100644 --- a/src/Query/Oracle/Floor.php +++ b/src/Query/Oracle/Floor.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Oracle; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; @@ -12,6 +13,7 @@ /** @author Jefferson Vantuir */ class Floor extends FunctionNode { + /** @var ArithmeticExpression $number */ private $number; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Postgresql/AtTimeZoneFunction.php b/src/Query/Postgresql/AtTimeZoneFunction.php index a6fe984d..4b39fc12 100644 --- a/src/Query/Postgresql/AtTimeZoneFunction.php +++ b/src/Query/Postgresql/AtTimeZoneFunction.php @@ -3,6 +3,7 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; @@ -11,11 +12,20 @@ /** * AtTimeZoneFunction ::= "AT_TIME_ZONE" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT + * + * @example SELECT AT_TIME_ZONE("2021-05-06", "CEST") + * @example SELECT AT_TIME_ZONE(foo.bar, "CEST") FROM entity + * + * @todo rename class to AtTimeZone */ class AtTimeZoneFunction extends FunctionNode { + /** @var Node|string */ public $dateExpression = null; + /** @var Node|string */ public $timezoneExpression = null; public function parse(Parser $parser): void diff --git a/src/Query/Postgresql/CountFilterFunction.php b/src/Query/Postgresql/CountFilterFunction.php index d65e07d9..1445cb82 100644 --- a/src/Query/Postgresql/CountFilterFunction.php +++ b/src/Query/Postgresql/CountFilterFunction.php @@ -3,6 +3,8 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; +use Doctrine\ORM\Query\AST\WhereClause; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; @@ -11,11 +13,19 @@ /** * CountFilterFunction ::= "COUNT_FILTER" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-AGGREGATES + * + * @example SELECT COUNT_FILTER(*, WHERE foo.bar < 3) FROM entity + * + * @todo rename class to CountFilter */ class CountFilterFunction extends FunctionNode { + /** @var Node|string */ public $countExpression = null; + /** @var WhereClause */ public $whereExpression = null; public function parse(Parser $parser): void diff --git a/src/Query/Postgresql/Date.php b/src/Query/Postgresql/Date.php index 9c032794..5869fc65 100644 --- a/src/Query/Postgresql/Date.php +++ b/src/Query/Postgresql/Date.php @@ -3,12 +3,17 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * DateFunction ::= "DATE" "(" ArithmeticPrimary ")" + */ class Date extends FunctionNode { + /** @var Node|string */ public $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Postgresql/DateFormat.php b/src/Query/Postgresql/DateFormat.php index e533e228..6a1a1994 100644 --- a/src/Query/Postgresql/DateFormat.php +++ b/src/Query/Postgresql/DateFormat.php @@ -2,16 +2,28 @@ namespace DoctrineExtensions\Query\Postgresql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Silvio */ +/** + * DateFormatFunction ::= "DATE_FORMAT" "(" ArithmeticExpression "," StringPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-formatting.html#FUNCTIONS-FORMATTING-TABLE + * + * @author Silvio + * + * @example SELECT DATE_FORMAT(foo.bar, "HH23:MI:SS") + */ class DateFormat extends FunctionNode { + /** @var ArithmeticExpression */ public $dateExpression = null; + /** @var Node */ public $patternExpression = null; public function parse(Parser $parser): void diff --git a/src/Query/Postgresql/DatePart.php b/src/Query/Postgresql/DatePart.php index bf6d18cd..9dd4f57d 100644 --- a/src/Query/Postgresql/DatePart.php +++ b/src/Query/Postgresql/DatePart.php @@ -3,15 +3,26 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Geovani Roggeo */ +/** + * DatePartFunction ::= "DATE_PART" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-TABLE + * + * @author Geovani Roggeo + * + * @example SELECT DATE_PART("YEAR", foo.bar) FROM entity + */ class DatePart extends FunctionNode { + /** @var Node|string */ public $dateString = null; + /** @var Node|string */ public $dateFormat = null; public function parse(Parser $parser): void diff --git a/src/Query/Postgresql/DateTrunc.php b/src/Query/Postgresql/DateTrunc.php index 8ea90b51..32cf0a53 100644 --- a/src/Query/Postgresql/DateTrunc.php +++ b/src/Query/Postgresql/DateTrunc.php @@ -3,16 +3,26 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * DateTruncFunction ::= "DATE_TRUNC" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC + * + * @example SELECT DATE_TRUNC('hour', foo.bar) FROM entity + */ class DateTrunc extends FunctionNode { + /** @var Node|string */ public $fieldText = null; + /** @var Node|string */ public $fieldTimestamp = null; public function parse(Parser $parser): void diff --git a/src/Query/Postgresql/Day.php b/src/Query/Postgresql/Day.php index 6f83b79a..98211268 100644 --- a/src/Query/Postgresql/Day.php +++ b/src/Query/Postgresql/Day.php @@ -3,14 +3,23 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * DayFunction ::= "DAY" "(" ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT + * + * @example SELECT DAY(foo.bar) FROM entity + */ class Day extends FunctionNode { + /** @var Node|string */ private $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Postgresql/ExtractFunction.php b/src/Query/Postgresql/ExtractFunction.php index f13da1bb..18e80398 100644 --- a/src/Query/Postgresql/ExtractFunction.php +++ b/src/Query/Postgresql/ExtractFunction.php @@ -12,6 +12,15 @@ use function sprintf; +/** + * ExtractFunction ::= "EXTRACT" "(" Identifier "," ScalarExpression ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT + * + * @example SELECT EXTRACT(MONTH foo.bar) FROM entity + * + * @todo rename class to Extract + */ class ExtractFunction extends FunctionNode { /** @var string */ diff --git a/src/Query/Postgresql/Greatest.php b/src/Query/Postgresql/Greatest.php index 652fafd8..96189808 100644 --- a/src/Query/Postgresql/Greatest.php +++ b/src/Query/Postgresql/Greatest.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Postgresql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; @@ -10,14 +11,24 @@ use function count; /** + * GreatestFunction ::= "GREATEST" "(" ArithmeticExpression "," ArithmeticExpression [{ "," ArithmeticExpression }*] ")" + * + * @link https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-GREATEST-LEAST + * * @author Vas N * @author Guven Atbakan * @author Leonardo B Motyczka + * + * @example SELECT(1, 2) + * @example SELECT(1, 2, 100, 10) + * @example SELECT(foo.bar, foo.bar2) FROM entity */ class Greatest extends FunctionNode { + /** @var ArithmeticExpression */ private $field = null; + /** @var array */ private $values = []; public function parse(Parser $parser): void diff --git a/src/Query/Postgresql/Hour.php b/src/Query/Postgresql/Hour.php index 1e1c66c4..7bad674e 100644 --- a/src/Query/Postgresql/Hour.php +++ b/src/Query/Postgresql/Hour.php @@ -3,14 +3,23 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * HourFunction ::= "HOUR" "(" ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT + * + * @example SELECT HOUR(foo.bar) FROM entity + */ class Hour extends FunctionNode { + /** @var Node|string */ private $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Postgresql/Least.php b/src/Query/Postgresql/Least.php index f5986bcb..94c36fd7 100644 --- a/src/Query/Postgresql/Least.php +++ b/src/Query/Postgresql/Least.php @@ -2,6 +2,7 @@ namespace DoctrineExtensions\Query\Postgresql; +use Doctrine\ORM\Query\AST\ArithmeticExpression; use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; @@ -10,13 +11,21 @@ use function count; /** + * LeastFunction ::= "LEAST" "(" ArithmeticExpression {"," ArithmeticExpression}* ")" + * + * @link https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-GREATEST-LEAST + * * @author Vas N * @author Leonardo B Motyczka + * + * @example SELECT LEAST(foo.bar, foo.bar2, foo.bar2) FROM entity */ class Least extends FunctionNode { + /** @var ArithmeticExpression */ private $field = null; + /** @var array */ private $values = []; public function parse(Parser $parser): void diff --git a/src/Query/Postgresql/Minute.php b/src/Query/Postgresql/Minute.php index 7a74b0ee..432a5677 100644 --- a/src/Query/Postgresql/Minute.php +++ b/src/Query/Postgresql/Minute.php @@ -3,14 +3,23 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * MinuteFunction ::= "MINUTE" "(" ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT + * + * @example SELECT MINUTE(foo.bar) FROM entity + */ class Minute extends FunctionNode { + /** @var Node|string */ private $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Postgresql/Month.php b/src/Query/Postgresql/Month.php index d0550203..6059c3e5 100644 --- a/src/Query/Postgresql/Month.php +++ b/src/Query/Postgresql/Month.php @@ -3,14 +3,23 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * MonthFunction ::= "MONTH" "(" ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT + * + * @example SELECT MONTH(foo.bar) FROM entity + */ class Month extends FunctionNode { + /** @var Node|string */ private $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Postgresql/RegexpReplace.php b/src/Query/Postgresql/RegexpReplace.php index eb4f4d8b..4e6ad56d 100644 --- a/src/Query/Postgresql/RegexpReplace.php +++ b/src/Query/Postgresql/RegexpReplace.php @@ -3,21 +3,28 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; +use Doctrine\ORM\Query\AST\Subselect; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; /** + * RegexpReplaceFunction ::= "REGEXP_REPLACE" "(" StringPrimary "," StringExpression "," StringExpression ")" + * * @link https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-POSIX-TABLE * * @example SELECT REGEXP_REPLACE(string, search, replace) */ class RegexpReplace extends FunctionNode { + /** @var Node */ private $string; + /** @var Subselect|Node|string */ private $search; + /** @var Subselect|Node|string */ private $replace; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Postgresql/Second.php b/src/Query/Postgresql/Second.php index d9fedfe6..a88645fc 100644 --- a/src/Query/Postgresql/Second.php +++ b/src/Query/Postgresql/Second.php @@ -3,14 +3,23 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * SecondFunction ::= "SECOND" "(" ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT + * + * @example SELECT SECOND(foo.bar) FROM entity + */ class Second extends FunctionNode { + /** @var Node|string */ private $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Postgresql/StrToDate.php b/src/Query/Postgresql/StrToDate.php index 352c284d..f607b15d 100644 --- a/src/Query/Postgresql/StrToDate.php +++ b/src/Query/Postgresql/StrToDate.php @@ -3,14 +3,24 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * StrToDateFunction ::= "STR_TO_DATE" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-formatting.html#FUNCTIONS-FORMATTING-TABLE + * + * @example SELECT STR_TO_DATE(foo.bar, "YYYY-MM-DD") FROM entity + */ class StrToDate extends FunctionNode { + /** @var Node|string */ public $dateString = null; + /** @var Node|string */ public $dateFormat = null; public function parse(Parser $parser): void diff --git a/src/Query/Postgresql/StringAgg.php b/src/Query/Postgresql/StringAgg.php index 49905ba3..2408bec1 100644 --- a/src/Query/Postgresql/StringAgg.php +++ b/src/Query/Postgresql/StringAgg.php @@ -3,6 +3,8 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; +use Doctrine\ORM\Query\AST\OrderByClause; use Doctrine\ORM\Query\AST\PathExpression; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; @@ -11,17 +13,27 @@ use function sprintf; /** + * StringAggFunction ::= "STRING_AGG" "(" ["DISTINCT"] PathExpression "," StringPrimary [ OrderByClause ] ")" + * + * @link https://www.postgresql.org/docs/9.0/sql-expressions.html#SYNTAX-AGGREGATES + * * @author Roberto Júnior * @author Vaskevich Eugeniy + * + * @example SELECT STRING_AGG(DISTINCT foo.bar, "," ORDER BY foo.bar) FROM entity */ class StringAgg extends FunctionNode { + /** @var OrderByClause */ private $orderBy = null; + /** @var PathExpression */ private $expression = null; + /** @var Node */ private $delimiter = null; + /** @var bool */ private $isDistinct = false; public function parse(Parser $parser): void diff --git a/src/Query/Postgresql/Year.php b/src/Query/Postgresql/Year.php index bed71d5b..f85060b8 100644 --- a/src/Query/Postgresql/Year.php +++ b/src/Query/Postgresql/Year.php @@ -3,14 +3,23 @@ namespace DoctrineExtensions\Query\Postgresql; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * YearFunction ::= "YEAR" "(" ArithmeticPrimary ")" + * + * @link https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT + * + * @example SELECT YEAR(foo.bar) FROM entity + */ class Year extends FunctionNode { + /** @var Node|string */ private $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Sqlite/Round.php b/src/Query/Sqlite/Round.php index 27c8b0a5..b5949f7b 100644 --- a/src/Query/Sqlite/Round.php +++ b/src/Query/Sqlite/Round.php @@ -3,6 +3,7 @@ namespace DoctrineExtensions\Query\Sqlite; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; @@ -10,8 +11,10 @@ /** @author winkbrace */ class Round extends FunctionNode { + /** @var Node|string */ private $firstExpression = null; + /** @var Node|string|null */ private $secondExpression = null; public function parse(Parser $parser): void