@@ -729,9 +729,9 @@ class SQLFormat {
729
729
/**
730
730
* Get stats about the token cache
731
731
*
732
- * @return Array An array containing the keys 'hits', 'misses', 'entries', and 'size' in bytes
732
+ * @return array An array containing the keys 'hits', 'misses', 'entries', and 'size' in bytes
733
733
*/
734
- public static function getCacheStats () {
734
+ public static function getCacheStats () : array {
735
735
return array (
736
736
'hits ' => self ::$ cache_hits ,
737
737
'misses ' => self ::$ cache_misses ,
@@ -783,10 +783,10 @@ protected static function init() {
783
783
* Return the next token and token type in a SQL string.
784
784
* Quoted strings, comments, reserved words, whitespace, and punctuation are all their own tokens.
785
785
*
786
- * @param String $string The SQL string
786
+ * @param string $string The SQL string
787
787
* @param array $previous The result of the previous getNextToken() call
788
788
*
789
- * @return Array An associative array containing the type and value of the token.
789
+ * @return array An associative array containing the type and value of the token.
790
790
*/
791
791
protected static function getNextToken ( $ string , $ previous = null ) {
792
792
// Whitespace
@@ -931,9 +931,9 @@ protected static function getQuotedString( $string ) {
931
931
* Takes a SQL string and breaks it into tokens.
932
932
* Each token is an associative array with type and value.
933
933
*
934
- * @param String $string The SQL string
934
+ * @param string $string The SQL string
935
935
*
936
- * @return Array An array of tokens.
936
+ * @return array An array of tokens.
937
937
*/
938
938
protected static function tokenize ( $ string ) {
939
939
self ::init ();
@@ -1002,10 +1002,10 @@ protected static function tokenize( $string ) {
1002
1002
/**
1003
1003
* Format the whitespace in a SQL string to make it easier to read.
1004
1004
*
1005
- * @param String $string The SQL string
1005
+ * @param string $string The SQL string
1006
1006
* @param boolean $highlight If true, syntax highlighting will also be performed
1007
1007
*
1008
- * @return String The SQL string with HTML styles and formatting wrapped in a <pre> tag
1008
+ * @return string The SQL string with HTML styles and formatting wrapped in a <pre> tag
1009
1009
*/
1010
1010
public static function format ( $ string , $ highlight = true ) {
1011
1011
// This variable will be populated with formatted html
@@ -1291,9 +1291,9 @@ public static function format( $string, $highlight = true ) {
1291
1291
/**
1292
1292
* Add syntax highlighting to a SQL string
1293
1293
*
1294
- * @param String $string The SQL string
1294
+ * @param string $string The SQL string
1295
1295
*
1296
- * @return String The SQL string with HTML styles applied
1296
+ * @return string The SQL string with HTML styles applied
1297
1297
*/
1298
1298
public static function highlight ( $ string ) {
1299
1299
$ tokens = self ::tokenize ( $ string );
@@ -1311,9 +1311,9 @@ public static function highlight( $string ) {
1311
1311
* Split a SQL string into multiple queries.
1312
1312
* Uses ";" as a query delimiter.
1313
1313
*
1314
- * @param String $string The SQL string
1314
+ * @param string $string The SQL string
1315
1315
*
1316
- * @return Array An array of individual query strings without trailing semicolons
1316
+ * @return array An array of individual query strings without trailing semicolons
1317
1317
*/
1318
1318
public static function splitQuery ( $ string ) {
1319
1319
$ queries = array ();
@@ -1351,9 +1351,9 @@ public static function splitQuery( $string ) {
1351
1351
/**
1352
1352
* Remove all comments from a SQL string
1353
1353
*
1354
- * @param String $string The SQL string
1354
+ * @param string $string The SQL string
1355
1355
*
1356
- * @return String The SQL string without comments
1356
+ * @return string The SQL string without comments
1357
1357
*/
1358
1358
public static function removeComments ( $ string ) {
1359
1359
$ result = '' ;
@@ -1376,9 +1376,9 @@ public static function removeComments( $string ) {
1376
1376
/**
1377
1377
* Compress a query by collapsing white space and removing comments
1378
1378
*
1379
- * @param String $string The SQL string
1379
+ * @param string $string The SQL string
1380
1380
*
1381
- * @return String The SQL string without comments
1381
+ * @return string The SQL string without comments
1382
1382
*/
1383
1383
public static function compress ( $ string ) {
1384
1384
$ result = '' ;
@@ -1417,9 +1417,9 @@ public static function compress( $string ) {
1417
1417
/**
1418
1418
* Highlights a token depending on its type.
1419
1419
*
1420
- * @param Array $token An associative array containing type and value.
1420
+ * @param array $token An associative array containing type and value.
1421
1421
*
1422
- * @return String HTML code of the highlighted token.
1422
+ * @return string HTML code of the highlighted token.
1423
1423
*/
1424
1424
protected static function highlightToken ( $ token ) {
1425
1425
$ type = $ token [ self ::TOKEN_TYPE ];
@@ -1462,9 +1462,9 @@ protected static function highlightToken( $token ) {
1462
1462
/**
1463
1463
* Highlights a quoted string
1464
1464
*
1465
- * @param String $value The token's value
1465
+ * @param string $value The token's value
1466
1466
*
1467
- * @return String HTML code of the highlighted token.
1467
+ * @return string HTML code of the highlighted token.
1468
1468
*/
1469
1469
protected static function highlightQuote ( $ value ) {
1470
1470
if ( self ::is_cli () ) {
@@ -1477,9 +1477,9 @@ protected static function highlightQuote( $value ) {
1477
1477
/**
1478
1478
* Highlights a backtick quoted string
1479
1479
*
1480
- * @param String $value The token's value
1480
+ * @param string $value The token's value
1481
1481
*
1482
- * @return String HTML code of the highlighted token.
1482
+ * @return string HTML code of the highlighted token.
1483
1483
*/
1484
1484
protected static function highlightBacktickQuote ( $ value ) {
1485
1485
if ( self ::is_cli () ) {
@@ -1492,9 +1492,9 @@ protected static function highlightBacktickQuote( $value ) {
1492
1492
/**
1493
1493
* Highlights a reserved word
1494
1494
*
1495
- * @param String $value The token's value
1495
+ * @param string $value The token's value
1496
1496
*
1497
- * @return String HTML code of the highlighted token.
1497
+ * @return string HTML code of the highlighted token.
1498
1498
*/
1499
1499
protected static function highlightReservedWord ( $ value ) {
1500
1500
if ( self ::is_cli () ) {
@@ -1507,9 +1507,9 @@ protected static function highlightReservedWord( $value ) {
1507
1507
/**
1508
1508
* Highlights a boundary token
1509
1509
*
1510
- * @param String $value The token's value
1510
+ * @param string $value The token's value
1511
1511
*
1512
- * @return String HTML code of the highlighted token.
1512
+ * @return string HTML code of the highlighted token.
1513
1513
*/
1514
1514
protected static function highlightBoundary ( $ value ) {
1515
1515
if ( $ value === '( ' || $ value === ') ' ) {
@@ -1526,9 +1526,9 @@ protected static function highlightBoundary( $value ) {
1526
1526
/**
1527
1527
* Highlights a number
1528
1528
*
1529
- * @param String $value The token's value
1529
+ * @param string $value The token's value
1530
1530
*
1531
- * @return String HTML code of the highlighted token.
1531
+ * @return string HTML code of the highlighted token.
1532
1532
*/
1533
1533
protected static function highlightNumber ( $ value ) {
1534
1534
if ( self ::is_cli () ) {
@@ -1541,9 +1541,9 @@ protected static function highlightNumber( $value ) {
1541
1541
/**
1542
1542
* Highlights an error
1543
1543
*
1544
- * @param String $value The token's value
1544
+ * @param string $value The token's value
1545
1545
*
1546
- * @return String HTML code of the highlighted token.
1546
+ * @return string HTML code of the highlighted token.
1547
1547
*/
1548
1548
protected static function highlightError ( $ value ) {
1549
1549
if ( self ::is_cli () ) {
@@ -1556,9 +1556,9 @@ protected static function highlightError( $value ) {
1556
1556
/**
1557
1557
* Highlights a comment
1558
1558
*
1559
- * @param String $value The token's value
1559
+ * @param string $value The token's value
1560
1560
*
1561
- * @return String HTML code of the highlighted token.
1561
+ * @return string HTML code of the highlighted token.
1562
1562
*/
1563
1563
protected static function highlightComment ( $ value ) {
1564
1564
if ( self ::is_cli () ) {
@@ -1571,9 +1571,9 @@ protected static function highlightComment( $value ) {
1571
1571
/**
1572
1572
* Highlights a word token
1573
1573
*
1574
- * @param String $value The token's value
1574
+ * @param string $value The token's value
1575
1575
*
1576
- * @return String HTML code of the highlighted token.
1576
+ * @return string HTML code of the highlighted token.
1577
1577
*/
1578
1578
protected static function highlightWord ( $ value ) {
1579
1579
if ( self ::is_cli () ) {
@@ -1586,9 +1586,9 @@ protected static function highlightWord( $value ) {
1586
1586
/**
1587
1587
* Highlights a variable token
1588
1588
*
1589
- * @param String $value The token's value
1589
+ * @param string $value The token's value
1590
1590
*
1591
- * @return String HTML code of the highlighted token.
1591
+ * @return string HTML code of the highlighted token.
1592
1592
*/
1593
1593
protected static function highlightVariable ( $ value ) {
1594
1594
if ( self ::is_cli () ) {
@@ -1601,9 +1601,9 @@ protected static function highlightVariable( $value ) {
1601
1601
/**
1602
1602
* Helper function for building regular expressions for reserved words and boundary characters
1603
1603
*
1604
- * @param String $a The string to be quoted
1604
+ * @param string $a The string to be quoted
1605
1605
*
1606
- * @return String The quoted string
1606
+ * @return string The quoted string
1607
1607
*/
1608
1608
private static function quote_regex ( $ a ) {
1609
1609
return preg_quote ( $ a , '/ ' );
@@ -1612,9 +1612,9 @@ private static function quote_regex( $a ) {
1612
1612
/**
1613
1613
* Helper function for building string output
1614
1614
*
1615
- * @param String $string The string to be quoted
1615
+ * @param string $string The string to be quoted
1616
1616
*
1617
- * @return String The quoted string
1617
+ * @return string The quoted string
1618
1618
*/
1619
1619
private static function output ( $ string ) {
1620
1620
if ( self ::is_cli () ) {
0 commit comments