Skip to content

Commit 9d3d3b3

Browse files
committed
Reference classes via a use statement
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 4c945b8 commit 9d3d3b3

17 files changed

Lines changed: 57 additions & 34 deletions

src/Component.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace PhpMyAdmin\SqlParser;
1313

14+
use Exception;
15+
1416
/**
1517
* A component (of a statement) is a part of a statement that is common to
1618
* multiple query types.
@@ -29,7 +31,7 @@ abstract class Component
2931
* @param TokensList $list the list of tokens that are being parsed
3032
* @param array $options parameters for parsing
3133
*
32-
* @throws \Exception not implemented yet
34+
* @throws Exception not implemented yet
3335
*
3436
* @return mixed
3537
*/
@@ -40,7 +42,7 @@ public static function parse(
4042
) {
4143
// This method should be abstract, but it can't be both static and
4244
// abstract.
43-
throw new \Exception(Translator::gettext('Not implemented yet.'));
45+
throw new Exception(Translator::gettext('Not implemented yet.'));
4446
}
4547

4648
/**
@@ -52,15 +54,15 @@ public static function parse(
5254
* @param mixed $component the component to be built
5355
* @param array $options parameters for building
5456
*
55-
* @throws \Exception not implemented yet
57+
* @throws Exception not implemented yet
5658
*
5759
* @return string
5860
*/
5961
public static function build($component, array $options = [])
6062
{
6163
// This method should be abstract, but it can't be both static and
6264
// abstract.
63-
throw new \Exception(Translator::gettext('Not implemented yet.'));
65+
throw new Exception(Translator::gettext('Not implemented yet.'));
6466
}
6567

6668
/**

src/Core.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace PhpMyAdmin\SqlParser;
88

9+
use Exception;
10+
911
class Core
1012
{
1113
/**
@@ -24,7 +26,7 @@ class Core
2426
* error might be false positive or a partial result (even a bad one)
2527
* might be needed.
2628
*
27-
* @var \Exception[]
29+
* @var Exception[]
2830
*
2931
* @see Core::error()
3032
*/
@@ -33,9 +35,9 @@ class Core
3335
/**
3436
* Creates a new error log.
3537
*
36-
* @param \Exception $error the error exception
38+
* @param Exception $error the error exception
3739
*
38-
* @throws \Exception throws the exception, if strict mode is enabled
40+
* @throws Exception throws the exception, if strict mode is enabled
3941
*/
4042
public function error($error)
4143
{

src/Exceptions/LexerException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66

77
namespace PhpMyAdmin\SqlParser\Exceptions;
88

9+
use Exception;
10+
911
/**
1012
* Exception thrown by the lexer.
1113
*
1214
* @category Exceptions
1315
*
1416
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
1517
*/
16-
class LexerException extends \Exception
18+
class LexerException extends Exception
1719
{
1820
/**
1921
* The character that produced this error.

src/Exceptions/LoaderException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66

77
namespace PhpMyAdmin\SqlParser\Exceptions;
88

9+
use Exception;
10+
911
/**
1012
* Exception thrown by the lexer.
1113
*
1214
* @category Exceptions
1315
*
1416
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
1517
*/
16-
class LoaderException extends \Exception
18+
class LoaderException extends Exception
1719
{
1820
/**
1921
* The failed load name.

src/Exceptions/ParserException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace PhpMyAdmin\SqlParser\Exceptions;
88

9+
use Exception;
910
use PhpMyAdmin\SqlParser\Token;
1011

1112
/**
@@ -15,7 +16,7 @@
1516
*
1617
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
1718
*/
18-
class ParserException extends \Exception
19+
class ParserException extends Exception
1920
{
2021
/**
2122
* The token that produced this error.

src/Statements/InsertStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
namespace PhpMyAdmin\SqlParser\Statements;
88

9-
use PhpMyAdmin\SqlParser\Components\ArrayObj;
109
use PhpMyAdmin\SqlParser\Components\Array2d;
10+
use PhpMyAdmin\SqlParser\Components\ArrayObj;
1111
use PhpMyAdmin\SqlParser\Components\IntoKeyword;
1212
use PhpMyAdmin\SqlParser\Components\OptionsArray;
1313
use PhpMyAdmin\SqlParser\Components\SetOperation;

src/Statements/PurgeStatement.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace PhpMyAdmin\SqlParser\Statements;
88

99
use PhpMyAdmin\SqlParser\Components\Expression;
10-
use PhpMyAdmin\SqlParser\Components\OptionsArray;
1110
use PhpMyAdmin\SqlParser\Parser;
1211
use PhpMyAdmin\SqlParser\Statement;
1312
use PhpMyAdmin\SqlParser\Token;

src/TokensList.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66

77
namespace PhpMyAdmin\SqlParser;
88

9+
use ArrayAccess;
10+
911
/**
1012
* A structure representing a list of tokens.
1113
*
1214
* @category Tokens
1315
*
1416
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
1517
*/
16-
class TokensList implements \ArrayAccess
18+
class TokensList implements ArrayAccess
1719
{
1820
/**
1921
* The array of tokens.

src/Translator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
namespace PhpMyAdmin\SqlParser;
88

9+
use PhpMyAdmin\MoTranslator\Loader;
10+
911
class Translator
1012
{
1113
/**
1214
* The MoTranslator loader object.
1315
*
14-
* @var \PhpMyAdmin\MoTranslator\Loader
16+
* @var Loader
1517
*/
1618
private static $loader;
1719

@@ -29,7 +31,7 @@ public static function load()
2931
{
3032
if (is_null(self::$loader)) {
3133
// Create loader object
32-
self::$loader = new \PhpMyAdmin\MoTranslator\Loader();
34+
self::$loader = new Loader();
3335

3436
// Set locale
3537
self::$loader->setlocale(

src/UtfString.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
namespace PhpMyAdmin\SqlParser;
1515

16+
use ArrayAccess;
17+
use Exception;
18+
1619
/**
1720
* Implements array-like access for UTF-8 strings.
1821
*
@@ -22,7 +25,7 @@
2225
*
2326
* @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
2427
*/
25-
class UtfString implements \ArrayAccess
28+
class UtfString implements ArrayAccess
2629
{
2730
/**
2831
* The raw, multi-byte string.
@@ -141,23 +144,23 @@ public function offsetGet($offset)
141144
* @param int $offset the offset to be set
142145
* @param string $value the value to be set
143146
*
144-
* @throws \Exception not implemented
147+
* @throws Exception not implemented
145148
*/
146149
public function offsetSet($offset, $value)
147150
{
148-
throw new \Exception('Not implemented.');
151+
throw new Exception('Not implemented.');
149152
}
150153

151154
/**
152155
* Unsets an index.
153156
*
154157
* @param int $offset the value to be unset
155158
*
156-
* @throws \Exception not implemented
159+
* @throws Exception not implemented
157160
*/
158161
public function offsetUnset($offset)
159162
{
160-
throw new \Exception('Not implemented.');
163+
throw new Exception('Not implemented.');
161164
}
162165

163166
/**

0 commit comments

Comments
 (0)