Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 29, 2024
1 parent 701227d commit 300266d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
23 changes: 7 additions & 16 deletions src/Illuminate/Database/Query/Grammars/PostgresGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PostgresGrammar extends Grammar
];

/**
* The grammar specific custom operators.
* The Postgres grammar specific custom operators.
*
* @var array
*/
Expand Down Expand Up @@ -781,34 +781,25 @@ public function substituteBindingsIntoRawSql($sql, $bindings)
}

/**
* Get the grammar specific operators.
* Get the Postgres grammar specific operators.
*
* @return array
*/
public function getOperators()
{
return array_values(
array_unique(
array_merge(parent::getOperators(), static::$customOperators)
)
);
return array_values(array_unique(array_merge(parent::getOperators(), static::$customOperators)));
}

/**
* Set any grammar specific custom operators.
* Set any Postgres grammar specific custom operators.
*
* @param array|mixed $operators
* @param array $operators
* @return void
*/
public static function customOperators($operators)
public static function customOperators(array $operators)
{
$operators = array_filter(array_filter(
is_array($operators) ? $operators : func_get_args(),
'is_string'
));

static::$customOperators = array_values(
array_merge(static::$customOperators, $operators)
array_merge(static::$customOperators, array_filter(array_filter($operators, 'is_string')))
);
}
}
2 changes: 1 addition & 1 deletion tests/Database/DatabasePostgresQueryGrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testToRawSql()

public function testCustomOperators()
{
PostgresGrammar::customOperators('@@@', '@>', '');
PostgresGrammar::customOperators(['@@@', '@>', '']);
PostgresGrammar::customOperators(['@@>', 1]);

$connection = m::mock(Connection::class);
Expand Down

0 comments on commit 300266d

Please sign in to comment.