From 174a80d9c0ba04882c2e970277702dd25df8823d Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Fri, 1 Mar 2024 10:12:48 +0100 Subject: [PATCH 1/2] Add missing PhpDoc --- phpstan-baseline.neon | 25 -------------------- 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 | 13 +++++++++- 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 | 10 ++++++++ src/Query/Mysql/Inet6Ntoa.php | 10 ++++++++ src/Query/Mysql/InetAton.php | 9 +++++++ src/Query/Mysql/InetNtoa.php | 9 +++++++ src/Query/Mysql/Instr.php | 11 +++++++++ src/Query/Mysql/IsIpv4.php | 9 +++++++ src/Query/Mysql/IsIpv4Compat.php | 9 +++++++ src/Query/Mysql/IsIpv4Mapped.php | 9 +++++++ src/Query/Mysql/IsIpv6.php | 9 +++++++ src/Query/Mysql/JsonContains.php | 14 ++++++++++- src/Query/Mysql/JsonDepth.php | 9 +++++++ src/Query/Mysql/JsonLength.php | 12 +++++++++- src/Query/Mysql/Lag.php | 17 ++++++++----- src/Query/Mysql/LastDay.php | 9 +++++++ src/Query/Mysql/Lead.php | 7 ++++++ src/Query/Mysql/Least.php | 8 ++++++- src/Query/Mysql/Log.php | 9 +++++++ src/Query/Mysql/Log10.php | 9 +++++++ src/Query/Mysql/Log2.php | 9 +++++++ src/Query/Mysql/Lpad.php | 8 ++++++- src/Query/Mysql/MakeDate.php | 7 ++++++ src/Query/Mysql/MatchAgainst.php | 7 ++++++ src/Query/Mysql/Md5.php | 8 ++++++- src/Query/Mysql/Minute.php | 8 ++++++- src/Query/Mysql/Month.php | 4 ++++ src/Query/Mysql/MonthName.php | 8 ++++++- src/Query/Mysql/Now.php | 7 ++++++ src/Query/Mysql/NullIf.php | 8 ++++++- src/Query/Mysql/Over.php | 3 +++ src/Query/Mysql/PeriodDiff.php | 7 ++++++ src/Query/Mysql/Pi.php | 7 ++++++ src/Query/Mysql/Power.php | 9 +++++++ src/Query/Mysql/Quarter.php | 8 ++++++- src/Query/Mysql/Radians.php | 9 +++++++ src/Query/Mysql/Rand.php | 11 +++++++-- src/Query/Mysql/Regexp.php | 3 +++ src/Query/Mysql/Replace.php | 6 ++++- src/Query/Mysql/Round.php | 10 ++++++++ src/Query/Mysql/Rpad.php | 8 ++++++- src/Query/Mysql/SecToTime.php | 2 ++ src/Query/Mysql/Second.php | 8 ++++++- src/Query/Mysql/Sha1.php | 8 ++++++- src/Query/Mysql/Sha2.php | 10 +++++++- src/Query/Mysql/Sin.php | 9 +++++++ src/Query/Mysql/Soundex.php | 8 ++++++- src/Query/Mysql/Std.php | 10 +++++++- src/Query/Mysql/StdDev.php | 10 +++++++- src/Query/Mysql/StrToDate.php | 7 ++++++ src/Query/Mysql/SubstringIndex.php | 7 ++++++ src/Query/Mysql/Tan.php | 9 +++++++ src/Query/Mysql/Time.php | 4 ++++ src/Query/Mysql/TimeDiff.php | 7 ++++++ src/Query/Mysql/TimeToSec.php | 2 ++ src/Query/Mysql/TimestampAdd.php | 8 ++++++- src/Query/Mysql/TimestampDiff.php | 8 ++++++- src/Query/Mysql/Truncate.php | 11 ++++++++- src/Query/Mysql/Unhex.php | 9 +++++++ src/Query/Mysql/UnixTimestamp.php | 4 ++++ src/Query/Mysql/UtcTimestamp.php | 8 ++++++- src/Query/Mysql/UuidShort.php | 3 +++ src/Query/Mysql/Variance.php | 11 +++++++-- src/Query/Mysql/Week.php | 4 ++++ src/Query/Mysql/WeekDay.php | 8 ++++++- src/Query/Mysql/WeekOfYear.php | 7 ++++++ src/Query/Mysql/Year.php | 8 ++++++- src/Query/Mysql/YearMonth.php | 7 ++++++ src/Query/Mysql/YearWeek.php | 10 +++++++- 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, 1191 insertions(+), 90 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 1be4cd71..5d02d187 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,20 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lag\\:\\:\\$aggregateExpression \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\AggregateExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" - count: 1 - path: src/Query/Mysql/Lag.php - - - - message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lag\\:\\:\\$defaultValue \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\SimpleArithmeticExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" - count: 1 - path: src/Query/Mysql/Lag.php - - - - message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lag\\:\\:\\$offset \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" - count: 1 - path: src/Query/Mysql/Lag.php - - message: "#^Property DoctrineExtensions\\\\Query\\\\Mysql\\\\Lead\\:\\:\\$aggregateExpression \\(Doctrine\\\\ORM\\\\Query\\\\AST\\\\AggregateExpression\\) does not accept Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#" count: 1 @@ -29,13 +14,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..44c073ca 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..4b2f0db4 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..21d919e0 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..e0080c39 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..9d471b64 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..4387cb41 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..5677d4d1 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..89d486a3 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..193383ba 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..e025f814 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..d350cfbe 100644 --- a/src/Query/Mysql/Format.php +++ b/src/Query/Mysql/Format.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 Wally Noveno */ +/** + * FormatFunction ::= "FORMAT" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_format + * + * @author Wally Noveno + * + * @example SELECT FORMAT(foo.bar, 2) FROM entity + */ 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..201024b5 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..90de5ba3 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..48a886dc 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..6bce8b1f 100644 --- a/src/Query/Mysql/Inet6Aton.php +++ b/src/Query/Mysql/Inet6Aton.php @@ -9,8 +9,18 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * Inet6AtonFunction ::= "INET6_ATON" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_inet6-aton + * + * @example SELECT INET6_ATON('127.0.0.1') + * @example SELECT HEX(INET6_ATON('127.0.0.1')) + * @example SELECT HEX(INET6_ATON(foo.bar)) FROM entity + */ class Inet6Aton extends FunctionNode { + /** @var Node */ public $valueExpression = null; /** @throws QueryException */ diff --git a/src/Query/Mysql/Inet6Ntoa.php b/src/Query/Mysql/Inet6Ntoa.php index f847baae..e74edb30 100644 --- a/src/Query/Mysql/Inet6Ntoa.php +++ b/src/Query/Mysql/Inet6Ntoa.php @@ -9,8 +9,18 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * Inet6NtoaFunction ::= "INET6_NTOA" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_inet6-ntoa + * + * @example SELECT INET6_NTOA(0x7F000001) + * @example SELECT INET6_NTOA(UNHEX("7F000001")) + * @example SELECT INET6_NTOA(foo.bar) FROM entity + */ class Inet6Ntoa extends FunctionNode { + /** @var Node */ public $valueExpression = null; /** @throws QueryException */ diff --git a/src/Query/Mysql/InetAton.php b/src/Query/Mysql/InetAton.php index 8038c1a8..60f83198 100644 --- a/src/Query/Mysql/InetAton.php +++ b/src/Query/Mysql/InetAton.php @@ -9,8 +9,17 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * InetAtonFunction ::= "INET_ATON" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_inet-aton + * + * @example SELECT INET_ATON('127.0.0.1') + * @example SELECT INET_ATON(foo.bar) FROM entity + */ class InetAton extends FunctionNode { + /** @var Node */ public $valueExpression = null; /** @throws QueryException */ diff --git a/src/Query/Mysql/InetNtoa.php b/src/Query/Mysql/InetNtoa.php index c5bde44e..f31ce78f 100644 --- a/src/Query/Mysql/InetNtoa.php +++ b/src/Query/Mysql/InetNtoa.php @@ -9,8 +9,17 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * InetNtoaFunction ::= "INET_NTOA" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_inet-ntoa + * + * @example SELECT INET_NTOA(2130706433) + * @example SELECT INET_NTOA(foo.bar) FROM entity + */ class InetNtoa extends FunctionNode { + /** @var Node */ public $valueExpression = null; /** @throws QueryException */ diff --git a/src/Query/Mysql/Instr.php b/src/Query/Mysql/Instr.php index 61596cc5..ddd4aaed 100644 --- a/src/Query/Mysql/Instr.php +++ b/src/Query/Mysql/Instr.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\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * InstrFunction ::= "INSTR" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_instr + * + * @example SELECT INSTR('foobar', 'bar') + * @example SELECT INSTR(foo.bar, 'bar') FROM entity + */ class Instr extends FunctionNode { + /** @var Node|string */ public $originalString = null; + /** @var Node|string */ public $subString = null; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/IsIpv4.php b/src/Query/Mysql/IsIpv4.php index 72e87fc3..b85fb281 100644 --- a/src/Query/Mysql/IsIpv4.php +++ b/src/Query/Mysql/IsIpv4.php @@ -9,8 +9,17 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * IsIpv4Function ::= "IS_IPV4" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_is-ipv4 + * + * @example SELECT IS_IPV4('127.0.0.1') + * @example SELECT IS_IPV4(foo.bar) FROM entity + */ class IsIpv4 extends FunctionNode { + /** @var Node */ public $valueExpression = null; /** @throws QueryException */ diff --git a/src/Query/Mysql/IsIpv4Compat.php b/src/Query/Mysql/IsIpv4Compat.php index 544a2f14..6a907a88 100644 --- a/src/Query/Mysql/IsIpv4Compat.php +++ b/src/Query/Mysql/IsIpv4Compat.php @@ -9,8 +9,17 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * IsIpv4CompatFunction ::= "IS_IPV4_COMPAT" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_is-ipv4-compat + * + * @example SELECT IS_IPV4_COMPAT(INET6_ATON('::127.0.0.1')) + * @example SELECT IS_IPV4_COMPAT(foo.bar) FROM entity + */ class IsIpv4Compat extends FunctionNode { + /** @var Node */ public $valueExpression = null; /** @throws QueryException */ diff --git a/src/Query/Mysql/IsIpv4Mapped.php b/src/Query/Mysql/IsIpv4Mapped.php index 7aa6bc4c..24a9efea 100644 --- a/src/Query/Mysql/IsIpv4Mapped.php +++ b/src/Query/Mysql/IsIpv4Mapped.php @@ -9,8 +9,17 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * IsIpv4MappedFunction ::= "IS_IPV4_MAPPED" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_is-ipv4-mapped + * + * @example SELECT IS_IPV4_MAPPED(INET6_ATON('::ffff:127.0.0.1')) + * @example SELECT IS_IPV4_MAPPED(foo.bar) FROM entity + */ class IsIpv4Mapped extends FunctionNode { + /** @var Node */ public $valueExpression = null; /** @throws QueryException */ diff --git a/src/Query/Mysql/IsIpv6.php b/src/Query/Mysql/IsIpv6.php index 19b7f74e..2d9720b9 100644 --- a/src/Query/Mysql/IsIpv6.php +++ b/src/Query/Mysql/IsIpv6.php @@ -9,8 +9,17 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * IsIpv6Function ::= "IS_IPV6" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_is-ipv6 + * + * @example SELECT IS_IPV6("::ffff:127.0.0.1") + * @example SELECT IS_IPV6(foo.bar) FROM entity + */ class IsIpv6 extends FunctionNode { + /** @var Node */ public $valueExpression = null; /** @throws QueryException */ diff --git a/src/Query/Mysql/JsonContains.php b/src/Query/Mysql/JsonContains.php index 7406d399..c72e968d 100644 --- a/src/Query/Mysql/JsonContains.php +++ b/src/Query/Mysql/JsonContains.php @@ -3,19 +3,31 @@ 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; +/** + * JsonContainsFunction ::= "JSON_CONTAINS" "(" StringPrimary "," StringPrimary ["," StringPrimary] ")" + * + * @link https://dev.mysql.com/doc/refman/en/json-search-functions.html#function_json-contains + * + * @example SELECT JSON_CONTAINS("{x: 2}", 2, "$.x") + * @example SELECT JSON_CONTAINS(foo.bar, "x", "$.bar") FROM entity + */ class JsonContains extends FunctionNode { + /** @var Node */ protected $target; + /** @var Node */ protected $candidate; - protected $path; + /** @var Node|null */ + protected $path = null; public function parse(Parser $parser): void { diff --git a/src/Query/Mysql/JsonDepth.php b/src/Query/Mysql/JsonDepth.php index b995b624..3cee777e 100644 --- a/src/Query/Mysql/JsonDepth.php +++ b/src/Query/Mysql/JsonDepth.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; +/** + * JsonDepthFunction ::= "JSON_DEPTH" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/json-attribute-functions.html#function_json-depth + * + * @example SELECT JOIN_DEPTH(foo.bar) FROM entity + */ class JsonDepth extends FunctionNode { + /** @var Node */ protected $target; public function parse(Parser $parser): void diff --git a/src/Query/Mysql/JsonLength.php b/src/Query/Mysql/JsonLength.php index 5e39883e..a0081191 100644 --- a/src/Query/Mysql/JsonLength.php +++ b/src/Query/Mysql/JsonLength.php @@ -3,17 +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\SqlWalker; use Doctrine\ORM\Query\TokenType; use function sprintf; +/** + * JsonLengthFunction ::= "JSON_LENGTH" "(" StringPrimary ["," StringPrimary] ")" + * + * @link https://dev.mysql.com/doc/refman/en/json-attribute-functions.html#function_json-length + * + * @example SELECT JSON_LENGTH(foo.bar, '$.low') FROM entity + */ class JsonLength extends FunctionNode { + /** @var Node */ protected $target; - protected $path; + /** @var Node|null */ + protected $path = null; public function parse(Parser $parser): void { diff --git a/src/Query/Mysql/Lag.php b/src/Query/Mysql/Lag.php index ced70dc1..bc921b44 100644 --- a/src/Query/Mysql/Lag.php +++ b/src/Query/Mysql/Lag.php @@ -2,23 +2,28 @@ namespace DoctrineExtensions\Query\Mysql; -use Doctrine\ORM\Query\AST\AggregateExpression; -use Doctrine\ORM\Query\AST\ArithmeticExpression; +use Doctrine\ORM\Query\AST; use Doctrine\ORM\Query\AST\Functions\FunctionNode; -use Doctrine\ORM\Query\AST\SimpleArithmeticExpression; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * LagFunction ::= "LAG" "(" StringExpression ["," ArithmeticPrimary ["," SimpleArithmeticExpression ]] ")" + * + * @link https://dev.mysql.com/doc/refman/en/window-function-descriptions.html#function_lag + * + * @example {@see LagTest} + */ class Lag extends FunctionNode { - /** @var AggregateExpression */ + /** @var AST\Subselect|AST\Node|string */ private $aggregateExpression; - /** @var ArithmeticExpression */ + /** @var AST\Node|string */ private $offset; - /** @var SimpleArithmeticExpression */ + /** @var AST\Node|string */ private $defaultValue; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/LastDay.php b/src/Query/Mysql/LastDay.php index faa832e2..2e9cd81d 100644 --- a/src/Query/Mysql/LastDay.php +++ b/src/Query/Mysql/LastDay.php @@ -3,16 +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; /** + * LastDayFunction ::= "LAST_DAY" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/8.3/en/date-and-time-functions.html#function_last-day + * * @author Rafael Kassner * @author Sarjono Mukti Aji + * + * @example SELECT LAST_DAY('2023-05-06') + * @example SELECT LAST_DAY(foo.bar) FROM entity */ class LastDay extends FunctionNode { + /** @var Node|string */ public $date; public function getSql(SqlWalker $sqlWalker): string diff --git a/src/Query/Mysql/Lead.php b/src/Query/Mysql/Lead.php index 9f43c736..5ef8a1df 100644 --- a/src/Query/Mysql/Lead.php +++ b/src/Query/Mysql/Lead.php @@ -10,6 +10,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * LeadFunction ::= "LEAD" "(" StringExpression ["," ArithmeticPrimary ["," SimpleArithmeticExpression]] ")" + * + * @link https://dev.mysql.com/doc/refman/en/window-function-descriptions.html#function_lead + * + * @example + */ class Lead extends FunctionNode { /** @var AggregateExpression */ diff --git a/src/Query/Mysql/Least.php b/src/Query/Mysql/Least.php index 1347b2f0..2ae77908 100644 --- a/src/Query/Mysql/Least.php +++ b/src/Query/Mysql/Least.php @@ -9,7 +9,13 @@ use function count; -/** @author Vas N */ +/** + * LeastFunction ::= "LEAST" "(" ArithmeticExpression {"," ArithmeticExpression}* ")" + * + * @link https://dev.mysql.com/doc/refman/en/comparison-operators.html#function_least + * + * @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..9785a057 100644 --- a/src/Query/Mysql/Log.php +++ b/src/Query/Mysql/Log.php @@ -3,12 +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; +/** + * "LOG" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_log + * + * @example + */ 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..798ed09c 100644 --- a/src/Query/Mysql/Log10.php +++ b/src/Query/Mysql/Log10.php @@ -3,12 +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; +/** + * "LOG10" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_log10 + * + * @example + */ 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..e9658635 100644 --- a/src/Query/Mysql/Log2.php +++ b/src/Query/Mysql/Log2.php @@ -3,12 +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; +/** + * "LOG2" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_log2 + * + * @example + */ 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..1d9c5972 100644 --- a/src/Query/Mysql/Lpad.php +++ b/src/Query/Mysql/Lpad.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Giulia Santoiemma */ +/** + * LpadFunction ::= "LPAD" "(" ArithmeticPrimary "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_lpad + * + * @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..a51419bc 100644 --- a/src/Query/Mysql/MakeDate.php +++ b/src/Query/Mysql/MakeDate.php @@ -7,6 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * MakeDateFunction ::= "MAKEDATE" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_makedate + * + * @example + */ class MakeDate extends FunctionNode { public $year = null; diff --git a/src/Query/Mysql/MatchAgainst.php b/src/Query/Mysql/MatchAgainst.php index a555b4b0..92168dc8 100644 --- a/src/Query/Mysql/MatchAgainst.php +++ b/src/Query/Mysql/MatchAgainst.php @@ -12,6 +12,13 @@ use function sprintf; use function strtolower; +/** + * MatchAgainstFunction ::= ? + * + * @link https://dev.mysql.com/doc/refman/en/fulltext-search.html#function_match + * + * @example + */ class MatchAgainst extends FunctionNode { /** @var array */ diff --git a/src/Query/Mysql/Md5.php b/src/Query/Mysql/Md5.php index 17299780..cad37d16 100644 --- a/src/Query/Mysql/Md5.php +++ b/src/Query/Mysql/Md5.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Andreas Gallien */ +/** + * Md5Function ::= "MD5" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/encryption-functions.html#function_md5 + * + * @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..49d727ef 100644 --- a/src/Query/Mysql/Minute.php +++ b/src/Query/Mysql/Minute.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Martin Štekl */ +/** + * MinuteFunction ::= "MINUTE" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_minute + * + * @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..69c640dc 100644 --- a/src/Query/Mysql/Month.php +++ b/src/Query/Mysql/Month.php @@ -8,6 +8,10 @@ use Doctrine\ORM\Query\TokenType; /** + * MonthFunction ::= "MONTH" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_month + * * @author Rafael Kassner * @author Sarjono Mukti Aji */ diff --git a/src/Query/Mysql/MonthName.php b/src/Query/Mysql/MonthName.php index 9668ad5f..40368cf0 100644 --- a/src/Query/Mysql/MonthName.php +++ b/src/Query/Mysql/MonthName.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Steve Lacey */ +/** + * MonthNameFunction ::= "MONTHNAME" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_monthname + * + * @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..09ab81eb 100644 --- a/src/Query/Mysql/Now.php +++ b/src/Query/Mysql/Now.php @@ -7,6 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * NowFunction ::= "NOW" "(" ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_now + * + * @example + */ 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..3098f43c 100644 --- a/src/Query/Mysql/NullIf.php +++ b/src/Query/Mysql/NullIf.php @@ -9,7 +9,13 @@ use function sprintf; -/** @author Andrew Mackrodt */ +/** + * NullIfFunction ::= "NULLIF" "(" ArithmeticExpression "," ArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/flow-control-functions.html#function_ifnull + * + * @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..f9df3e1f 100644 --- a/src/Query/Mysql/PeriodDiff.php +++ b/src/Query/Mysql/PeriodDiff.php @@ -7,6 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * PeriodDiffFunction ::= "PERIOD_DIFF" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_period-diff + * + * @example + */ class PeriodDiff extends FunctionNode { public $firstDateExpression = null; diff --git a/src/Query/Mysql/Pi.php b/src/Query/Mysql/Pi.php index f86dfc82..a9222e1a 100644 --- a/src/Query/Mysql/Pi.php +++ b/src/Query/Mysql/Pi.php @@ -7,6 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * "PI" "(" ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_pi + * + * @example + */ class Pi extends FunctionNode { public $arithmeticExpression; diff --git a/src/Query/Mysql/Power.php b/src/Query/Mysql/Power.php index 48a7ea0d..7507a97c 100644 --- a/src/Query/Mysql/Power.php +++ b/src/Query/Mysql/Power.php @@ -3,12 +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; +/** + * "POWER" "(" SimpleArithmeticExpression "," ArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_power + * + * @example + */ 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..8a225683 100644 --- a/src/Query/Mysql/Quarter.php +++ b/src/Query/Mysql/Quarter.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Martin Štekl */ +/** + * QuarterFunction ::= "QUARTER" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_quarter + * + * @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..4498e9f8 100644 --- a/src/Query/Mysql/Radians.php +++ b/src/Query/Mysql/Radians.php @@ -3,12 +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; +/** + * "RADIANS" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_radians + * + * @example + */ 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..d4548e32 100644 --- a/src/Query/Mysql/Rand.php +++ b/src/Query/Mysql/Rand.php @@ -3,14 +3,21 @@ 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] ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_rand + * + * @example + */ 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..c719ee29 100644 --- a/src/Query/Mysql/Round.php +++ b/src/Query/Mysql/Round.php @@ -3,14 +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; +/** + * "ROUND" "(" SimpleArithmeticExpression ["," ArithmeticPrimary] ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_round + * + * @example + */ 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..55f27120 100644 --- a/src/Query/Mysql/Rpad.php +++ b/src/Query/Mysql/Rpad.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Giulia Santoiemma */ +/** + * RpadFunction ::= "RPAD" "(" ArithmeticPrimary "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_rpad + * + * @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..1f924f10 100644 --- a/src/Query/Mysql/Second.php +++ b/src/Query/Mysql/Second.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Martin Štekl */ +/** + * SecondFunction ::= "SECOND" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_second + * + * @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..10dd97df 100644 --- a/src/Query/Mysql/Sha1.php +++ b/src/Query/Mysql/Sha1.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Andreas Gallien */ +/** + * Sha1Function ::= "SHA1" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/encryption-functions.html#function_sha1 + * + * @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..57ad14b7 100644 --- a/src/Query/Mysql/Sha2.php +++ b/src/Query/Mysql/Sha2.php @@ -3,15 +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 Andreas Gallien */ +/** + * Sha2Function ::= "SHA2" "(" StringPrimary "," SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/encryption-functions.html#function_sha2 + * + * @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..8834e1cb 100644 --- a/src/Query/Mysql/Sin.php +++ b/src/Query/Mysql/Sin.php @@ -3,12 +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; +/** + * "SIN" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_sin + * + * @example + */ 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..6f85bee2 100644 --- a/src/Query/Mysql/Soundex.php +++ b/src/Query/Mysql/Soundex.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Steve Tauber */ +/** + * SoundexFunction ::= "SOUNDEX" "(" StringPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_soundex + * + * @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..5f2c11ce 100644 --- a/src/Query/Mysql/Std.php +++ b/src/Query/Mysql/Std.php @@ -3,15 +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; -/** @author Toni Uebernickel */ +/** + * StdFunction ::= "STD" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/aggregate-functions.html#function_std + * + * @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..838e0256 100644 --- a/src/Query/Mysql/StdDev.php +++ b/src/Query/Mysql/StdDev.php @@ -3,15 +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; -/** @author Joachim Schirrmacher */ +/** + * StdDevFunction ::= "STDDEV" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/aggregate-functions.html#function_stddev + * + * @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..30c45fc8 100644 --- a/src/Query/Mysql/StrToDate.php +++ b/src/Query/Mysql/StrToDate.php @@ -7,6 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * StrToDateFunction ::= "STR_TO_DATE" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_str-to-date + * + * @example + */ class StrToDate extends FunctionNode { public $dateString = null; diff --git a/src/Query/Mysql/SubstringIndex.php b/src/Query/Mysql/SubstringIndex.php index f690763f..3d6080c2 100644 --- a/src/Query/Mysql/SubstringIndex.php +++ b/src/Query/Mysql/SubstringIndex.php @@ -9,6 +9,13 @@ use function sprintf; +/** + * SubstringIndexFunction ::= "SUBSTRING_INDEX" "(" ArithmeticPrimary "," ArithmeticPrimary "," ArithmeticFactor ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_substring-index + * + * @example + */ class SubstringIndex extends FunctionNode { public $string = null; diff --git a/src/Query/Mysql/Tan.php b/src/Query/Mysql/Tan.php index 4d5a1472..13698888 100644 --- a/src/Query/Mysql/Tan.php +++ b/src/Query/Mysql/Tan.php @@ -3,12 +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; +/** + * "TAN" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_tan + * + * @example + */ 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..a7db811b 100644 --- a/src/Query/Mysql/Time.php +++ b/src/Query/Mysql/Time.php @@ -8,6 +8,10 @@ use Doctrine\ORM\Query\TokenType; /** + * TimeFunction ::= "TIME" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_time + * * @author Steve Lacey * @author James Rohacik */ diff --git a/src/Query/Mysql/TimeDiff.php b/src/Query/Mysql/TimeDiff.php index c8853087..1c3de60e 100644 --- a/src/Query/Mysql/TimeDiff.php +++ b/src/Query/Mysql/TimeDiff.php @@ -9,6 +9,13 @@ use function sprintf; +/** + * TimeDiffFunction ::= "TIMEDIFF" "(" ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_timediff + * + * @example + */ 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..3d8e3397 100644 --- a/src/Query/Mysql/TimestampAdd.php +++ b/src/Query/Mysql/TimestampAdd.php @@ -9,7 +9,13 @@ use function sprintf; -/** @author Alessandro Tagliapietra */ +/** + * TimestampAddFunction ::= "TIMESTAMPADD" "(" Identifier "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_timestampadd + * + * @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..9fe3c0f3 100644 --- a/src/Query/Mysql/TimestampDiff.php +++ b/src/Query/Mysql/TimestampDiff.php @@ -9,7 +9,13 @@ use function sprintf; -/** @author Przemek Sobstel */ +/** + * TimestampDiffFunction ::= "TIMESTAMPDIFF" "(" Identifier "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_timestampdiff + * + * @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..50f8f4d1 100644 --- a/src/Query/Mysql/Truncate.php +++ b/src/Query/Mysql/Truncate.php @@ -3,15 +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 Evgeny Savich */ +/** + * "TRUNCATE" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/mathematical-functions.html#function_truncate + * + * @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..3c4f6b6c 100644 --- a/src/Query/Mysql/Unhex.php +++ b/src/Query/Mysql/Unhex.php @@ -3,12 +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; +/** + * UnHexFunction ::= "UNHEX" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_unhex + * + * @example + */ 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..8c83f1bc 100644 --- a/src/Query/Mysql/UnixTimestamp.php +++ b/src/Query/Mysql/UnixTimestamp.php @@ -10,6 +10,10 @@ use function sprintf; /** + * UnixTimestampFunction ::= "UNIX_TIMESTAMP" "(" [ArithmeticPrimary] ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_unix-timestamp + * * @author Rafael Kassner * @author Oleg Khussainov */ diff --git a/src/Query/Mysql/UtcTimestamp.php b/src/Query/Mysql/UtcTimestamp.php index f0baba01..8b092a6c 100644 --- a/src/Query/Mysql/UtcTimestamp.php +++ b/src/Query/Mysql/UtcTimestamp.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Marius Krämer */ +/** + * UtcTimestampFunction ::= "UTC_TIMESTAMP" "(" ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_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..ec4feef3 100644 --- a/src/Query/Mysql/Variance.php +++ b/src/Query/Mysql/Variance.php @@ -3,16 +3,23 @@ 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; +/** + * VarianceFunction ::= "VARIANCE" "(" SimpleArithmeticExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/aggregate-functions.html#function_variance + * + * @example + */ 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..7189a65b 100644 --- a/src/Query/Mysql/Week.php +++ b/src/Query/Mysql/Week.php @@ -8,6 +8,10 @@ use Doctrine\ORM\Query\TokenType; /** + * WeekFunction ::= "WEEK" "(" ArithmeticPrimary ["," Literal] ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_week + * * @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..380cb653 100644 --- a/src/Query/Mysql/WeekDay.php +++ b/src/Query/Mysql/WeekDay.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Pavlo Cherniavskyi */ +/** + * WeekDayFunction ::= "WEEKDAY" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_weekday + * + * @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..2c0f05b3 100644 --- a/src/Query/Mysql/WeekOfYear.php +++ b/src/Query/Mysql/WeekOfYear.php @@ -7,6 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; +/** + * WeekOfYearFunction ::= "WEEKOFYEAR" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_weekofyear + * + * @example + */ class WeekOfYear extends FunctionNode { private $date; diff --git a/src/Query/Mysql/Year.php b/src/Query/Mysql/Year.php index 29bcd586..2482d950 100644 --- a/src/Query/Mysql/Year.php +++ b/src/Query/Mysql/Year.php @@ -7,7 +7,13 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Rafael Kassner */ +/** + * YearFunction ::= "YEAR" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_year + * + * @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..715fe448 100644 --- a/src/Query/Mysql/YearMonth.php +++ b/src/Query/Mysql/YearMonth.php @@ -9,6 +9,13 @@ use function sprintf; +/** + * YearMonthFunction ::= "YEARMONTH" "(" ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_extract + * + * @example + */ class YearMonth extends FunctionNode { public $date; diff --git a/src/Query/Mysql/YearWeek.php b/src/Query/Mysql/YearWeek.php index d8c61e77..a72c6baa 100644 --- a/src/Query/Mysql/YearWeek.php +++ b/src/Query/Mysql/YearWeek.php @@ -7,7 +7,15 @@ use Doctrine\ORM\Query\SqlWalker; use Doctrine\ORM\Query\TokenType; -/** @author Michael Kimpton */ +/** + * YearWeekFunction ::= "YEARWEEK" "(" ArithmeticPrimary ["," Literal] ")" + * + * @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_yearweek + * + * @author Michael Kimpton + * + * @example + */ 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 From 38305bcd9b5031ec6d184f50d2b289552f9b4feb Mon Sep 17 00:00:00 2001 From: Karoly Gossler Date: Thu, 7 Mar 2024 08:17:00 +0100 Subject: [PATCH 2/2] misc urls --- src/Query/Mysql/Over.php | 6 +++++- src/Query/Mysql/Regexp.php | 6 +++++- src/Query/Mysql/Replace.php | 4 +++- src/Query/Mysql/UuidShort.php | 6 +++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Query/Mysql/Over.php b/src/Query/Mysql/Over.php index 7e1d327c..bd42c947 100644 --- a/src/Query/Mysql/Over.php +++ b/src/Query/Mysql/Over.php @@ -13,7 +13,11 @@ use function trim; /** - * ArithmeticExpression "OVER" "(" [OrderByClause] ")" + * OverFunction ::= "OVER" "(" ArithmeticExpression "," [OrderByClause] ")" + * + * @link https://dev.mysql.com/doc/refman/en/window-functions-usage.html + * + * @example */ class Over extends FunctionNode { diff --git a/src/Query/Mysql/Regexp.php b/src/Query/Mysql/Regexp.php index 7a7aeb06..7c6dab7c 100644 --- a/src/Query/Mysql/Regexp.php +++ b/src/Query/Mysql/Regexp.php @@ -8,7 +8,11 @@ use Doctrine\ORM\Query\TokenType; /** - * "(" StringPrimary "REGEXP" StringExpression ")" + * RegexpFunction ::= "(" StringPrimary "REGEXP" StringExpression ")" + * + * @link https://dev.mysql.com/doc/refman/en/regexp.html#operator_regexp + * + * @example */ class Regexp extends FunctionNode { diff --git a/src/Query/Mysql/Replace.php b/src/Query/Mysql/Replace.php index c71388e6..ab8e89bc 100644 --- a/src/Query/Mysql/Replace.php +++ b/src/Query/Mysql/Replace.php @@ -8,7 +8,9 @@ use Doctrine\ORM\Query\TokenType; /** - * "REPLACE" "(" ArithmeticPrimary "," ArithmeticPrimary "," ArithmeticPrimary ")" + * ReplaceFunction ::= "REPLACE" "(" ArithmeticPrimary "," ArithmeticPrimary "," ArithmeticPrimary ")" + * + * @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_replace * * @author Jarek Kostrz */ diff --git a/src/Query/Mysql/UuidShort.php b/src/Query/Mysql/UuidShort.php index 1f55bec7..f9683178 100644 --- a/src/Query/Mysql/UuidShort.php +++ b/src/Query/Mysql/UuidShort.php @@ -8,7 +8,11 @@ use Doctrine\ORM\Query\TokenType; /** - * "UUID_SHORT" "(" ")" + * UuidShortFunction ::= "UUID_SHORT" "(" ")" + * + * @link https://dev.mysql.com/doc/refman/en/miscellaneous-functions.html#function_uuid-short + * + * @example */ class UuidShort extends FunctionNode {