summaryrefslogtreecommitdiffstats
path: root/src/Context.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Context.php')
-rw-r--r--src/Context.php20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/Context.php b/src/Context.php
index 9625deb..6e699c5 100644
--- a/src/Context.php
+++ b/src/Context.php
@@ -1,11 +1,11 @@
<?php
-
/**
* Defines a context class that is later extended to define other contexts.
*
* A context is a collection of keywords, operators and functions used for
* parsing.
*/
+declare(strict_types=1);
namespace PhpMyAdmin\SqlParser;
@@ -13,10 +13,6 @@ use PhpMyAdmin\SqlParser\Exceptions\LoaderException;
/**
* Holds the configuration of the context that is currently used.
- *
- * @category Contexts
- *
- * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
*/
abstract class Context
{
@@ -86,14 +82,14 @@ abstract class Context
*
* @var array
*/
- public static $KEYWORDS = array();
+ public static $KEYWORDS = [];
/**
* List of operators and their flags.
*
* @var array
*/
- public static $OPERATORS = array(
+ public static $OPERATORS = [
// Some operators (*, =) may have ambiguous flags, because they depend on
// the context they are being used in.
// For example: 1. SELECT * FROM table; # SQL specific (wildcard)
@@ -137,8 +133,8 @@ abstract class Context
')' => 16,
'.' => 16,
',' => 16,
- ';' => 16
- );
+ ';' => 16,
+ ];
/**
* The mode of the MySQL server that will be used in lexing, parsing and
@@ -339,7 +335,7 @@ abstract class Context
if ($str[0] === '#') {
return Token::FLAG_COMMENT_BASH;
} elseif (($len > 1) && ($str[0] === '/') && ($str[1] === '*')) {
- return (($len > 2) && ($str[2] === '!')) ?
+ return ($len > 2) && ($str[2] === '!') ?
Token::FLAG_COMMENT_MYSQL_CMD : Token::FLAG_COMMENT_C;
} elseif (($len > 1) && ($str[0] === '*') && ($str[1] === '/')) {
return Token::FLAG_COMMENT_C;
@@ -385,7 +381,7 @@ abstract class Context
*/
public static function isNumber($str)
{
- return (($str >= '0') && ($str <= '9')) || ($str === '.')
+ return ($str >= '0') && ($str <= '9') || ($str === '.')
|| ($str === '-') || ($str === '+') || ($str === 'e') || ($str === 'E');
}
@@ -468,7 +464,7 @@ abstract class Context
* @param string $context name of the context or full class name that
* defines the context
*
- * @throws LoaderException if the specified context doesn't exist
+ * @throws LoaderException if the specified context doesn't exist.
*/
public static function load($context = '')
{