Skip to content

Commit 1ed9eaa

Browse files
committed
Merge branch 'feature/minor-changes' into develop
2 parents 05bfc5a + c9347f0 commit 1ed9eaa

22 files changed

Lines changed: 505 additions & 579 deletions

.php_cs.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ $config
3434
->setRules([
3535
'@PHP56Migration' => true,
3636
'@PHPUnit75Migration:risky' => true,
37+
'@Symfony' => true,
3738
'@PhpCsFixer' => true,
3839
'@PhpCsFixer:risky' => true,
40+
'binary_operator_spaces' => ['default' => 'align_single_space'],
41+
'align_multiline_comment' => true,
42+
'array_syntax' => ['syntax' => 'short'],
43+
'array_indentation' => true,
44+
'blank_line_before_return' => true,
3945
'header_comment' => ['header' => $header],
4046
'list_syntax' => ['syntax' => 'long'],
4147
])

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Sometimes we need to parse and validate SQL.
1010
What does it do?
1111
---------------
1212

13-
It parse SQL (mostly MySQL's SQL) and exposes the SQL query as an object so it can be manipulated and assembled back to a query.
13+
It parses SQL (mostly MySQL's SQL) and returns the SQL query as an object. This object can be modified programmatically to generate another SQL query.
1414

1515
How to install?
1616
--------------

build.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
use SQLParser\Lexer;
66

77
$constants = '';
8+
$array = '';
89

910
foreach (Lexer::getKeywords() as $code => $id) {
10-
$constants .= 'const T_' . strtoupper($code) . ' = ' . var_export($code, true) . ";\n\n";
11+
$array .= 'self::T_' . strtoupper($code) . " => true,\n";
12+
$constants .= 'const T_' . strtoupper($code) . ' = ' . var_export($code, true) . ";\n";
1113
}
1214

1315
$code = '<?php
@@ -16,8 +18,8 @@
1618
1719
class ReservedWords
1820
{
19-
' . $constants . '
20-
public static $words = ' . var_export(Lexer::getKeywords(), true) . ';
21+
' . $constants ."
22+
public static \$words = [\n" . $array . '];
2123
}';
2224

2325

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"src/"
1717
]
1818
},
19+
"requires": {
20+
"php": "^7.0 || ^8.0"
21+
},
1922
"require-dev": {
2023
"crodas/phpunit-compat": "^1.7",
2124
"fpoirotte/php_parsergenerator": "^0.2.4",

src/SQL/AlterTable/AddColumn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AddColumn extends AlterTable
3232
{
3333
public function __construct(Column $column, $position)
3434
{
35-
$this->column = $column;
35+
$this->column = $column;
3636
$this->position = $position;
3737
}
3838
}

src/SQL/AlterTable/AddIndex.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct($type, $name, ExprList $columns)
3838
{
3939
$this->indexType = $type;
4040
$this->indexName = $name;
41-
$this->columns = $columns;
41+
$this->columns = $columns;
4242
}
4343

4444
public function getIndexName()

src/SQL/AlterTable/ChangeColumn.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class ChangeColumn extends AlterTable
3434

3535
public function __construct($oldName, Column $column, $position)
3636
{
37-
$this->oldName = $oldName;
38-
$this->column = $column;
37+
$this->oldName = $oldName;
38+
$this->column = $column;
3939
$this->position = $position;
4040
}
4141

src/SQL/AlterTable/SetDefault.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SetDefault extends AlterTable
3333
public function __construct($columnName, $value)
3434
{
3535
$this->column = $columnName;
36-
$this->value = $value;
36+
$this->value = $value;
3737
}
3838

3939
public function getValue()

src/SQL/Drop.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Drop extends Statement
5050
*/
5151
public function __construct($type, array $tables)
5252
{
53-
$this->type = $type;
53+
$this->type = $type;
5454
$this->tables = $tables;
5555
}
5656

0 commit comments

Comments
 (0)