summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan Ungureanu <udan1107@gmail.com>2015-06-16 01:10:37 +0300
committerDan Ungureanu <udan1107@gmail.com>2015-06-16 01:10:37 +0300
commit655e07391436f1445461db6a02be4efbc34fa35d (patch)
tree06cfe3239cc8cbb34948cc72a824d82e1eaa1cea /src
parent846d7c3417d4b1c748193163f038a2619ce62c93 (diff)
downloadsql-parser-655e07391436f1445461db6a02be4efbc34fa35d.zip
sql-parser-655e07391436f1445461db6a02be4efbc34fa35d.tar.gz
sql-parser-655e07391436f1445461db6a02be4efbc34fa35d.tar.bz2
Improved documentation and coding style.
Diffstat (limited to 'src')
-rw-r--r--src/Context.php16
-rw-r--r--src/Exceptions/LexerException.php12
-rw-r--r--src/Exceptions/ParserException.php10
-rw-r--r--src/Fragment.php6
-rw-r--r--src/Fragments/ArrayFragment.php6
-rw-r--r--src/Fragments/CallKeyword.php6
-rw-r--r--src/Fragments/CreateDefFragment.php6
-rw-r--r--src/Fragments/DataTypeFragment.php14
-rw-r--r--src/Fragments/FieldDefFragment.php10
-rw-r--r--src/Fragments/FieldFragment.php17
-rw-r--r--src/Fragments/FromKeyword.php6
-rw-r--r--src/Fragments/IntoKeyword.php6
-rw-r--r--src/Fragments/JoinKeyword.php6
-rw-r--r--src/Fragments/LimitKeyword.php6
-rw-r--r--src/Fragments/OptionsFragment.php6
-rw-r--r--src/Fragments/OrderKeyword.php6
-rw-r--r--src/Fragments/ParamDefFragment.php6
-rw-r--r--src/Fragments/RenameKeyword.php6
-rw-r--r--src/Fragments/SelectKeyword.php6
-rw-r--r--src/Fragments/SetKeyword.php6
-rw-r--r--src/Fragments/ValuesKeyword.php6
-rw-r--r--src/Fragments/WhereKeyword.php6
-rw-r--r--src/Lexer.php46
-rw-r--r--src/Parser.php10
-rw-r--r--src/UtfString.php2
-rw-r--r--src/Utils/Misc.php6
-rw-r--r--src/Utils/Routine.php6
27 files changed, 127 insertions, 118 deletions
diff --git a/src/Context.php b/src/Context.php
index 2b43e56..4c73af2 100644
--- a/src/Context.php
+++ b/src/Context.php
@@ -372,12 +372,14 @@ abstract class Context
$len = strlen($str);
if ($str[0] === '#') {
return Token::FLAG_COMMENT_BASH;
- } elseif (($len > 1) && ((($str[0] === '/') && ($str[1] === '*')) ||
- (($str[0] === '*') && ($str[1] === '/')))) {
+ } elseif (($len > 1) && ((($str[0] === '/') && ($str[1] === '*'))
+ || (($str[0] === '*') && ($str[1] === '/')))
+ ) {
return Token::FLAG_COMMENT_C;
- } elseif (($len > 2) && ($str[0] === '-') &&
- ($str[1] === '-') && ($str[2] !== "\n") &&
- (static::isWhitespace($str[2]))) {
+ } elseif (($len > 2) && ($str[0] === '-')
+ && ($str[1] === '-') && ($str[2] !== "\n")
+ && (static::isWhitespace($str[2]))
+ ) {
return Token::FLAG_COMMENT_SQL;
}
return null;
@@ -413,8 +415,8 @@ abstract class Context
*/
public static function isNumber($ch)
{
- return (($ch >= '0') && ($ch <= '9')) || ($ch === '.') ||
- ($ch === '-') || ($ch === '+') || ($ch === 'e') || ($ch === 'E');
+ return (($ch >= '0') && ($ch <= '9')) || ($ch === '.')
+ || ($ch === '-') || ($ch === '+') || ($ch === 'e') || ($ch === 'E');
}
// -------------------------------------------------------------------------
diff --git a/src/Exceptions/LexerException.php b/src/Exceptions/LexerException.php
index f346d83..306c8b9 100644
--- a/src/Exceptions/LexerException.php
+++ b/src/Exceptions/LexerException.php
@@ -27,14 +27,14 @@ class LexerException extends \Exception
/**
* Constructor.
*
- * @param string $message
- * @param string $ch
- * @param int $positiion
- * @param int $code
+ * @param string $msg The message of this 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.
*/
- public function __construct($message = '', $ch = '', $pos = 0, $code = 0)
+ public function __construct($msg = '', $ch = '', $pos = 0, $code = 0)
{
- parent::__construct($message, $code);
+ parent::__construct($msg, $code);
$this->ch = $ch;
$this->pos = $pos;
}
diff --git a/src/Exceptions/ParserException.php b/src/Exceptions/ParserException.php
index e23d03d..7332674 100644
--- a/src/Exceptions/ParserException.php
+++ b/src/Exceptions/ParserException.php
@@ -20,13 +20,13 @@ class ParserException extends \Exception
/**
* Constructor.
*
- * @param string $message
- * @param Token $token
- * @param int $code
+ * @param string $msg The message of this exception.
+ * @param Token $token The token that produced this exception.
+ * @param int $code The code of this error.
*/
- public function __construct($message = '', Token $token = null, $code = 0)
+ public function __construct($msg = '', Token $token = null, $code = 0)
{
- parent::__construct($message, $code);
+ parent::__construct($msg, $code);
$this->token = $token;
}
}
diff --git a/src/Fragment.php b/src/Fragment.php
index e9a4620..86f9d36 100644
--- a/src/Fragment.php
+++ b/src/Fragment.php
@@ -20,9 +20,9 @@ abstract class Fragment
/**
* Parses the tokens given by the lexer in the context of the given parser.
*
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return array
*/
diff --git a/src/Fragments/ArrayFragment.php b/src/Fragments/ArrayFragment.php
index 9ff8649..3b796b7 100644
--- a/src/Fragments/ArrayFragment.php
+++ b/src/Fragments/ArrayFragment.php
@@ -22,9 +22,9 @@ class ArrayFragment extends Fragment
public $array = array();
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return ArrayFragment
*/
diff --git a/src/Fragments/CallKeyword.php b/src/Fragments/CallKeyword.php
index 00b7838..58ee89b 100644
--- a/src/Fragments/CallKeyword.php
+++ b/src/Fragments/CallKeyword.php
@@ -29,9 +29,9 @@ class CallKeyword extends Fragment
public $parameters = array();
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return CallKeyword
*/
diff --git a/src/Fragments/CreateDefFragment.php b/src/Fragments/CreateDefFragment.php
index 708ce11..fefb43d 100644
--- a/src/Fragments/CreateDefFragment.php
+++ b/src/Fragments/CreateDefFragment.php
@@ -70,9 +70,9 @@ class CreateDefFragment extends Fragment
public $name;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return CreateDefFragment
*/
diff --git a/src/Fragments/DataTypeFragment.php b/src/Fragments/DataTypeFragment.php
index c0a4f61..ad98d0a 100644
--- a/src/Fragments/DataTypeFragment.php
+++ b/src/Fragments/DataTypeFragment.php
@@ -18,10 +18,10 @@ class DataTypeFragment extends Fragment
public static $OPTIONS = array(
'BINARY' => 1,
'CHARACTER SET' => array(2, 'var'),
- 'CHARSET' => array(3, 'var'),
- 'COLLATE' => 4,
- 'UNSIGNED' => 5,
- 'ZEROFILL' => 6,
+ 'CHARSET' => array(2, 'var'),
+ 'COLLATE' => 3,
+ 'UNSIGNED' => 4,
+ 'ZEROFILL' => 5,
);
/**
@@ -46,9 +46,9 @@ class DataTypeFragment extends Fragment
public $options = array();
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return DataTypeFragment[]
*/
diff --git a/src/Fragments/FieldDefFragment.php b/src/Fragments/FieldDefFragment.php
index fe94184..6cbe58e 100644
--- a/src/Fragments/FieldDefFragment.php
+++ b/src/Fragments/FieldDefFragment.php
@@ -52,9 +52,9 @@ class FieldDefFragment extends Fragment
/**
* The array of indexes.
*
- * @var array
+ * @var ArrayFragment
*/
- public $indexes = array();
+ public $indexes;
/**
* The options of the new field fragment.
@@ -64,9 +64,9 @@ class FieldDefFragment extends Fragment
public $options;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return FieldDefFragment[]
*/
diff --git a/src/Fragments/FieldFragment.php b/src/Fragments/FieldFragment.php
index 71e1066..0402b3f 100644
--- a/src/Fragments/FieldFragment.php
+++ b/src/Fragments/FieldFragment.php
@@ -50,9 +50,9 @@ class FieldFragment extends Fragment
public $alias;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return FieldFragment
*/
@@ -121,9 +121,9 @@ class FieldFragment extends Fragment
}
}
- if (($token->type === Token::TYPE_NUMBER) || ($token->type === Token::TYPE_BOOL) ||
- (($token->type === Token::TYPE_SYMBOL) && ($token->flags & Token::FLAG_SYMBOL_VARIABLE)) ||
- (($token->type === Token::TYPE_OPERATOR)) && ($token->value !== '.')) {
+ if (($token->type === Token::TYPE_NUMBER) || ($token->type === Token::TYPE_BOOL)
+ || (($token->type === Token::TYPE_SYMBOL) && ($token->flags & Token::FLAG_SYMBOL_VARIABLE))
+ || (($token->type === Token::TYPE_OPERATOR)) && ($token->value !== '.')) {
// Numbers, booleans and operators are usually part of expressions.
$isExpr = true;
}
@@ -147,8 +147,9 @@ class FieldFragment extends Fragment
}
} else {
if ($brackets === 0) {
- if (($token->type === Token::TYPE_NONE) || ($token->type === Token::TYPE_STRING) ||
- (($token->type === Token::TYPE_SYMBOL) && ($token->flags & Token::FLAG_SYMBOL_BACKTICK))) {
+ if (($token->type === Token::TYPE_NONE) || ($token->type === Token::TYPE_STRING)
+ || (($token->type === Token::TYPE_SYMBOL) && ($token->flags & Token::FLAG_SYMBOL_BACKTICK))
+ ) {
$ret->alias = $token->value;
}
}
diff --git a/src/Fragments/FromKeyword.php b/src/Fragments/FromKeyword.php
index fd11eea..dd1f263 100644
--- a/src/Fragments/FromKeyword.php
+++ b/src/Fragments/FromKeyword.php
@@ -15,9 +15,9 @@ class FromKeyword extends Fragment
{
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return FieldFragment[]
*/
diff --git a/src/Fragments/IntoKeyword.php b/src/Fragments/IntoKeyword.php
index 9f6a116..888a55e 100644
--- a/src/Fragments/IntoKeyword.php
+++ b/src/Fragments/IntoKeyword.php
@@ -29,9 +29,9 @@ class IntoKeyword extends Fragment
public $fields;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return IntoKeyword
*/
diff --git a/src/Fragments/JoinKeyword.php b/src/Fragments/JoinKeyword.php
index 62f9ecd..411d227 100644
--- a/src/Fragments/JoinKeyword.php
+++ b/src/Fragments/JoinKeyword.php
@@ -29,9 +29,9 @@ class JoinKeyword extends Fragment
public $on;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return JoinKeyword
*/
diff --git a/src/Fragments/LimitKeyword.php b/src/Fragments/LimitKeyword.php
index 08fb3a4..4b59137 100644
--- a/src/Fragments/LimitKeyword.php
+++ b/src/Fragments/LimitKeyword.php
@@ -29,9 +29,9 @@ class LimitKeyword extends Fragment
public $row_count;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return LimitKeyword
*/
diff --git a/src/Fragments/OptionsFragment.php b/src/Fragments/OptionsFragment.php
index 22661eb..1a39c6c 100644
--- a/src/Fragments/OptionsFragment.php
+++ b/src/Fragments/OptionsFragment.php
@@ -22,9 +22,9 @@ class OptionsFragment extends Fragment
public $options = array();
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return OptionsFragment
*/
diff --git a/src/Fragments/OrderKeyword.php b/src/Fragments/OrderKeyword.php
index 5ddc8ef..1bc6b8f 100644
--- a/src/Fragments/OrderKeyword.php
+++ b/src/Fragments/OrderKeyword.php
@@ -29,9 +29,9 @@ class OrderKeyword extends Fragment
public $type = 'ASC';
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return OrderKeyword[]
*/
diff --git a/src/Fragments/ParamDefFragment.php b/src/Fragments/ParamDefFragment.php
index b7d414d..c2582ef 100644
--- a/src/Fragments/ParamDefFragment.php
+++ b/src/Fragments/ParamDefFragment.php
@@ -37,9 +37,9 @@ class ParamDefFragment extends Fragment
public $type;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return ParamDefFragment[]
*/
diff --git a/src/Fragments/RenameKeyword.php b/src/Fragments/RenameKeyword.php
index 7841b2a..dd8b2f9 100644
--- a/src/Fragments/RenameKeyword.php
+++ b/src/Fragments/RenameKeyword.php
@@ -29,9 +29,9 @@ class RenameKeyword extends Fragment
public $new;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return RenameKeyword
*/
diff --git a/src/Fragments/SelectKeyword.php b/src/Fragments/SelectKeyword.php
index dc8db95..9b28812 100644
--- a/src/Fragments/SelectKeyword.php
+++ b/src/Fragments/SelectKeyword.php
@@ -15,9 +15,9 @@ class SelectKeyword extends Fragment
{
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return FieldFragment[]
*/
diff --git a/src/Fragments/SetKeyword.php b/src/Fragments/SetKeyword.php
index 1e70f27..170b076 100644
--- a/src/Fragments/SetKeyword.php
+++ b/src/Fragments/SetKeyword.php
@@ -29,9 +29,9 @@ class SetKeyword extends Fragment
public $value;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return SetKeyword[]
*/
diff --git a/src/Fragments/ValuesKeyword.php b/src/Fragments/ValuesKeyword.php
index c6bd551..8fce245 100644
--- a/src/Fragments/ValuesKeyword.php
+++ b/src/Fragments/ValuesKeyword.php
@@ -22,9 +22,9 @@ class ValuesKeyword extends Fragment
public $values;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return ValuesKeyword
*/
diff --git a/src/Fragments/WhereKeyword.php b/src/Fragments/WhereKeyword.php
index 786efbf..9c30513 100644
--- a/src/Fragments/WhereKeyword.php
+++ b/src/Fragments/WhereKeyword.php
@@ -36,9 +36,9 @@ class WhereKeyword extends Fragment
public $condition;
/**
- * @param Parser $parser
- * @param TokensList $list
- * @param array $options
+ * @param Parser $parser The parser that serves as context.
+ * @param TokensList $list The list of tokens that are being parsed.
+ * @param array $options Parameters for parsing.
*
* @return WhereKeyword[]
*/
diff --git a/src/Lexer.php b/src/Lexer.php
index 2b980ab..be92301 100644
--- a/src/Lexer.php
+++ b/src/Lexer.php
@@ -106,8 +106,8 @@ class Lexer
/**
* Constructor.
*
- * @param string|UtfString $str
- * @param bool $strict
+ * @param string|UtfString $str The query to be lexed.
+ * @param bool $strict Whether strict mode should be enabled or not.
*/
public function __construct($str, $strict = false)
{
@@ -120,8 +120,6 @@ class Lexer
/**
* Parses the string and extracts lexems.
- *
- * @param string|UtfString $str
*/
public function lex()
{
@@ -153,11 +151,15 @@ class Lexer
if ($this->delimiter !== $this->str[$this->last]) {
$this->error('Unexpected character.', $this->str[$this->last], $this->last);
}
- } elseif (($token->type === Token::TYPE_SYMBOL) && ($token->flags & Token::FLAG_SYMBOL_VARIABLE) &&
- ($lastToken !== null)) {
+ } elseif (($token->type === Token::TYPE_SYMBOL)
+ && ($token->flags & Token::FLAG_SYMBOL_VARIABLE)
+ && ($lastToken !== null)
+ ) {
// Handles ```... FROM 'user'@'%' ...```.
- if ((($lastToken->type === Token::TYPE_SYMBOL) && ($lastToken->flags & Token::FLAG_SYMBOL_BACKTICK)) ||
- ($lastToken->type === Token::TYPE_STRING)) {
+ if ((($lastToken->type === Token::TYPE_SYMBOL)
+ && ($lastToken->flags & Token::FLAG_SYMBOL_BACKTICK))
+ || ($lastToken->type === Token::TYPE_STRING)
+ ) {
$lastToken->token .= $token->token;
$lastToken->type = Token::TYPE_SYMBOL;
$lastToken->flags = Token::FLAG_SYMBOL_USER;
@@ -199,9 +201,10 @@ class Lexer
/**
* Creates a new error log.
*
- * @param string $msg
- * @param string $str
- * @param int $code
+ * @param string $msg The error message.
+ * @param string $ch The character that produced the error.
+ * @param int $pos The position of the character.
+ * @param int $code The code of the error.
*/
public function error($msg = '', $str = '', $pos = 0, $code = 0)
{
@@ -427,8 +430,9 @@ class Lexer
} elseif ($this->str[$this->last] === '-') {
$flags |= Token::FLAG_NUMBER_NEGATIVE;
// Do nothing.
- } elseif (($this->str[$this->last] === '0') && ($this->last + 1 < $this->len) &&
- (($this->str[$this->last + 1] === 'x') || ($this->str[$this->last + 1] === 'X'))) {
+ } elseif (($this->str[$this->last] === '0') && ($this->last + 1 < $this->len)
+ && (($this->str[$this->last + 1] === 'x') || ($this->str[$this->last + 1] === 'X'))
+ ) {
$token .= $this->str[$this->last++];
$state = 2;
} elseif (($this->str[$this->last] >= '0') && ($this->str[$this->last] <= '9')) {
@@ -440,9 +444,10 @@ class Lexer
}
} elseif ($state === 2) {
$flags |= Token::FLAG_NUMBER_HEX;
- if ((($this->str[$this->last] >= '0') && ($this->str[$this->last] <= '9')) ||
- (($this->str[$this->last] >= 'A') && ($this->str[$this->last] <= 'F')) ||
- (($this->str[$this->last] >= 'a') && ($this->str[$this->last] <= 'f'))) {
+ if ((($this->str[$this->last] >= '0') && ($this->str[$this->last] <= '9'))
+ || (($this->str[$this->last] >= 'A') && ($this->str[$this->last] <= 'F'))
+ || (($this->str[$this->last] >= 'a') && ($this->str[$this->last] <= 'f'))
+ ) {
// Do nothing.
} else {
break;
@@ -494,7 +499,7 @@ class Lexer
/**
* Parses a string.
*
- * @param string $quote Additional start symbol.
+ * @param string $quote Additional starting symbol.
*
* @return Token
*/
@@ -507,9 +512,10 @@ class Lexer
$quote = $token;
while (++$this->last < $this->len) {
- if (($this->last + 1 < $this->len) &&
- ((($this->str[$this->last] === $quote) && ($this->str[$this->last + 1] === $quote)) ||
- (($this->str[$this->last] === '\\') && ($quote !== '`')))) {
+ if (($this->last + 1 < $this->len)
+ && ((($this->str[$this->last] === $quote) && ($this->str[$this->last + 1] === $quote))
+ || (($this->str[$this->last] === '\\') && ($quote !== '`')))
+ ) {
$token .= $this->str[$this->last] . $this->str[++$this->last];
} else {
if ($this->str[$this->last] === $quote) {
diff --git a/src/Parser.php b/src/Parser.php
index 167e912..059faa5 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -119,8 +119,8 @@ class Parser
/**
* Constructor.
*
- * @param mixed $list
- * @param bool $strict
+ * @param mixed $list The list of tokens to be parsed.
+ * @param bool $strict Whether strict mode should be enabled or not.
*/
public function __construct($list = null, $strict = false)
{
@@ -181,9 +181,9 @@ class Parser
/**
* Creates a new error log.
*
- * @param string $str
- * @param Token $token
- * @param int $code
+ * @param string $msg The error message.
+ * @param Token $token The token that produced the error.
+ * @param int $code The code of the error.
*/
public function error($str = '', Token $token = null, $code = 0)
{
diff --git a/src/UtfString.php b/src/UtfString.php
index 8815e58..0f68cfe 100644
--- a/src/UtfString.php
+++ b/src/UtfString.php
@@ -154,7 +154,7 @@ class UtfString implements \ArrayAccess
*
* @return int
*/
- private static function getCharLength($byte)
+ public static function getCharLength($byte)
{
$byte = ord($byte);
if ($byte < 128) {
diff --git a/src/Utils/Misc.php b/src/Utils/Misc.php
index dc8b438..473bf9b 100644
--- a/src/Utils/Misc.php
+++ b/src/Utils/Misc.php
@@ -2,7 +2,7 @@
namespace SqlParser\Utils;
-use SqlParser\Statement;
+use SqlParser\Statements\SelectStatement;
class Misc
{
@@ -10,12 +10,12 @@ class Misc
/**
* Gets a list of all aliases and their original names.
*
- * @param Statement $tree
+ * @param SelectStatement $tree The tree that was generated after parsing.
* @param string $db
*
* @return array
*/
- public static function getAliases($tree, $db)
+ public static function getAliases(SelectStatement $tree, $db)
{
$retval = array();
diff --git a/src/Utils/Routine.php b/src/Utils/Routine.php
index 126ed53..36511ca 100644
--- a/src/Utils/Routine.php
+++ b/src/Utils/Routine.php
@@ -4,9 +4,9 @@ namespace SqlParser\Utils;
use SqlParser\Lexer;
use SqlParser\Parser;
-use SqlParser\Statement;
use SqlParser\Fragments\DataTypeFragment;
use SqlParser\Fragments\ParamDefFragment;
+use SqlParser\Statements\CreateStatement;
class Routine
{
@@ -80,11 +80,11 @@ class Routine
/**
* Gets the parameters of a routine from the parse tree.
*
- * @param Statement $tree
+ * @param CreateStatement $tree The tree that was generated after parsing.
*
* @return array
*/
- public static function getParameters(Statement $tree)
+ public static function getParameters(CreateStatement $tree)
{
$retval = array(
'num' => 0,