Skip to content

Commit 98b5840

Browse files
AdalbertMemSQLgithub-actions[bot]
authored andcommitted
Fix code styling
1 parent 2834bce commit 98b5840

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/Query/Builder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ class Builder extends BaseBuilder
88
{
99
public $options;
1010

11-
public function options(array $options) {
11+
public function options(array $options)
12+
{
1213
$this->options = $options;
14+
1315
return $this;
1416
}
1517

1618
public function toSql()
1719
{
1820
$sql = parent::toSql();
1921

20-
if (!empty($this->options)) {
22+
if (! empty($this->options)) {
2123
$sql .= ' '.$this->grammar->compileOptions($this->options);
2224
}
2325

src/Query/Grammar.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77

88
class Grammar extends MySqlGrammar
99
{
10-
public function compileOptions(array $options) : string {
11-
$optionString = "";
12-
foreach($options as $key => $value) {
13-
if (!empty($optionString)) {
10+
public function compileOptions(array $options): string
11+
{
12+
$optionString = '';
13+
foreach ($options as $key => $value) {
14+
if (! empty($optionString)) {
1415
$optionString .= ',';
1516
}
1617
$optionString .= $key.'='.$value;
1718
}
19+
1820
return "OPTION ({$optionString})";
1921
}
2022

tests/Hybrid/OptionTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
use SingleStore\Laravel\Schema\Blueprint;
77
use SingleStore\Laravel\Tests\BaseTest;
88

9-
use function PHPUnit\Framework\assertEquals;
10-
119
class OptionTest extends BaseTest
1210
{
1311
use HybridTestHelpers;
@@ -26,9 +24,9 @@ protected function setUp(): void
2624
/** @test */
2725
public function singleOption()
2826
{
29-
$query = DB::table('test')->options(["interpreter_mode" => "compile"]);
27+
$query = DB::table('test')->options(['interpreter_mode' => 'compile']);
3028
echo get_class($query);
31-
$this->assertEquals("select * from `test` OPTION (interpreter_mode=compile)", $query->toSql());
29+
$this->assertEquals('select * from `test` OPTION (interpreter_mode=compile)', $query->toSql());
3230

3331
if ($this->runHybridIntegrations()) {
3432
$query->get();
@@ -40,7 +38,7 @@ public function emptyOption()
4038
{
4139
$query = DB::table('test')->options([]);
4240
echo get_class($query);
43-
$this->assertEquals("select * from `test`", $query->toSql());
41+
$this->assertEquals('select * from `test`', $query->toSql());
4442

4543
if ($this->runHybridIntegrations()) {
4644
$query->get();
@@ -50,9 +48,9 @@ public function emptyOption()
5048
/** @test */
5149
public function multiOption()
5250
{
53-
$query = DB::table('test')->options(["interpreter_mode" => "compile", "resource_pool" => "default_pool"]);
51+
$query = DB::table('test')->options(['interpreter_mode' => 'compile', 'resource_pool' => 'default_pool']);
5452
echo get_class($query);
55-
$this->assertEquals("select * from `test` OPTION (interpreter_mode=compile,resource_pool=default_pool)", $query->toSql());
53+
$this->assertEquals('select * from `test` OPTION (interpreter_mode=compile,resource_pool=default_pool)', $query->toSql());
5654

5755
if ($this->runHybridIntegrations()) {
5856
$query->get();

0 commit comments

Comments
 (0)