Skip to content

Commit

Permalink
Use null coalesce operator
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Feb 17, 2020
1 parent e860cf9 commit 327b6ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Components/IndexHint.php
Expand Up @@ -69,7 +69,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
{
$ret = [];
$expr = new static();
$expr->type = isset($options['type']) ? $options['type'] : null;
$expr->type = $options['type'] ?? null;
/**
* The state of the parser.
*
Expand Down
3 changes: 1 addition & 2 deletions src/Utils/Misc.php
Expand Up @@ -90,8 +90,7 @@ public static function getAliases($statement, $database)
$expr->database : $database;

if (isset($expr->table) && ($expr->table !== '')) {
$thisTable = isset($tables[$thisDb][$expr->table]) ?
$tables[$thisDb][$expr->table] : $expr->table;
$thisTable = $tables[$thisDb][$expr->table] ?? $expr->table;
$retval[$thisDb]['tables'][$thisTable]['columns'][$expr->column] = $expr->alias;
} else {
foreach ($retval[$thisDb]['tables'] as &$table) {
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/Query.php
Expand Up @@ -424,7 +424,7 @@ public static function getAll($query)
) {
$tableAliases[$expr->alias] = [
$expr->table,
isset($expr->database) ? $expr->database : null,
$expr->database ?? null,
];
}
}
Expand Down Expand Up @@ -591,7 +591,7 @@ public static function getClause($statement, $list, $clause, $type = 0, $skipFir
*
* @var int
*/
$clauseIdx = isset($clauses[$clauseType]) ? $clauses[$clauseType] : -1;
$clauseIdx = $clauses[$clauseType] ?? -1;

$firstClauseIdx = $clauseIdx;
$lastClauseIdx = $clauseIdx;
Expand Down

0 comments on commit 327b6ac

Please sign in to comment.