Skip to content

Commit

Permalink
Replaced new self with new static
Browse files Browse the repository at this point in the history
  • Loading branch information
MartkCz committed May 17, 2019
1 parent 0a6690b commit 8c3224f
Show file tree
Hide file tree
Showing 22 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/Components/AlterOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function __construct(
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* Counts brackets.
Expand Down
2 changes: 1 addition & 1 deletion src/Components/ArrayObj.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(array $raw = [], array $values = [])
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = empty($options['type']) ? new self() : [];
$ret = empty($options['type']) ? new static() : [];

/**
* The last raw expression.
Expand Down
2 changes: 1 addition & 1 deletion src/Components/CaseExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct()
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* State of parser.
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
{
$ret = [];

$expr = new self();
$expr = new static();

/**
* Counts brackets.
Expand Down Expand Up @@ -159,12 +159,12 @@ public static function parse(Parser $parser, TokensList $list, array $options =
}

// Adding the operator.
$expr = new self($token->value);
$expr = new static($token->value);
$expr->isOperator = true;
$ret[] = $expr;

// Preparing to parse another condition.
$expr = new self();
$expr = new static();
continue;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Components/CreateDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
{
$ret = [];

$expr = new self();
$expr = new static();

/**
* The state of the parser.
Expand Down Expand Up @@ -285,7 +285,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
if (! empty($expr->type) || ! empty($expr->key)) {
$ret[] = $expr;
}
$expr = new self();
$expr = new static();
if ($token->value === ',') {
$state = 1;
} elseif ($token->value === ')') {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/DataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function __construct(
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* The state of the parser.
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Expression.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function __construct($database = null, $table = null, $column = null, $al
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* Whether current tokens make an expression or a table reference.
Expand Down
2 changes: 1 addition & 1 deletion src/Components/FunctionCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct($name = null, $parameters = null)
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* The state of the parser.
Expand Down
4 changes: 2 additions & 2 deletions src/Components/GroupKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
{
$ret = [];

$expr = new self();
$expr = new static();

/**
* The state of the parser.
Expand Down Expand Up @@ -96,7 +96,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
if (! empty($expr->expr)) {
$ret[] = $expr;
}
$expr = new self();
$expr = new static();
$state = 0;
} else {
break;
Expand Down
6 changes: 3 additions & 3 deletions src/Components/IndexHint.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct(string $type = null, string $indexOrKey = null, stri
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = [];
$expr = new self();
$expr = new static();
$expr->type = isset($options['type']) ? $options['type'] : null;
/**
* The state of the parser.
Expand Down Expand Up @@ -143,7 +143,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$expr->indexes = ExpressionArray::parse($parser, $list);
$state = 0;
$ret[] = $expr;
$expr = new self();
$expr = new static();
}
break;
case 3:
Expand All @@ -163,7 +163,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$expr->indexes = ExpressionArray::parse($parser, $list);
$state = 0;
$ret[] = $expr;
$expr = new self();
$expr = new static();
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/IntoKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function __construct(
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* The state of the parser.
Expand Down
8 changes: 4 additions & 4 deletions src/Components/JoinKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
{
$ret = [];

$expr = new self();
$expr = new static();

/**
* The state of the parser.
Expand Down Expand Up @@ -174,7 +174,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
if (! empty(static::$JOINS[$token->keyword])
) {
$ret[] = $expr;
$expr = new self();
$expr = new static();
$expr->type = static::$JOINS[$token->keyword];
$state = 1;
} else {
Expand All @@ -187,12 +187,12 @@ public static function parse(Parser $parser, TokensList $list, array $options =
} elseif ($state === 3) {
$expr->on = Condition::parse($parser, $list);
$ret[] = $expr;
$expr = new self();
$expr = new static();
$state = 0;
} elseif ($state === 4) {
$expr->using = ArrayObj::parse($parser, $list);
$ret[] = $expr;
$expr = new self();
$expr = new static();
$state = 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function __construct(
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* Last parsed column.
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Limit.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct($rowCount = 0, $offset = 0)
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

$offset = false;

Expand Down
2 changes: 1 addition & 1 deletion src/Components/LockExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LockExpression extends Component
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* The state of the parser.
Expand Down
2 changes: 1 addition & 1 deletion src/Components/OptionsArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(array $options = [])
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* The ID that will be assigned to duplicate options.
Expand Down
4 changes: 2 additions & 2 deletions src/Components/OrderKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
{
$ret = [];

$expr = new self();
$expr = new static();

/**
* The state of the parser.
Expand Down Expand Up @@ -105,7 +105,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
if (! empty($expr->expr)) {
$ret[] = $expr;
}
$expr = new self();
$expr = new static();
$state = 0;
} else {
break;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/ParameterDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
{
$ret = [];

$expr = new self();
$expr = new static();

/**
* The state of the parser.
Expand Down Expand Up @@ -127,7 +127,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$state = 3;
} elseif ($state === 3) {
$ret[] = $expr;
$expr = new self();
$expr = new static();
if ($token->value === ',') {
$state = 1;
} elseif ($token->value === ')') {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/PartitionDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class PartitionDefinition extends Component
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* The state of the parser.
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __construct($table = null, array $columns = [], $options = null)
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
$ret = new self();
$ret = new static();

/**
* The state of the parser.
Expand Down
4 changes: 2 additions & 2 deletions src/Components/RenameOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
{
$ret = [];

$expr = new self();
$expr = new static();

/**
* The state of the parser.
Expand Down Expand Up @@ -140,7 +140,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
} elseif ($state === 3) {
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === ',')) {
$ret[] = $expr;
$expr = new self();
$expr = new static();
$state = 0;
} else {
break;
Expand Down
4 changes: 2 additions & 2 deletions src/Components/SetOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
{
$ret = [];

$expr = new self();
$expr = new static();

/**
* The state of the parser.
Expand Down Expand Up @@ -129,7 +129,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$expr->column = trim($expr->column);
$expr->value = $tmp->expr;
$ret[] = $expr;
$expr = new self();
$expr = new static();
$state = 0;
$commaLastSeenAt = null;
}
Expand Down

0 comments on commit 8c3224f

Please sign in to comment.