diff options
Diffstat (limited to 'src/Components/Reference.php')
-rw-r--r-- | src/Components/Reference.php | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/Components/Reference.php b/src/Components/Reference.php index 38fc060..759f3ad 100644 --- a/src/Components/Reference.php +++ b/src/Components/Reference.php @@ -1,8 +1,8 @@ <?php - /** * `REFERENCES` keyword parser. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; @@ -14,10 +14,6 @@ use PhpMyAdmin\SqlParser\TokensList; /** * `REFERENCES` keyword parser. - * - * @category Keywords - * - * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ class Reference extends Component { @@ -26,20 +22,20 @@ class Reference extends Component * * @var array */ - public static $REFERENCES_OPTIONS = array( - 'MATCH' => array( + public static $REFERENCES_OPTIONS = [ + 'MATCH' => [ 1, 'var', - ), - 'ON DELETE' => array( + ], + 'ON DELETE' => [ 2, 'var', - ), - 'ON UPDATE' => array( + ], + 'ON UPDATE' => [ 3, 'var', - ) - ); + ], + ]; /** * The referenced table. @@ -63,13 +59,11 @@ 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 = array(), $options = null) + public function __construct($table = null, array $columns = [], $options = null) { $this->table = $table; $this->columns = $columns; @@ -83,9 +77,9 @@ class Reference extends Component * * @return Reference */ - 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. @@ -124,10 +118,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 +145,7 @@ class Reference extends Component * * @return string */ - public static function build($component, array $options = array()) + public static function build($component, array $options = []) { return trim( $component->table |