summaryrefslogtreecommitdiffstats
path: root/src/Components/PartitionDefinition.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Components/PartitionDefinition.php')
-rw-r--r--src/Components/PartitionDefinition.php66
1 files changed, 31 insertions, 35 deletions
diff --git a/src/Components/PartitionDefinition.php b/src/Components/PartitionDefinition.php
index 53da148..e67e92f 100644
--- a/src/Components/PartitionDefinition.php
+++ b/src/Components/PartitionDefinition.php
@@ -1,10 +1,10 @@
<?php
-
/**
* Parses the create definition of a partition.
*
* Used for parsing `CREATE TABLE` statement.
*/
+declare(strict_types=1);
namespace PhpMyAdmin\SqlParser\Components;
@@ -17,10 +17,6 @@ use PhpMyAdmin\SqlParser\TokensList;
* Parses the create definition of a partition.
*
* Used for parsing `CREATE TABLE` statement.
- *
- * @category Components
- *
- * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
*/
class PartitionDefinition extends Component
{
@@ -29,44 +25,44 @@ class PartitionDefinition extends Component
*
* @var array
*/
- public static $OPTIONS = array(
- 'STORAGE ENGINE' => array(
+ public static $OPTIONS = [
+ 'STORAGE ENGINE' => [
1,
'var',
- ),
- 'ENGINE' => array(
+ ],
+ 'ENGINE' => [
1,
'var',
- ),
- 'COMMENT' => array(
+ ],
+ 'COMMENT' => [
2,
'var',
- ),
- 'DATA DIRECTORY' => array(
+ ],
+ 'DATA DIRECTORY' => [
3,
'var',
- ),
- 'INDEX DIRECTORY' => array(
+ ],
+ 'INDEX DIRECTORY' => [
4,
'var',
- ),
- 'MAX_ROWS' => array(
+ ],
+ 'MAX_ROWS' => [
5,
'var',
- ),
- 'MIN_ROWS' => array(
+ ],
+ 'MIN_ROWS' => [
6,
'var',
- ),
- 'TABLESPACE' => array(
+ ],
+ 'TABLESPACE' => [
7,
'var',
- ),
- 'NODEGROUP' => array(
+ ],
+ 'NODEGROUP' => [
8,
'var',
- )
- );
+ ],
+ ];
/**
* Whether this entry is a subpartition or a partition.
@@ -117,9 +113,9 @@ class PartitionDefinition extends Component
*
* @return PartitionDefinition
*/
- 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();
/**
* The state of the parser.
@@ -196,10 +192,10 @@ class PartitionDefinition extends Component
$ret->expr = Expression::parse(
$parser,
$list,
- array(
+ [
'parenthesesDelimited' => true,
- 'breakOnAlias' => true
- )
+ 'breakOnAlias' => true,
+ ]
);
}
$state = 5;
@@ -211,9 +207,9 @@ class PartitionDefinition extends Component
$ret->subpartitions = ArrayObj::parse(
$parser,
$list,
- array(
- 'type' => 'PhpMyAdmin\\SqlParser\\Components\\PartitionDefinition'
- )
+ [
+ 'type' => 'PhpMyAdmin\\SqlParser\\Components\\PartitionDefinition',
+ ]
);
++$list->idx;
}
@@ -232,7 +228,7 @@ class PartitionDefinition extends Component
*
* @return string
*/
- public static function build($component, array $options = array())
+ public static function build($component, array $options = [])
{
if (is_array($component)) {
return "(\n" . implode(",\n", $component) . "\n)";
@@ -247,7 +243,7 @@ class PartitionDefinition extends Component
return trim(
'PARTITION ' . $component->name
. (empty($component->type) ? '' : ' VALUES ' . $component->type . ' ' . $component->expr . ' ')
- . ((! empty($component->options) && ! empty($component->type)) ? '' : ' ') . $component->options . $subpartitions
+ . (! empty($component->options) && ! empty($component->type) ? '' : ' ') . $component->options . $subpartitions
);
}
}