Skip to content

Commit

Permalink
Strip generic phpdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
stevelacey committed Oct 1, 2020
1 parent 6624c39 commit b68e569
Show file tree
Hide file tree
Showing 28 changed files with 31 additions and 139 deletions.
1 change: 1 addition & 0 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ $config = PhpCsFixer\Config::create()
'explicit_string_variable' => true,
'fully_qualified_strict_types' => true,
'function_typehint_space' => true,
'general_phpdoc_annotation_remove' => ['category', 'license'],
'hash_to_slash_comment' => true,
'heredoc_to_nowdoc' => true,
'include' => true,
Expand Down
6 changes: 2 additions & 4 deletions src/Query/Mysql/Cast.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
/**
* "CAST" "(" "$fieldIdentifierExpression" "AS" "$castingTypeExpression" ")"
*
* @example
* SELECT CAST(foo.bar AS SIGNED) FROM dual;
* @example SELECT CAST(foo.bar AS SIGNED) FROM dual;
*
* @link https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/cookbook/dql-user-defined-functions.html#conclusion
* @link https://dev.mysql.com/doc/refman/5.6/en/cast-functions.html#function_cast
* @link https://dev.mysql.com/doc/refman/en/cast-functions.html#function_cast
*/
class Cast extends FunctionNode
{
Expand Down
10 changes: 2 additions & 8 deletions src/Query/Mysql/Collate.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@
use Doctrine\ORM\Query\Lexer;

/**
* "COLLATE"
* override the default collation
* More info:
* https://dev.mysql.com/doc/refman/5.7/en/charset-collate.html
*
* @category DoctrineExtensions
* @author Peter Tanath <[email protected]>
* @license MIT License
* @link https://dev.mysql.com/doc/refman/en/charset-collate.html
* @author Peter Tanath <[email protected]>
*/
class Collate extends FunctionNode
{
Expand Down
10 changes: 3 additions & 7 deletions src/Query/Mysql/ConvertTz.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
use Doctrine\ORM\Query\SqlWalker;

/**
* Converts timezones.
*
* Allows Doctrine 2 Query Language to execute a MySQL CONVERT_TZ function.
*
* @link http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_convert-tz
* @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_convert-tz
*/
class ConvertTz extends FunctionNode
{
Expand All @@ -23,7 +19,7 @@ class ConvertTz extends FunctionNode
protected $toTz;

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getSql(SqlWalker $sqlWalker)
{
Expand All @@ -36,7 +32,7 @@ public function getSql(SqlWalker $sqlWalker)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function parse(Parser $parser)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Query/Mysql/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Doctrine\ORM\Query\Lexer;

/**
* @author Steve Lacey <steve@stevelacey.net>
* @author Steve Lacey <steve@steve.ly>
*/
class Date extends FunctionNode
{
Expand Down
2 changes: 1 addition & 1 deletion src/Query/Mysql/DateFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Doctrine\ORM\Query\Lexer;

/**
* @author Steve Lacey <steve@stevelacey.net>
* @author Steve Lacey <steve@steve.ly>
*/
class DateFormat extends FunctionNode
{
Expand Down
2 changes: 0 additions & 2 deletions src/Query/Mysql/DateSub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
use Doctrine\ORM\Query\QueryException;

/**
* Class DateSub
*
* @author Vas N <[email protected]>
*/
class DateSub extends DateAdd
Expand Down
2 changes: 1 addition & 1 deletion src/Query/Mysql/DayName.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Doctrine\ORM\Query\Lexer;

/**
* @author Steve Lacey <steve@stevelacey.net>
* @author Steve Lacey <steve@steve.ly>
*/
class DayName extends FunctionNode
{
Expand Down
4 changes: 1 addition & 3 deletions src/Query/Mysql/Div.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
use Doctrine\ORM\Query\SqlWalker;

/**
* Performs an integer division. This is a MySQL operator, implemented as a Doctrine function.
*
* @see http://dev.mysql.com/doc/refman/en/arithmetic-functions.html#operator_div
* @link https://dev.mysql.com/doc/refman/en/arithmetic-functions.html#operator_div
*/
class Div extends FunctionNode
{
Expand Down
5 changes: 2 additions & 3 deletions src/Query/Mysql/FromBase64.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
/**
* "FROM_BASE64" "(" "$fieldIdentifierExpression" ")"
*
* @example
* SELECT FROM_BASE64(foo) FROM dual;
* @example SELECT FROM_BASE64(foo) FROM dual;
*
* @link https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_from-base64
* @link https://dev.mysql.com/doc/refman/en/string-functions.html#function_from-base64
*/
class FromBase64 extends FunctionNode
{
Expand Down
2 changes: 0 additions & 2 deletions src/Query/Mysql/Greatest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use Doctrine\ORM\Query\SqlWalker;

/**
* Class Greatest
*
* @author Vas N <[email protected]>
* @author Guven Atbakan <[email protected]>
*/
Expand Down
4 changes: 0 additions & 4 deletions src/Query/Mysql/Instr.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;

/**
* Class Instr
* @author Jan H <[email protected]>
*/
class Instr extends FunctionNode
{
public $originalString = null;
Expand Down
2 changes: 0 additions & 2 deletions src/Query/Mysql/Least.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use Doctrine\ORM\Query\SqlWalker;

/**
* Class Least
*
* @author Vas N <[email protected]>
*/
class Least extends FunctionNode
Expand Down
2 changes: 1 addition & 1 deletion src/Query/Mysql/MonthName.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Doctrine\ORM\Query\Lexer;

/**
* @author Steve Lacey <steve@stevelacey.net>
* @author Steve Lacey <steve@steve.ly>
*/
class MonthName extends FunctionNode
{
Expand Down
27 changes: 3 additions & 24 deletions src/Query/Mysql/SecToTime.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,24 @@
<?php

/**
* DoctrineExtensions Mysql Function Pack
* LICENSE
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so I can send you a copy immediately.
*/

namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;

/**
* "SEC_TO_TIME" "(" SimpleArithmeticExpression ")".
* Modified from DoctrineExtensions\Query\Mysql\TimeToSec
* More info:
* https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
*
* @category DoctrineExtensions
* @author Clemens Bastian <[email protected]>
* @license MIT License
* @example SELECT SEC_TO_TIME(2378);
* @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_sec-to-time
* @author Clemens Bastian <[email protected]>
*/
class SecToTime extends FunctionNode
{
public $time;

/**
* @override
*/
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
return 'SEC_TO_TIME('.$sqlWalker->walkArithmeticPrimary($this->time).')';
}

/**
* @override
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
Expand Down
4 changes: 0 additions & 4 deletions src/Query/Mysql/SubstringIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;

/**
* Class SubstringIndex
* @author Vas N <[email protected]>
*/
class SubstringIndex extends FunctionNode
{
public $string = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Query/Mysql/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Doctrine\ORM\Query\Lexer;

/**
* @author Steve Lacey <steve@stevelacey.net>
* @author Steve Lacey <steve@steve.ly>
* @author James Rohacik <[email protected]>
*/
class Time extends FunctionNode
Expand Down
27 changes: 3 additions & 24 deletions src/Query/Mysql/TimeToSec.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,24 @@
<?php

/**
* DoctrineExtensions Mysql Function Pack
* LICENSE
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so I can send you a copy immediately.
*/

namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;

/**
* "TIME_TO_SEC" "(" SimpleArithmeticExpression ")".
* Modified from DoctrineExtensions\Query\Mysql\Hour
* More info:
* https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
*
* @category DoctrineExtensions
* @author Pawel Stasicki <[email protected]>
* @license MIT License
* @example SELECT TIME_TO_SEC('22:23:00');
* @link https://dev.mysql.com/doc/refman/en/date-and-time-functions.html#function_time-to-sec
* @author Pawel Stasicki <[email protected]>
*/
class TimeToSec extends FunctionNode
{
public $time;

/**
* @override
*/
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
return 'TIME_TO_SEC('.$sqlWalker->walkArithmeticPrimary($this->time).')';
}

/**
* @override
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
Expand Down
6 changes: 0 additions & 6 deletions src/Query/Mysql/UnixTimestamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ class UnixTimestamp extends FunctionNode
{
public $date;

/**
* @override
*/
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
return sprintf(
Expand All @@ -24,9 +21,6 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
);
}

/**
* @override
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
Expand Down
18 changes: 0 additions & 18 deletions src/Query/Mysql/YearMonth.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
<?php

/*
* DoctrineExtensions Mysql Function Pack
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so I can send you a copy immediately.
*/

namespace DoctrineExtensions\Query\Mysql;

use Doctrine\ORM\Query\AST\Functions\FunctionNode;
Expand All @@ -21,9 +9,6 @@ class YearMonth extends FunctionNode
{
public $date;

/**
* @override
*/
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
return sprintf(
Expand All @@ -32,9 +17,6 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
);
}

/**
* @override
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
Expand Down
13 changes: 6 additions & 7 deletions src/Query/MysqlWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,36 @@

class MysqlWalker extends SqlWalker
{
/** {@inheritDoc} */
/**
* @inheritdoc
*/
public function walkSelectClause($selectClause)
{
$sql = parent::walkSelectClause($selectClause);

// Gets the query
$query = $this->getQuery();

if ($query->getHint('mysqlWalker.sqlCalcFoundRows') === true) {
// Appends the SQL_CALC_FOUND_ROWS modifier
$sql = str_replace('SELECT', 'SELECT SQL_CALC_FOUND_ROWS', $sql);
}

if ($query->getHint('mysqlWalker.sqlNoCache') === true) {
// Appends the SQL_NO_CACHE modifier
$sql = str_replace('SELECT', 'SELECT SQL_NO_CACHE', $sql);
}

return $sql;
}

/** {@inheritDoc} */
/**
* @inheritdoc
*/
public function walkGroupByClause($groupByClause)
{
$sql = parent::walkGroupByClause($groupByClause);

// Gets the query
$query = $this->getQuery();

if ($query->getHint('mysqlWalker.withRollup') === true) {
// Appends the WITH ROLLUP modifier
$sql .= ' WITH ROLLUP';
}

Expand Down
3 changes: 0 additions & 3 deletions src/Query/Postgresql/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;

/**
* @author Steve Lacey <[email protected]>
*/
class Date extends FunctionNode
{
public $date;
Expand Down
Loading

0 comments on commit b68e569

Please sign in to comment.