diff options
-rw-r--r-- | src/Components/GroupKeyword.php | 1 | ||||
-rw-r--r-- | src/Components/IntoKeyword.php | 12 | ||||
-rw-r--r-- | src/Components/JoinKeyword.php | 8 | ||||
-rw-r--r-- | src/Components/ParameterDefinition.php | 6 | ||||
-rw-r--r-- | src/Components/RenameOperation.php | 4 | ||||
-rw-r--r-- | src/Components/SetOperation.php | 2 | ||||
-rw-r--r-- | src/Context.php | 4 | ||||
-rw-r--r-- | src/Exceptions/LoaderException.php | 1 | ||||
-rw-r--r-- | src/Lexer.php | 4 | ||||
-rw-r--r-- | src/UtfString.php | 4 | ||||
-rw-r--r-- | src/Utils/Formatter.php | 2 | ||||
-rw-r--r-- | tests/Lexer/ContextTest.php | 2 | ||||
-rw-r--r-- | tests/Misc/UtfStringTest.php | 14 | ||||
-rw-r--r-- | tests/Utils/QueryTest.php | 2 | ||||
-rw-r--r-- | tools/ContextGenerator.php | 2 |
15 files changed, 38 insertions, 30 deletions
diff --git a/src/Components/GroupKeyword.php b/src/Components/GroupKeyword.php index 1c7dfdd..314201b 100644 --- a/src/Components/GroupKeyword.php +++ b/src/Components/GroupKeyword.php @@ -127,6 +127,5 @@ class GroupKeyword extends Component } return trim($component->expr); - } } diff --git a/src/Components/IntoKeyword.php b/src/Components/IntoKeyword.php index 87d0e7a..17615f6 100644 --- a/src/Components/IntoKeyword.php +++ b/src/Components/IntoKeyword.php @@ -98,12 +98,12 @@ class IntoKeyword extends Component /** * Constructor. * - * @param string $type Type of destination (may be OUTFILE). - * @param string|Expression $dest Actual destination. - * @param array $columns Column list of destination. - * @param array $values Selected fields. - * @param OptionsArray $fields_options Options for FIELDS/COLUMNS keyword. - * @param OptionsArray $fields_keyword Options for OPTINOS keyword. + * @param string $type type of destination (may be OUTFILE) + * @param string|Expression $dest actual destination + * @param array $columns column list of destination + * @param array $values selected fields + * @param OptionsArray $fields_options options for FIELDS/COLUMNS keyword + * @param OptionsArray $fields_keyword options for OPTINOS keyword */ public function __construct( $type = null, diff --git a/src/Components/JoinKeyword.php b/src/Components/JoinKeyword.php index cf6d4aa..55b69ae 100644 --- a/src/Components/JoinKeyword.php +++ b/src/Components/JoinKeyword.php @@ -76,10 +76,10 @@ class JoinKeyword extends Component /** * Constructor. * - * @param string $type Join type - * @param Expression $expr Join expression. - * @param Condition[] $on Join conditions. - * @param ArrayObj $using Columns joined. + * @param string $type Join type + * @param Expression $expr join expression + * @param Condition[] $on join conditions + * @param ArrayObj $using columns joined * * @see JoinKeyword::$JOINS */ diff --git a/src/Components/ParameterDefinition.php b/src/Components/ParameterDefinition.php index a313a22..82a3567 100644 --- a/src/Components/ParameterDefinition.php +++ b/src/Components/ParameterDefinition.php @@ -45,9 +45,9 @@ class ParameterDefinition extends Component /** * Constructor. * - * @param string $name Parameter's name. - * @param string $inOut Parameter's directional type (IN / OUT or None). - * @param DataType $type Parameter's type. + * @param string $name parameter's name + * @param string $inOut parameter's directional type (IN / OUT or None) + * @param DataType $type parameter's type */ public function __construct($name = null, $inOut = null, $type = null) { diff --git a/src/Components/RenameOperation.php b/src/Components/RenameOperation.php index d48ddc4..2e3d6ef 100644 --- a/src/Components/RenameOperation.php +++ b/src/Components/RenameOperation.php @@ -37,8 +37,8 @@ class RenameOperation extends Component /** * Constructor. * - * @param Expression $old Old expression. - * @param Expression $new New expression containing new name. + * @param Expression $old old expression + * @param Expression $new new expression containing new name */ public function __construct($old = null, $new = null) { diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php index 9439d88..83f2e55 100644 --- a/src/Components/SetOperation.php +++ b/src/Components/SetOperation.php @@ -38,7 +38,7 @@ class SetOperation extends Component * Constructor. * * @param string $column Field's name.. - * @param string $value New value. + * @param string $value new value */ public function __construct($column = null, $value = null) { diff --git a/src/Context.php b/src/Context.php index 928f0a1..3716e3a 100644 --- a/src/Context.php +++ b/src/Context.php @@ -10,7 +10,6 @@ namespace PhpMyAdmin\SqlParser; use PhpMyAdmin\SqlParser\Exceptions\LoaderException; -use PhpMyAdmin\SqlParser\Token; /** * Holds the configuration of the context that is currently used. @@ -309,10 +308,11 @@ abstract class Context * Checks if the given string is the beginning of a whitespace. * * @param string $str string to be checked + * @param mixed $end * * @return int the appropriate flag for the comment type */ - public static function isComment($str, $end=false) + public static function isComment($str, $end = false) { $len = strlen($str); if ($len == 0) { diff --git a/src/Exceptions/LoaderException.php b/src/Exceptions/LoaderException.php index 4276e80..e3cb283 100644 --- a/src/Exceptions/LoaderException.php +++ b/src/Exceptions/LoaderException.php @@ -29,6 +29,7 @@ class LoaderException extends \Exception * @param string $ch the character that produced this exception * @param int $pos the position of the character * @param int $code the code of this error + * @param mixed $name */ public function __construct($msg = '', $name = '', $code = 0) { diff --git a/src/Lexer.php b/src/Lexer.php index e734c6f..f5972d8 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -567,7 +567,7 @@ class Lexer extends Core while ( ++$this->last < $this->len - && '0' <= $this->str[$this->last] + && $this->str[$this->last] >= '0' && $this->str[$this->last] <= '9' ) { $token .= $this->str[$this->last]; @@ -873,7 +873,7 @@ class Lexer extends Core } } elseif ($flags & Token::FLAG_SYMBOL_PARAMETER) { if ($this->last + 1 < $this->len) { - $this->last++; + ++$this->last; } } else { $token = ''; diff --git a/src/UtfString.php b/src/UtfString.php index 0d2e0c5..9ae70f6 100644 --- a/src/UtfString.php +++ b/src/UtfString.php @@ -75,7 +75,7 @@ class UtfString implements \ArrayAccess $this->byteIdx = 0; $this->charIdx = 0; $this->byteLen = mb_strlen($str, '8bit'); - if (! mb_check_encoding($str, 'UTF-8')) { + if (!mb_check_encoding($str, 'UTF-8')) { $this->charLen = 0; } else { $this->charLen = mb_strlen($str, 'UTF-8'); @@ -120,7 +120,7 @@ class UtfString implements \ArrayAccess while ($delta++ < 0) { do { $byte = ord($this->str[--$this->byteIdx]); - } while ((128 <= $byte) && ($byte < 192)); + } while (($byte >= 128) && ($byte < 192)); --$this->charIdx; } } diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php index 393eaf3..df260e7 100644 --- a/src/Utils/Formatter.php +++ b/src/Utils/Formatter.php @@ -556,6 +556,7 @@ class Formatter } elseif ($this->options['type'] === 'cli') { if ($prev != $format['cli']) { $prev = $format['cli']; + return $format['cli'] . $this->escapeConsole($text); } @@ -569,6 +570,7 @@ class Formatter if ($this->options['type'] === 'cli') { if ($prev != "\x1b[39m") { $prev = "\x1b[39m"; + return "\x1b[39m" . $this->escapeConsole($text); } diff --git a/tests/Lexer/ContextTest.php b/tests/Lexer/ContextTest.php index cd5abf5..3a3546b 100644 --- a/tests/Lexer/ContextTest.php +++ b/tests/Lexer/ContextTest.php @@ -33,6 +33,8 @@ class ContextTest extends TestCase /** * @dataProvider contextNames + * + * @param mixed $context */ public function testLoadAll($context) { diff --git a/tests/Misc/UtfStringTest.php b/tests/Misc/UtfStringTest.php index 1e5222c..a0a0bdc 100644 --- a/tests/Misc/UtfStringTest.php +++ b/tests/Misc/UtfStringTest.php @@ -84,9 +84,13 @@ class UtfStringTest extends TestCase } /** - * Test access to string + * Test access to string. * * @dataProvider utf8_strings + * + * @param mixed $text + * @param mixed $pos10 + * @param mixed $pos20 */ public function testAccess($text, $pos10, $pos20) { @@ -100,16 +104,16 @@ class UtfStringTest extends TestCase { return array( 'ascii' => array( - 'abcdefghijklmnopqrstuvwxyz', 'k', 'u' + 'abcdefghijklmnopqrstuvwxyz', 'k', 'u', ), 'unicode' => array( - 'áéíóúýěřťǔǐǒǎšďȟǰǩľžčǚň', 'ǐ', 'č' + 'áéíóúýěřťǔǐǒǎšďȟǰǩľžčǚň', 'ǐ', 'č', ), 'emoji' => array( - '😂😄😃😀😊😉😍😘😚😗😂👿😮😨😱😠😡😤😖😆😋👯', '😂', '😋' + '😂😄😃😀😊😉😍😘😚😗😂👿😮😨😱😠😡😤😖😆😋👯', '😂', '😋', ), 'iso' => array( - "P\xf8\xed\xb9ern\xec \xbelu\xbbou\xe8k\xfd k\xf3d \xfap\xecl \xef\xe1belsk\xe9 k\xf3dy", null, null + "P\xf8\xed\xb9ern\xec \xbelu\xbbou\xe8k\xfd k\xf3d \xfap\xecl \xef\xe1belsk\xe9 k\xf3dy", null, null, ), ); } diff --git a/tests/Utils/QueryTest.php b/tests/Utils/QueryTest.php index c835549..31e7a64 100644 --- a/tests/Utils/QueryTest.php +++ b/tests/Utils/QueryTest.php @@ -370,7 +370,7 @@ class QueryTest extends TestCase 'parser' => $parser, 'statement' => $parser->statements[0], 'select_expr' => array( - 'CASE WHEN 2 IS NULL THEN "this is true" ELSE "this is false" END' + 'CASE WHEN 2 IS NULL THEN "this is true" ELSE "this is false" END', ), 'select_tables' => array(), ) diff --git a/tools/ContextGenerator.php b/tools/ContextGenerator.php index 61c4c36..dccc155 100644 --- a/tools/ContextGenerator.php +++ b/tools/ContextGenerator.php @@ -247,7 +247,7 @@ class ContextGenerator /** * Formats context name. * - * @param string $name Name to format. + * @param string $name name to format * * @return string */ |