* Support php 5.3 for sql parser lib.

This commit is contained in:
qixinzhi
2023-02-10 11:24:24 +08:00
parent 7c2e937eda
commit 7c122a0b29
648 changed files with 13815 additions and 279048 deletions
@@ -1,10 +1,9 @@
<?php
/**
* `REFERENCES` keyword parser.
*/
declare(strict_types=1);
namespace PhpMyAdmin\SqlParser\Components;
use PhpMyAdmin\SqlParser\Component;
@@ -13,13 +12,12 @@ use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\SqlParser\Token;
use PhpMyAdmin\SqlParser\TokensList;
use function implode;
use function trim;
/**
* `REFERENCES` keyword parser.
*
* @final
* @category Keywords
*
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
*/
class Reference extends Component
{
@@ -28,20 +26,20 @@ class Reference extends Component
*
* @var array
*/
public static $REFERENCES_OPTIONS = [
'MATCH' => [
public static $REFERENCES_OPTIONS = array(
'MATCH' => array(
1,
'var',
],
'ON DELETE' => [
),
'ON DELETE' => array(
2,
'var',
],
'ON UPDATE' => [
),
'ON UPDATE' => array(
3,
'var',
],
];
)
);
/**
* The referenced table.
@@ -65,11 +63,13 @@ class Reference extends Component
public $options;
/**
* Constructor.
*
* @param Expression $table the name of the table referenced
* @param array $columns the columns referenced
* @param OptionsArray $options the options
*/
public function __construct($table = null, array $columns = [], $options = null)
public function __construct($table = null, array $columns = array(), $options = null)
{
$this->table = $table;
$this->columns = $columns;
@@ -83,9 +83,9 @@ class Reference extends Component
*
* @return Reference
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = array())
{
$ret = new static();
$ret = new self();
/**
* The state of the parser.
@@ -124,10 +124,10 @@ class Reference extends Component
$ret->table = Expression::parse(
$parser,
$list,
[
array(
'parseField' => 'table',
'breakOnAlias' => true,
]
'breakOnAlias' => true
)
);
$state = 1;
} elseif ($state === 1) {
@@ -151,7 +151,7 @@ class Reference extends Component
*
* @return string
*/
public static function build($component, array $options = [])
public static function build($component, array $options = array())
{
return trim(
$component->table