summaryrefslogtreecommitdiffstats
path: root/src/Components/Key.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Components/Key.php')
-rw-r--r--src/Components/Key.php36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/Components/Key.php b/src/Components/Key.php
index bf87e54..b924c87 100644
--- a/src/Components/Key.php
+++ b/src/Components/Key.php
@@ -1,8 +1,8 @@
<?php
-
/**
* Parses the definition of a key.
*/
+declare(strict_types=1);
namespace PhpMyAdmin\SqlParser\Components;
@@ -28,24 +28,24 @@ class Key extends Component
*
* @var array
*/
- public static $KEY_OPTIONS = array(
- 'KEY_BLOCK_SIZE' => array(
+ public static $KEY_OPTIONS = [
+ 'KEY_BLOCK_SIZE' => [
1,
'var',
- ),
- 'USING' => array(
+ ],
+ 'USING' => [
2,
'var',
- ),
- 'WITH PARSER' => array(
+ ],
+ 'WITH PARSER' => [
3,
'var',
- ),
- 'COMMENT' => array(
+ ],
+ 'COMMENT' => [
4,
'var=',
- )
- );
+ ],
+ ];
/**
* The name of this key.
@@ -85,7 +85,7 @@ class Key extends Component
*/
public function __construct(
$name = null,
- array $columns = array(),
+ array $columns = [],
$type = null,
$options = null
) {
@@ -102,16 +102,16 @@ class Key extends Component
*
* @return Key
*/
- public static function parse(Parser $parser, TokensList $list, array $options = array())
+ public static function parse(Parser $parser, TokensList $list, array $options = [])
{
- $ret = new self();
+ $ret = new static();
/**
* Last parsed column.
*
* @var array
*/
- $lastColumn = array();
+ $lastColumn = [];
/**
* The state of the parser.
@@ -164,7 +164,7 @@ class Key extends Component
$state = ($token->value === ',') ? 2 : 4;
if (! empty($lastColumn)) {
$ret->columns[] = $lastColumn;
- $lastColumn = array();
+ $lastColumn = [];
}
}
} else {
@@ -194,14 +194,14 @@ class Key extends Component
*
* @return string
*/
- public static function build($component, array $options = array())
+ public static function build($component, array $options = [])
{
$ret = $component->type . ' ';
if (! empty($component->name)) {
$ret .= Context::escape($component->name) . ' ';
}
- $columns = array();
+ $columns = [];
foreach ($component->columns as $column) {
$tmp = Context::escape($column['name']);
if (isset($column['length'])) {