Browse Source

Remove method separators, update documentation building configuration

Timothy J. Warren 8 months ago
parent
commit
f967aaf96e

+ 4
- 42
RoboFile.php View File

@@ -40,7 +40,7 @@ class RoboFile extends \Robo\Tasks {
40 40
 	 */
41 41
 	protected $cleanDirs = [
42 42
 		'coverage',
43
-		'docs',
43
+		'apiDocumentation',
44 44
 		'phpdoc',
45 45
 		'build/logs',
46 46
 		'build/phpdox',
@@ -76,14 +76,6 @@ class RoboFile extends \Robo\Tasks {
76 76
 	 */
77 77
 	public function clean()
78 78
 	{
79
-		$cleanFiles = [
80
-			'build/humbug.json',
81
-			'build/humbug-log.txt',
82
-		];
83
-		array_map(function ($file) {
84
-			@unlink($file);
85
-		}, $cleanFiles);
86
-
87 79
 		// So the task doesn't complain,
88 80
 		// make any 'missing' dirs to cleanup
89 81
 		array_map(function ($dir) {
@@ -102,10 +94,7 @@ class RoboFile extends \Robo\Tasks {
102 94
 	 */
103 95
 	public function coverage()
104 96
 	{
105
-		$this->taskPhpUnit()
106
-			->configFile('build/phpunit.xml')
107
-			->printed(true)
108
-			->run();
97
+		$this->_run(['phpdbg -qrr -- vendor/bin/phpunit -c build']);
109 98
 	}
110 99
 
111 100
 	/**
@@ -113,10 +102,7 @@ class RoboFile extends \Robo\Tasks {
113 102
 	 */
114 103
 	public function docs()
115 104
 	{
116
-		$cmd_parts = [
117
-			'phpdoc'
118
-		];
119
-		$this->_run($cmd_parts, ' && ');
105
+		$this->_run(['vendor/bin/phpdox']);
120 106
 	}
121 107
 
122 108
 	/**
@@ -134,29 +120,6 @@ class RoboFile extends \Robo\Tasks {
134 120
 		}
135 121
 	}
136 122
 
137
-
138
-	/**
139
-	 * Run mutation tests with humbug
140
-	 *
141
-	 * @param bool $stats - if true, generates stats rather than running mutation tests
142
-	 */
143
-	public function mutate($stats = FALSE)
144
-	{
145
-		$test_parts = [
146
-			'vendor/bin/humbug'
147
-		];
148
-
149
-		$stat_parts = [
150
-			'vendor/bin/humbug',
151
-			'--skip-killed=yes',
152
-			'-v',
153
-			'./build/humbug.json'
154
-		];
155
-
156
-		$cmd_parts = ($stats) ? $stat_parts : $test_parts;
157
-		$this->_run($cmd_parts);
158
-	}
159
-
160 123
 	/**
161 124
 	 * Run the phpcs tool
162 125
 	 *
@@ -226,9 +189,8 @@ class RoboFile extends \Robo\Tasks {
226 189
 	public function test()
227 190
 	{
228 191
 		$this->lint();
229
-		$this->taskPHPUnit()
192
+		$this->taskPhpUnit()
230 193
 			->configFile('phpunit.xml')
231
-			->printed(true)
232 194
 			->run();
233 195
 		$this->_run(["php tests/index.php"]);
234 196
 	}

phpdoc.dist.xml → build/phpdoc.dist.xml View File


+ 6
- 5
composer.json View File

@@ -21,20 +21,19 @@
21 21
 		"role": "Developer"
22 22
 	}],
23 23
 	"require": {
24
-		"php": "^7.0"
24
+		"php": "^7.1"
25 25
 	},
26 26
 	"require-dev": {
27 27
 		"consolidation/robo": "^1.0.0",
28
-		"infection/infection": "^0.7.0",
29 28
 		"monolog/monolog": "^1.21",
30 29
 		"pdepend/pdepend": "^2.5",
31 30
 		"phploc/phploc": "^4.0",
32
-		"phpmd/phpmd": "^2.4",
33 31
 		"phpstan/phpstan": "^0.9.1",
34 32
 		"phpunit/phpunit": "^6.5",
35
-		"sebastian/phpcpd": "^2.0",
33
+		"sebastian/phpcpd": "^3.0",
36 34
 		"simpletest/simpletest": "^1.1",
37
-		"squizlabs/php_codesniffer": "^3.0.0"
35
+		"squizlabs/php_codesniffer": "^3.0.0",
36
+		"theseer/phpdox": "^0.11.0"
38 37
 	},
39 38
 	"autoload": {
40 39
 		"psr-4": {
@@ -48,6 +47,8 @@
48 47
 		}
49 48
 	},
50 49
 	"scripts": {
50
+		"build": "robo build",
51
+		"clean": "robo clean",
51 52
 		"coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build",
52 53
 		"phpstan": "phpstan analyse -l 3 -c phpstan.neon src tests",
53 54
 		"test": "phpunit -c build --no-coverage"

build/phpdox.xml → phpdox.xml View File

@@ -9,7 +9,7 @@
9 9
     <bootstrap />
10 10
 
11 11
     <!-- A phpDox project to process, you can have multiple projects in one config file -->
12
-    <project name="Query" source="../src" workdir="phpdox/xml">
12
+    <project name="Query" source="src" workdir="build/phpdox/xml">
13 13
         <!--  @name    - The name of the project -->
14 14
         <!--  @source  - The source directory of the application to process -->
15 15
         <!--  @workdir - The directory to store the xml data files in -->
@@ -56,12 +56,12 @@
56 56
         </collector>
57 57
 
58 58
         <!--  Configuration of generation process -->
59
-        <generator output="../docs">
59
+        <generator output="apiDocumentation">
60 60
             <!-- @output - (Base-)Directory to store output data in -->
61 61
 
62 62
             <!-- A generation process consists of one or more build tasks and of (optional) enrich sources -->
63 63
 
64
-            <enrich base="logs">
64
+            <enrich base="build/logs">
65 65
                 <!-- @base - (Base-)Directory of datafiles used for enrich process -->
66 66
 
67 67
                 <!--<source type="...">-->
@@ -84,11 +84,9 @@
84 84
                 </source>
85 85
 
86 86
                 <!-- PHP Code Sniffer findings -->
87
-                <!--
88 87
                 <source type="phpcs">
89
-                    <file name="logs/phpcs.xml" />
88
+                    <file name="phpcs.xml" />
90 89
                 </source>
91
-                -->
92 90
 
93 91
                 <!-- PHPMessDetector -->
94 92
                 <!--
@@ -99,7 +97,7 @@
99 97
 
100 98
                 <!-- PHPUnit Coverage XML -->
101 99
                 <source type="phpunit">
102
-                    <coverage path="logs/coverage.xml" />
100
+                    <coverage path="coverage" />
103 101
                     <!-- <coverage path="clover.xml" />-->
104 102
                     <!--           @path - the directory where the xml code coverage report can be found -->
105 103
                     <!--<filter directory="${phpDox.project.source}" />-->

+ 0
- 3
src/BadDBDriverException.php View File

@@ -18,9 +18,6 @@ use InvalidArgumentException;
18 18
 
19 19
 /**
20 20
  * Generic exception for bad drivers
21
- *
22
- * @package Query
23
- * @subpackage Core
24 21
  */
25 22
 class BadDBDriverException extends InvalidArgumentException {
26 23
 }

+ 1
- 1
src/Drivers/AbstractDriver.php View File

@@ -544,7 +544,7 @@ abstract class AbstractDriver
544 544
 
545 545
 		$sql = "INSERT INTO {$table} ("
546 546
 			. implode(',', $this->quoteIdent($fields))
547
-			. ") VALUES ";
547
+			. ') VALUES ';
548 548
 
549 549
 		// Create the placeholder groups
550 550
 		$params = array_fill(0, count($fields), '?');

+ 1
- 4
src/Drivers/AbstractSQL.php View File

@@ -15,10 +15,7 @@
15 15
 namespace Query\Drivers;
16 16
 
17 17
 /**
18
- * parent for database manipulation subclasses
19
- *
20
- * @package Query
21
- * @subpackage Drivers
18
+ * Parent for database-specific syntax subclasses
22 19
  */
23 20
 abstract class AbstractSQL implements SQLInterface {
24 21
 

+ 0
- 4
src/Drivers/Pgsql/Driver.php View File

@@ -40,8 +40,6 @@ class Driver extends AbstractDriver {
40 40
 		parent::__construct($dsn, $username, $password, $options);
41 41
 	}
42 42
 
43
-	// --------------------------------------------------------------------------
44
-
45 43
 	/**
46 44
 	 * Get a list of schemas for the current connection
47 45
 	 *
@@ -58,8 +56,6 @@ SQL;
58 56
 		return $this->driverQuery($sql);
59 57
 	}
60 58
 
61
-	// --------------------------------------------------------------------------
62
-
63 59
 	/**
64 60
 	 * Retrieve foreign keys for the table
65 61
 	 *

+ 1
- 4
src/Drivers/SQLInterface.php View File

@@ -15,10 +15,7 @@
15 15
 namespace Query\Drivers;
16 16
 
17 17
 /**
18
- * parent for database manipulation subclasses
19
- *
20
- * @package Query
21
- * @subpackage Drivers
18
+ * Interface for database-specific syntax subclasses
22 19
  */
23 20
 interface SQLInterface {
24 21
 

+ 2
- 2
src/Drivers/Sqlite/Driver.php View File

@@ -121,12 +121,12 @@ class Driver extends AbstractDriver {
121 121
 		{
122 122
 			$cols[] = $this->_quote($datum) . ' AS ' . $this->quoteIdent($colname);
123 123
 		}
124
-		$sql .= "SELECT " . implode(', ', $cols) . "\n";
124
+		$sql .= 'SELECT ' . implode(', ', $cols) . "\n";
125 125
 
126 126
 		foreach($data as $union)
127 127
 		{
128 128
 			$vals = array_map([$this, 'quote'], $union);
129
-			$sql .= "UNION SELECT " . implode(',', $vals) . "\n";
129
+			$sql .= 'UNION SELECT ' . implode(',', $vals) . "\n";
130 130
 		}
131 131
 
132 132
 		return [$sql, NULL];

+ 0
- 2
src/Drivers/Sqlite/Util.php View File

@@ -20,8 +20,6 @@ use Query\Drivers\AbstractUtil;
20 20
 /**
21 21
  * SQLite-specific backup, import and creation methods
22 22
  *
23
- * @package Query
24
- * @subpackage Drivers
25 23
  * @method mixed query(string $sql)
26 24
  * @method string quote(string $str)
27 25
  */

+ 27
- 29
src/QueryBuilder.php View File

@@ -258,7 +258,7 @@ class QueryBuilder implements QueryBuilderInterface {
258 258
 	 * @param string $tblname
259 259
 	 * @return QueryBuilderInterface
260 260
 	 */
261
-	public function from($tblname): QueryBuilderInterface
261
+	public function from(string $tblname): QueryBuilderInterface
262 262
 	{
263 263
 		// Split identifiers on spaces
264 264
 		$identArray = explode(' ', \mb_trim($tblname));
@@ -286,7 +286,7 @@ class QueryBuilder implements QueryBuilderInterface {
286 286
 	 * @param string $pos
287 287
 	 * @return QueryBuilderInterface
288 288
 	 */
289
-	public function like($field, $val, $pos='both'): QueryBuilderInterface
289
+	public function like(string $field, $val, string $pos='both'): QueryBuilderInterface
290 290
 	{
291 291
 		return $this->_like($field, $val, $pos);
292 292
 	}
@@ -299,7 +299,7 @@ class QueryBuilder implements QueryBuilderInterface {
299 299
 	 * @param string $pos
300 300
 	 * @return QueryBuilderInterface
301 301
 	 */
302
-	public function orLike($field, $val, $pos='both'): QueryBuilderInterface
302
+	public function orLike(string $field, $val, string $pos='both'): QueryBuilderInterface
303 303
 	{
304 304
 		return $this->_like($field, $val, $pos, 'LIKE', 'OR');
305 305
 	}
@@ -312,9 +312,9 @@ class QueryBuilder implements QueryBuilderInterface {
312 312
 	 * @param string $pos
313 313
 	 * @return QueryBuilderInterface
314 314
 	 */
315
-	public function notLike($field, $val, $pos='both'): QueryBuilderInterface
315
+	public function notLike(string $field, $val, string $pos='both'): QueryBuilderInterface
316 316
 	{
317
-		return $this->_like($field, $val, $pos, 'NOT LIKE', 'AND');
317
+		return $this->_like($field, $val, $pos, 'NOT LIKE');
318 318
 	}
319 319
 
320 320
 	/**
@@ -325,7 +325,7 @@ class QueryBuilder implements QueryBuilderInterface {
325 325
 	 * @param string $pos
326 326
 	 * @return QueryBuilderInterface
327 327
 	 */
328
-	public function orNotLike($field, $val, $pos='both'): QueryBuilderInterface
328
+	public function orNotLike(string $field, $val, string $pos='both'): QueryBuilderInterface
329 329
 	{
330 330
 		return $this->_like($field, $val, $pos, 'NOT LIKE', 'OR');
331 331
 	}
@@ -343,7 +343,7 @@ class QueryBuilder implements QueryBuilderInterface {
343 343
 	 */
344 344
 	public function having($key, $val=[]): QueryBuilderInterface
345 345
 	{
346
-		return $this->_having($key, $val, 'AND');
346
+		return $this->_having($key, $val);
347 347
 	}
348 348
 
349 349
 	/**
@@ -422,7 +422,7 @@ class QueryBuilder implements QueryBuilderInterface {
422 422
 	 */
423 423
 	public function whereNotIn($field, $val=[]): QueryBuilderInterface
424 424
 	{
425
-		return $this->_whereIn($field, $val, 'NOT IN', 'AND');
425
+		return $this->_whereIn($field, $val, 'NOT IN');
426 426
 	}
427 427
 
428 428
 	/**
@@ -488,7 +488,7 @@ class QueryBuilder implements QueryBuilderInterface {
488 488
 	 * @param string $type
489 489
 	 * @return QueryBuilderInterface
490 490
 	 */
491
-	public function join($table, $condition, $type=''): QueryBuilderInterface
491
+	public function join(string $table, string $condition, string $type=''): QueryBuilderInterface
492 492
 	{
493 493
 		// Prefix and quote table name
494 494
 		$table = explode(' ', mb_trim($table));
@@ -537,7 +537,7 @@ class QueryBuilder implements QueryBuilderInterface {
537 537
 	 * @param string $type
538 538
 	 * @return QueryBuilderInterface
539 539
 	 */
540
-	public function orderBy($field, $type=''): QueryBuilderInterface
540
+	public function orderBy(string $field, string $type=''): QueryBuilderInterface
541 541
 	{
542 542
 		// When ordering by random, do an ascending order if the driver
543 543
 		// doesn't support random ordering
@@ -560,7 +560,7 @@ class QueryBuilder implements QueryBuilderInterface {
560 560
 		}
561 561
 
562 562
 		// Set the final string
563
-		$orderString = ( ! isset($rand))
563
+		$orderString =  ! isset($rand)
564 564
 			? "\nORDER BY ".implode(', ', $orderClauses)
565 565
 			: "\nORDER BY".$rand;
566 566
 
@@ -576,7 +576,7 @@ class QueryBuilder implements QueryBuilderInterface {
576 576
 	 * @param int|bool $offset
577 577
 	 * @return QueryBuilderInterface
578 578
 	 */
579
-	public function limit($limit, $offset=FALSE): QueryBuilderInterface
579
+	public function limit(int $limit, $offset=FALSE): QueryBuilderInterface
580 580
 	{
581 581
 		$this->state->setLimit($limit);
582 582
 		$this->state->setOffset($offset);
@@ -668,7 +668,7 @@ class QueryBuilder implements QueryBuilderInterface {
668 668
 	 * @param int|bool $offset
669 669
 	 * @return PDOStatement
670 670
 	 */
671
-	public function get($table='', $limit=FALSE, $offset=FALSE): PDOStatement
671
+	public function get(string $table='', $limit=FALSE, $offset=FALSE): ?PDOStatement
672 672
 	{
673 673
 		// Set the table
674 674
 		if ( ! empty($table))
@@ -689,12 +689,12 @@ class QueryBuilder implements QueryBuilderInterface {
689 689
 	 * Convenience method for get() with a where clause
690 690
 	 *
691 691
 	 * @param string $table
692
-	 * @param array $where
692
+	 * @param mixed $where
693 693
 	 * @param int|bool $limit
694 694
 	 * @param int|bool $offset
695 695
 	 * @return PDOStatement
696 696
 	 */
697
-	public function getWhere($table, $where=[], $limit=FALSE, $offset=FALSE): PDOStatement
697
+	public function getWhere(string $table, $where=[], $limit=FALSE, $offset=FALSE): ?PDOStatement
698 698
 	{
699 699
 		// Create the where clause
700 700
 		$this->where($where);
@@ -709,7 +709,7 @@ class QueryBuilder implements QueryBuilderInterface {
709 709
 	 * @param string $table
710 710
 	 * @return int
711 711
 	 */
712
-	public function countAll($table): int
712
+	public function countAll(string $table): int
713 713
 	{
714 714
 		$sql = 'SELECT * FROM '.$this->driver->quoteTable($table);
715 715
 		$res = $this->driver->query($sql);
@@ -745,7 +745,7 @@ class QueryBuilder implements QueryBuilderInterface {
745 745
 	 * @param mixed $data
746 746
 	 * @return PDOStatement
747 747
 	 */
748
-	public function insert($table, $data=[]): PDOStatement
748
+	public function insert(string $table, $data=[]): ?PDOStatement
749 749
 	{
750 750
 		if ( ! empty($data))
751 751
 		{
@@ -762,10 +762,10 @@ class QueryBuilder implements QueryBuilderInterface {
762 762
 	 * @param array $data
763 763
 	 * @return PDOStatement
764 764
 	 */
765
-	public function insertBatch($table, $data=[]): PDOStatement
765
+	public function insertBatch(string $table, $data=[]): ?PDOStatement
766 766
 	{
767 767
 		// Get the generated values and sql string
768
-		list($sql, $data) = $this->driver->insertBatch($table, $data);
768
+		[$sql, $data] = $this->driver->insertBatch($table, $data);
769 769
 
770 770
 		return $sql !== NULL
771 771
 			? $this->_run('', $table, $sql, $data)
@@ -779,7 +779,7 @@ class QueryBuilder implements QueryBuilderInterface {
779 779
 	 * @param mixed $data
780 780
 	 * @return PDOStatement
781 781
 	 */
782
-	public function update($table, $data=[]): PDOStatement
782
+	public function update(string $table, $data=[]): PDOStatement
783 783
 	{
784 784
 		if ( ! empty($data))
785 785
 		{
@@ -796,9 +796,9 @@ class QueryBuilder implements QueryBuilderInterface {
796 796
 	 * @param string $table
797 797
 	 * @param array|object $data
798 798
 	 * @param string $where
799
-	 * @return int|null
799
+	 * @return PDOStatement|null
800 800
 	 */
801
-	public function updateBatch($table, $data, $where)
801
+	public function updateBatch(string $table, $data, $where): ?PDOStatement
802 802
 	{
803 803
 		// Get the generated values and sql string
804 804
 		list($sql, $data) = $this->driver->updateBatch($table, $data, $where);
@@ -815,7 +815,7 @@ class QueryBuilder implements QueryBuilderInterface {
815 815
 	 * @param array $data
816 816
 	 * @return \PDOStatement|null
817 817
 	 */
818
-	public function replace($table, $data=[])
818
+	public function replace(string $table, $data=[]): ?PDOStatement
819 819
 	{
820 820
 		if ( ! empty($data))
821 821
 		{
@@ -832,7 +832,7 @@ class QueryBuilder implements QueryBuilderInterface {
832 832
 	 * @param mixed $where
833 833
 	 * @return PDOStatement
834 834
 	 */
835
-	public function delete($table, $where=''): PDOStatement
835
+	public function delete(string $table, $where=''): ?PDOStatement
836 836
 	{
837 837
 		// Set the where clause
838 838
 		if ( ! empty($where))
@@ -916,8 +916,6 @@ class QueryBuilder implements QueryBuilderInterface {
916 916
 		$this->explain = FALSE;
917 917
 	}
918 918
 
919
-
920
-
921 919
 	/**
922 920
 	 * Method to simplify select_ methods
923 921
 	 *
@@ -1144,7 +1142,7 @@ class QueryBuilder implements QueryBuilderInterface {
1144 1142
 	 * @param boolean $reset
1145 1143
 	 * @return PDOStatement
1146 1144
 	 */
1147
-	protected function _run(string $type, string $table, $sql=NULL, $vals=NULL, bool $reset=TRUE): PDOStatement
1145
+	protected function _run(string $type, string $table, string $sql=NULL, array $vals=NULL, bool $reset=TRUE): PDOStatement
1148 1146
 	{
1149 1147
 		if ($sql === NULL)
1150 1148
 		{
@@ -1153,7 +1151,7 @@ class QueryBuilder implements QueryBuilderInterface {
1153 1151
 
1154 1152
 		if ($vals === NULL)
1155 1153
 		{
1156
-			$vals = array_merge($this->state->getValues(), (array) $this->state->getWhereValues());
1154
+			$vals = array_merge($this->state->getValues(), $this->state->getWhereValues());
1157 1155
 		}
1158 1156
 
1159 1157
 		$startTime = microtime(TRUE);
@@ -1185,7 +1183,7 @@ class QueryBuilder implements QueryBuilderInterface {
1185 1183
 	 * @param int $totalTime
1186 1184
 	 * @return void
1187 1185
 	 */
1188
-	protected function _appendQuery($vals, string $sql, int $totalTime)
1186
+	protected function _appendQuery(array $vals = NULL, string $sql, int $totalTime)
1189 1187
 	{
1190 1188
 		$evals = \is_array($vals) ? $vals : [];
1191 1189
 		$esql = str_replace('?', "%s", $sql);

+ 42
- 111
src/QueryBuilderInterface.php View File

@@ -18,9 +18,6 @@ use PDOStatement;
18 18
 
19 19
 /**
20 20
  * Interface defining the Query Builder class
21
- *
22
- * @package Query
23
- * @subpackage QueryBuilder
24 21
  */
25 22
 interface QueryBuilderInterface {
26 23
 
@@ -36,8 +33,6 @@ interface QueryBuilderInterface {
36 33
 	 */
37 34
 	public function select(string $fields): QueryBuilderInterface;
38 35
 
39
-	// --------------------------------------------------------------------------
40
-
41 36
 	/**
42 37
 	 * Selects the maximum value of a field from a query
43 38
 	 *
@@ -47,8 +42,6 @@ interface QueryBuilderInterface {
47 42
 	 */
48 43
 	public function selectMax(string $field, $as=FALSE): QueryBuilderInterface;
49 44
 
50
-	// --------------------------------------------------------------------------
51
-
52 45
 	/**
53 46
 	 * Selects the minimum value of a field from a query
54 47
 	 *
@@ -58,8 +51,6 @@ interface QueryBuilderInterface {
58 51
 	 */
59 52
 	public function selectMin(string $field, $as=FALSE): QueryBuilderInterface;
60 53
 
61
-	// --------------------------------------------------------------------------
62
-
63 54
 	/**
64 55
 	 * Selects the average value of a field from a query
65 56
 	 *
@@ -69,8 +60,6 @@ interface QueryBuilderInterface {
69 60
 	 */
70 61
 	public function selectAvg(string $field, $as=FALSE): QueryBuilderInterface;
71 62
 
72
-	// --------------------------------------------------------------------------
73
-
74 63
 	/**
75 64
 	 * Selects the sum of a field from a query
76 65
 	 *
@@ -80,8 +69,6 @@ interface QueryBuilderInterface {
80 69
 	 */
81 70
 	public function selectSum(string $field, $as=FALSE): QueryBuilderInterface;
82 71
 
83
-	// --------------------------------------------------------------------------q
84
-
85 72
 	/**
86 73
 	 * Adds the 'distinct' keyword to a query
87 74
 	 *
@@ -89,8 +76,6 @@ interface QueryBuilderInterface {
89 76
 	 */
90 77
 	public function distinct(): QueryBuilderInterface;
91 78
 
92
-	// --------------------------------------------------------------------------
93
-
94 79
 	/**
95 80
 	 * Shows the query plan for the query
96 81
 	 *
@@ -98,15 +83,13 @@ interface QueryBuilderInterface {
98 83
 	 */
99 84
 	public function explain(): QueryBuilderInterface;
100 85
 
101
-	// --------------------------------------------------------------------------
102
-
103 86
 	/**
104 87
 	 * Specify the database table to select from
105 88
 	 *
106 89
 	 * @param string $tblname
107 90
 	 * @return QueryBuilderInterface
108 91
 	 */
109
-	public function from($tblname): QueryBuilderInterface;
92
+	public function from(string $tblname): QueryBuilderInterface;
110 93
 
111 94
 	// --------------------------------------------------------------------------
112 95
 	// ! 'Like' methods
@@ -116,47 +99,41 @@ interface QueryBuilderInterface {
116 99
 	 * Creates a Like clause in the sql statement
117 100
 	 *
118 101
 	 * @param string $field
119
-	 * @param mixed $val
102
+	 * @param mixed $values
120 103
 	 * @param string $pos
121 104
 	 * @return QueryBuilderInterface
122 105
 	 */
123
-	public function like($field, $val, $pos='both'): QueryBuilderInterface;
124
-
125
-	// --------------------------------------------------------------------------
106
+	public function like(string $field, $values, string $pos='both'): QueryBuilderInterface;
126 107
 
127 108
 	/**
128 109
 	 * Generates an OR Like clause
129 110
 	 *
130 111
 	 * @param string $field
131
-	 * @param mixed $val
112
+	 * @param mixed $values
132 113
 	 * @param string $pos
133 114
 	 * @return QueryBuilderInterface
134 115
 	 */
135
-	public function orLike($field, $val, $pos='both'): QueryBuilderInterface;
136
-
137
-	// --------------------------------------------------------------------------
116
+	public function orLike(string $field, $values, string $pos='both'): QueryBuilderInterface;
138 117
 
139 118
 	/**
140 119
 	 * Generates a NOT LIKE clause
141 120
 	 *
142 121
 	 * @param string $field
143
-	 * @param mixed $val
122
+	 * @param mixed $values
144 123
 	 * @param string $pos
145 124
 	 * @return QueryBuilderInterface
146 125
 	 */
147
-	public function notLike($field, $val, $pos='both'): QueryBuilderInterface;
148
-
149
-	// --------------------------------------------------------------------------
126
+	public function notLike(string $field, $values, string $pos='both'): QueryBuilderInterface;
150 127
 
151 128
 	/**
152 129
 	 * Generates a OR NOT LIKE clause
153 130
 	 *
154 131
 	 * @param string $field
155
-	 * @param mixed $val
132
+	 * @param mixed $values
156 133
 	 * @param string $pos
157 134
 	 * @return QueryBuilderInterface
158 135
 	 */
159
-	public function orNotLike($field, $val, $pos='both'): QueryBuilderInterface;
136
+	public function orNotLike(string $field, $values, string $pos='both'): QueryBuilderInterface;
160 137
 
161 138
 	// --------------------------------------------------------------------------
162 139
 	// ! Having methods
@@ -166,21 +143,19 @@ interface QueryBuilderInterface {
166 143
 	 * Generates a 'Having' clause
167 144
 	 *
168 145
 	 * @param mixed $key
169
-	 * @param mixed $val
146
+	 * @param mixed $values
170 147
 	 * @return QueryBuilderInterface
171 148
 	 */
172
-	public function having($key, $val=[]): QueryBuilderInterface;
173
-
174
-	// --------------------------------------------------------------------------
149
+	public function having($key, $values=[]): QueryBuilderInterface;
175 150
 
176 151
 	/**
177 152
 	 * Generates a 'Having' clause prefixed with 'OR'
178 153
 	 *
179 154
 	 * @param mixed $key
180
-	 * @param mixed $val
155
+	 * @param mixed $values
181 156
 	 * @return QueryBuilderInterface
182 157
 	 */
183
-	public function orHaving($key, $val=[]): QueryBuilderInterface;
158
+	public function orHaving($key, $values=[]): QueryBuilderInterface;
184 159
 
185 160
 	// --------------------------------------------------------------------------
186 161
 	// ! 'Where' methods
@@ -192,66 +167,56 @@ interface QueryBuilderInterface {
192 167
 	 * passed array with key / value pairs
193 168
 	 *
194 169
 	 * @param mixed $key
195
-	 * @param mixed $val
170
+	 * @param mixed $values
196 171
 	 * @param bool $escape
197 172
 	 * @return QueryBuilderInterface
198 173
 	 */
199
-	public function where($key, $val=[], $escape = NULL): QueryBuilderInterface;
200
-
201
-	// --------------------------------------------------------------------------
174
+	public function where($key, $values=[], $escape = NULL): QueryBuilderInterface;
202 175
 
203 176
 	/**
204 177
 	 * Where clause prefixed with "OR"
205 178
 	 *
206 179
 	 * @param string $key
207
-	 * @param mixed $val
180
+	 * @param mixed $values
208 181
 	 * @return QueryBuilderInterface
209 182
 	 */
210
-	public function orWhere($key, $val=[]): QueryBuilderInterface;
211
-
212
-	// --------------------------------------------------------------------------
183
+	public function orWhere($key, $values=[]): QueryBuilderInterface;
213 184
 
214 185
 	/**
215 186
 	 * Where clause with 'IN' statement
216 187
 	 *
217 188
 	 * @param mixed $field
218
-	 * @param mixed $val
189
+	 * @param mixed $values
219 190
 	 * @return QueryBuilderInterface
220 191
 	 */
221
-	public function whereIn($field, $val=[]): QueryBuilderInterface;
222
-
223
-	// --------------------------------------------------------------------------
192
+	public function whereIn($field, $values=[]): QueryBuilderInterface;
224 193
 
225 194
 	/**
226 195
 	 * Where in statement prefixed with "or"
227 196
 	 *
228 197
 	 * @param string $field
229
-	 * @param mixed $val
198
+	 * @param mixed $values
230 199
 	 * @return QueryBuilderInterface
231 200
 	 */
232
-	public function orWhereIn($field, $val=[]): QueryBuilderInterface;
233
-
234
-	// --------------------------------------------------------------------------
201
+	public function orWhereIn($field, $values=[]): QueryBuilderInterface;
235 202
 
236 203
 	/**
237 204
 	 * WHERE NOT IN (FOO) clause
238 205
 	 *
239 206
 	 * @param string $field
240
-	 * @param mixed $val
207
+	 * @param mixed $values
241 208
 	 * @return QueryBuilderInterface
242 209
 	 */
243
-	public function whereNotIn($field, $val=[]): QueryBuilderInterface;
244
-
245
-	// --------------------------------------------------------------------------
210
+	public function whereNotIn($field, $values=[]): QueryBuilderInterface;
246 211
 
247 212
 	/**
248 213
 	 * OR WHERE NOT IN (FOO) clause
249 214
 	 *
250 215
 	 * @param string $field
251
-	 * @param mixed $val
216
+	 * @param mixed $values
252 217
 	 * @return QueryBuilderInterface
253 218
 	 */
254
-	public function orWhereNotIn($field, $val=[]): QueryBuilderInterface;
219
+	public function orWhereNotIn($field, $values=[]): QueryBuilderInterface;
255 220
 
256 221
 	// --------------------------------------------------------------------------
257 222
 	// ! Other Query Modifier methods
@@ -261,12 +226,10 @@ interface QueryBuilderInterface {
261 226
 	 * Sets values for inserts / updates / deletes
262 227
 	 *
263 228
 	 * @param mixed $key
264
-	 * @param mixed $val
229
+	 * @param mixed $values
265 230
 	 * @return QueryBuilderInterface
266 231
 	 */
267
-	public function set($key, $val = NULL): QueryBuilderInterface;
268
-
269
-	// --------------------------------------------------------------------------
232
+	public function set($key, $values = NULL): QueryBuilderInterface;
270 233
 
271 234
 	/**
272 235
 	 * Creates a join phrase in a compiled query
@@ -276,9 +239,7 @@ interface QueryBuilderInterface {
276 239
 	 * @param string $type
277 240
 	 * @return QueryBuilderInterface
278 241
 	 */
279
-	public function join($table, $condition, $type=''): QueryBuilderInterface;
280
-
281
-	// --------------------------------------------------------------------------
242
+	public function join(string $table, string $condition, string $type=''): QueryBuilderInterface;
282 243
 
283 244
 	/**
284 245
 	 * Group the results by the selected field(s)
@@ -288,8 +249,6 @@ interface QueryBuilderInterface {
288 249
 	 */
289 250
 	public function groupBy($field): QueryBuilderInterface;
290 251
 
291
-	// --------------------------------------------------------------------------
292
-
293 252
 	/**
294 253
 	 * Order the results by the selected field(s)
295 254
 	 *
@@ -297,9 +256,7 @@ interface QueryBuilderInterface {
297 256
 	 * @param string $type
298 257
 	 * @return QueryBuilderInterface
299 258
 	 */
300
-	public function orderBy($field, $type=""): QueryBuilderInterface;
301
-
302
-	// --------------------------------------------------------------------------
259
+	public function orderBy(string $field, string $type=''): QueryBuilderInterface;
303 260
 
304 261
 	/**
305 262
 	 * Set a limit on the current sql statement
@@ -308,7 +265,7 @@ interface QueryBuilderInterface {
308 265
 	 * @param int|bool $offset
309 266
 	 * @return QueryBuilderInterface
310 267
 	 */
311
-	public function limit($limit, $offset=FALSE): QueryBuilderInterface;
268
+	public function limit(int $limit, $offset=FALSE): QueryBuilderInterface;
312 269
 
313 270
 	// --------------------------------------------------------------------------
314 271
 	// ! Query Grouping Methods
@@ -321,8 +278,6 @@ interface QueryBuilderInterface {
321 278
 	 */
322 279
 	public function groupStart(): QueryBuilderInterface;
323 280
 
324
-	// --------------------------------------------------------------------------
325
-
326 281
 	/**
327 282
 	 * Adds a paren to the current query for query grouping,
328 283
 	 * prefixed with 'NOT'
@@ -331,8 +286,6 @@ interface QueryBuilderInterface {
331 286
 	 */
332 287
 	public function notGroupStart(): QueryBuilderInterface;
333 288
 
334
-	// --------------------------------------------------------------------------
335
-
336 289
 	/**
337 290
 	 * Adds a paren to the current query for query grouping,
338 291
 	 * prefixed with 'OR'
@@ -341,8 +294,6 @@ interface QueryBuilderInterface {
341 294
 	 */
342 295
 	public function orGroupStart(): QueryBuilderInterface;
343 296
 
344
-	// --------------------------------------------------------------------------
345
-
346 297
 	/**
347 298
 	 * Adds a paren to the current query for query grouping,
348 299
 	 * prefixed with 'OR NOT'
@@ -351,8 +302,6 @@ interface QueryBuilderInterface {
351 302
 	 */
352 303
 	public function orNotGroupStart(): QueryBuilderInterface;
353 304
 
354
-	// --------------------------------------------------------------------------
355
-
356 305
 	/**
357 306
 	 * Ends a query group
358 307
 	 *
@@ -373,9 +322,7 @@ interface QueryBuilderInterface {
373 322
 	 * @param int|bool $offset
374 323
 	 * @return PDOStatement
375 324
 	 */
376
-	public function get($table='', $limit=FALSE, $offset=FALSE): PDOStatement;
377
-
378
-	// --------------------------------------------------------------------------
325
+	public function get(string $table='', $limit=FALSE, $offset=FALSE): ?PDOStatement;
379 326
 
380 327
 	/**
381 328
 	 * Convenience method for get() with a where clause
@@ -386,9 +333,7 @@ interface QueryBuilderInterface {
386 333
 	 * @param int|bool $offset
387 334
 	 * @return PDOStatement
388 335
 	 */
389
-	public function getWhere($table, $where=[], $limit=FALSE, $offset=FALSE): PDOStatement;
390
-
391
-	// --------------------------------------------------------------------------
336
+	public function getWhere(string $table, $where=[], $limit=FALSE, $offset=FALSE): ?PDOStatement;
392 337
 
393 338
 	/**
394 339
 	 * Retrieve the number of rows in the selected table
@@ -396,9 +341,7 @@ interface QueryBuilderInterface {
396 341
 	 * @param string $table
397 342
 	 * @return int
398 343
 	 */
399
-	public function countAll($table): int;
400
-
401
-	// --------------------------------------------------------------------------
344
+	public function countAll(string $table): int;
402 345
 
403 346
 	/**
404 347
 	 * Retrieve the number of results for the generated query - used
@@ -410,8 +353,6 @@ interface QueryBuilderInterface {
410 353
 	 */
411 354
 	public function countAllResults(string $table='', bool $reset=TRUE): int;
412 355
 
413
-	// --------------------------------------------------------------------------
414
-
415 356
 	/**
416 357
 	 * Creates an insert clause, and executes it
417 358
 	 *
@@ -419,31 +360,25 @@ interface QueryBuilderInterface {
419 360
 	 * @param mixed $data
420 361
 	 * @return PDOStatement
421 362
 	 */
422
-	public function insert($table, $data=[]): PDOStatement;
423
-
424
-	// --------------------------------------------------------------------------
363
+	public function insert(string $table, $data=[]): ?PDOStatement;
425 364
 
426 365
 	/**
427 366
 	 * Creates and executes a batch insertion query
428 367
 	 *
429 368
 	 * @param string $table
430 369
 	 * @param array $data
431
-	 * @return \PDOStatement|null
370
+	 * @return PDOStatement
432 371
 	 */
433
-	public function insertBatch($table, $data=[]);
434
-
435
-	// --------------------------------------------------------------------------
372
+	public function insertBatch(string $table, $data=[]): ?PDOStatement;
436 373
 
437 374
 	/**
438 375
 	 * Insertion with automatic overwrite, rather than attempted duplication
439 376
 	 *
440 377
 	 * @param string $table
441 378
 	 * @param array $data
442
-	 * @return \PDOStatement|null
379
+	 * @return PDOStatement
443 380
 	 */
444
-	public function replace($table, $data=[]);
445
-
446
-	// --------------------------------------------------------------------------
381
+	public function replace(string $table, $data=[]): ?PDOStatement;
447 382
 
448 383
 	/**
449 384
 	 * Creates an update clause, and executes it
@@ -452,9 +387,7 @@ interface QueryBuilderInterface {
452 387
 	 * @param mixed $data
453 388
 	 * @return PDOStatement
454 389
 	 */
455
-	public function update($table, $data=[]): PDOStatement;
456
-
457
-	// --------------------------------------------------------------------------
390
+	public function update(string $table, $data=[]): ?PDOStatement;
458 391
 
459 392
 	/**
460 393
 	 * Creates a batch update, and executes it.
@@ -463,11 +396,9 @@ interface QueryBuilderInterface {
463 396
 	 * @param string $table
464 397
 	 * @param array|object $data
465 398
 	 * @param string $where
466
-	 * @return int|null
399
+	 * @return PDOStatement
467 400
 	 */
468
-	public function updateBatch($table, $data, $where);
469
-
470
-	// --------------------------------------------------------------------------
401
+	public function updateBatch(string $table, $data, $where): ?PDOStatement;
471 402
 
472 403
 	/**
473 404
 	 * Deletes data from a table
@@ -476,7 +407,7 @@ interface QueryBuilderInterface {
476 407
 	 * @param mixed $where
477 408
 	 * @return PDOStatement
478 409
 	 */
479
-	public function delete($table, $where=''): PDOStatement;
410
+	public function delete(string $table, $where=''): ?PDOStatement;
480 411
 
481 412
 	// --------------------------------------------------------------------------
482 413
 	// ! SQL Returning Methods

+ 16
- 17
src/State.php View File

@@ -6,12 +6,13 @@
6 6
  *
7 7
  * PHP version 7.1
8 8
  *
9
- * @package     Query
10
- * @author      Timothy J. Warren <tim@timshomepage.net>
9
+ * @package	 Query
10
+ * @author	  Timothy J. Warren <tim@timshomepage.net>
11 11
  * @copyright   2012 - 2018 Timothy J. Warren
12
- * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13
- * @link        https://git.timshomepage.net/aviat4ion/Query
12
+ * @license	 http://www.opensource.org/licenses/mit-license.html  MIT License
13
+ * @link		https://git.timshomepage.net/aviat4ion/Query
14 14
  */
15
+
15 16
 namespace Query;
16 17
 
17 18
 /**
@@ -92,7 +93,7 @@ class State {
92 93
 
93 94
 	/**
94 95
 	 * Value for limit string
95
-	 * @var int
96
+	 * @var integer
96 97
 	 */
97 98
 	protected $limit;
98 99
 
@@ -123,22 +124,20 @@ class State {
123 124
 	 */
124 125
 	protected $havingMap = [];
125 126
 
126
-	// --------------------------------------------------------------------------
127
-
128
-    /**
129
-     * @param string $str
130
-     * @return State
131
-     */
127
+	/**
128
+	 * @param string $str
129
+	 * @return State
130
+	 */
132 131
 	public function setSelectString(string $str): self
133
-    {
134
-        $this->selectString = $str;
135
-        return $this;
136
-    }
132
+	{
133
+		$this->selectString = $str;
134
+		return $this;
135
+	}
137 136
 
138 137
 	/**
139 138
 	 * @return string
140 139
 	 */
141
-    public function getSelectString(): string
140
+	public function getSelectString(): string
142 141
 	{
143 142
 		return $this->selectString;
144 143
 	}
@@ -147,7 +146,7 @@ class State {
147 146
 	 * @param string $str
148 147
 	 * @return State
149 148
 	 */
150
-    public function appendSelectString(string $str): self
149
+	public function appendSelectString(string $str): self
151 150
 	{
152 151
 		$this->selectString .= $str;
153 152
 		return $this;

+ 0
- 11
src/common.php View File

@@ -13,14 +13,11 @@
13 13
  * @link        https://git.timshomepage.net/aviat4ion/Query
14 14
  */
15 15
 
16
-
17 16
 use Query\{
18 17
     ConnectionManager,
19 18
     QueryBuilderInterface
20 19
 };
21 20
 
22
-// --------------------------------------------------------------------------
23
-
24 21
 /**
25 22
  * Global functions that don't really fit anywhere else
26 23
  */
@@ -36,8 +33,6 @@ function mb_trim(string $string): string
36 33
 	return preg_replace('/(^\s+)|(\s+$)/u', '', $string);
37 34
 }
38 35
 
39
-// --------------------------------------------------------------------------
40
-
41 36
 /**
42 37
  * Filter out db rows into one array
43 38
  *
@@ -57,8 +52,6 @@ function dbFilter(array $array, $index): array
57 52
 	return $newArray;
58 53
 }
59 54
 
60
-// --------------------------------------------------------------------------
61
-
62 55
 /**
63 56
  * Zip a set of arrays together on common keys
64 57
  *
@@ -87,8 +80,6 @@ function arrayZipper(array $zipperInput): array
87 80
 	return $output;
88 81
 }
89 82
 
90
-// --------------------------------------------------------------------------
91
-
92 83
 /**
93 84
  * Determine whether a value in the passed array matches the pattern
94 85
  * passed
@@ -115,8 +106,6 @@ function regexInArray(array $array, string $pattern): bool
115 106
 	return FALSE;
116 107
 }
117 108
 
118
-// --------------------------------------------------------------------------
119
-
120 109
 /**
121 110
  * Connection function
122 111
  *

+ 1
- 28
tests/BaseDriverTest.php View File

@@ -12,9 +12,8 @@
12 12
  * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13 13
  * @link        https://git.timshomepage.net/aviat4ion/Query
14 14
  */
15
-namespace Query\Tests;
16 15
 
17
-// --------------------------------------------------------------------------
16
+namespace Query\Tests;
18 17
 
19 18
 /**
20 19
  * Parent Database Test Class
@@ -28,15 +27,11 @@ abstract class BaseDriverTest extends TestCase {
28 27
 
29 28
 	abstract public function testConnection();
30 29
 
31
-	// --------------------------------------------------------------------------
32
-
33 30
 	public static function tearDownAfterClass()
34 31
 	{
35 32
 		self::$db = NULL;
36 33
 	}
37 34
 
38
-	// --------------------------------------------------------------------------
39
-
40 35
 	public function testGetTables()
41 36
 	{
42 37
 		$tables = self::$db->getTables();
@@ -44,8 +39,6 @@ abstract class BaseDriverTest extends TestCase {
44 39
 		$this->assertTrue( ! empty($tables));
45 40
 	}
46 41
 
47
-	// --------------------------------------------------------------------------
48
-
49 42
 	public function testGetSystemTables()
50 43
 	{
51 44
 		$tables = self::$db->getSystemTables();
@@ -53,16 +46,12 @@ abstract class BaseDriverTest extends TestCase {
53 46
 		$this->assertTrue( ! empty($tables));
54 47
 	}
55 48
 
56
-	// --------------------------------------------------------------------------
57
-
58 49
 	public function testBackupData()
59 50
 	{
60 51
 		$this->assertTrue(is_string(self::$db->getUtil()->backupData(array('create_delete', FALSE))));
61 52
 		$this->assertTrue(is_string(self::$db->getUtil()->backupData(array('create_delete', TRUE))));
62 53
 	}
63 54
 
64
-	// --------------------------------------------------------------------------
65
-
66 55
 	public function testGetColumns()
67 56
 	{
68 57
 		$cols = self::$db->getColumns('test');
@@ -70,8 +59,6 @@ abstract class BaseDriverTest extends TestCase {
70 59
 		$this->assertTrue( ! empty($cols));
71 60
 	}
72 61
 
73
-	// --------------------------------------------------------------------------
74
-
75 62
 	public function testGetTypes()
76 63
 	{
77 64
 		$types = self::$db->getTypes();
@@ -79,8 +66,6 @@ abstract class BaseDriverTest extends TestCase {
79 66
 		$this->assertTrue( ! empty($types));
80 67
 	}
81 68
 
82
-	// --------------------------------------------------------------------------
83
-
84 69
 	public function testGetFKs()
85 70
 	{
86 71
 		$expected = array(array(
@@ -95,16 +80,12 @@ abstract class BaseDriverTest extends TestCase {
95 80
 		$this->assertEqual($expected, $keys);
96 81
 	}
97 82
 
98
-	// --------------------------------------------------------------------------
99
-
100 83
 	public function testGetIndexes()
101 84
 	{
102 85
 		$keys = self::$db->getIndexes('test');
103 86
 		$this->assertTrue(is_array($keys));
104 87
 	}
105 88
 
106
-	// --------------------------------------------------------------------------
107
-
108 89
 	public function testGetViews()
109 90
 	{
110 91
 		$views = self::$db->getViews();
@@ -113,8 +94,6 @@ abstract class BaseDriverTest extends TestCase {
113 94
 		$this->assertTrue(is_array($views));
114 95
 	}
115 96
 
116
-	// --------------------------------------------------------------------------
117
-
118 97
 	public function testGetTriggers()
119 98
 	{
120 99
 		// @TODO standardize trigger output for different databases
@@ -123,8 +102,6 @@ abstract class BaseDriverTest extends TestCase {
123 102
 		$this->assertTrue(is_array($triggers));
124 103
 	}
125 104
 
126
-	// --------------------------------------------------------------------------
127
-
128 105
 	public function testGetSequences()
129 106
 	{
130 107
 		$seqs = self::$db->getSequences();
@@ -138,16 +115,12 @@ abstract class BaseDriverTest extends TestCase {
138 115
 		$this->assertEqual($expected, $seqs);
139 116
 	}
140 117
 
141
-	// --------------------------------------------------------------------------
142
-
143 118
 	public function testGetProcedures()
144 119
 	{
145 120
 		$procedures = self::$db->getProcedures();
146 121
 		$this->assertTrue(is_array($procedures));
147 122
 	}
148 123
 
149
-	// --------------------------------------------------------------------------
150
-
151 124
 	public function testGetFunctions()
152 125
 	{
153 126
 		$funcs = self::$db->getFunctions();

+ 0
- 12
tests/ConnectionManagerTest.php View File

@@ -26,8 +26,6 @@ class ConnectionManagerTest extends TestCase {
26 26
 		self::$instance = ConnectionManager::getInstance();
27 27
 	}
28 28
 
29
-	// --------------------------------------------------------------------------
30
-
31 29
 	public function testNoClone()
32 30
 	{
33 31
 		$this->expectException('DomainException');
@@ -36,8 +34,6 @@ class ConnectionManagerTest extends TestCase {
36 34
 		$this->assertNull($clone);
37 35
 	}
38 36
 
39
-	// --------------------------------------------------------------------------
40
-
41 37
 	public function testNoSerialize()
42 38
 	{
43 39
 		$this->expectException(DomainException::class);
@@ -49,8 +45,6 @@ class ConnectionManagerTest extends TestCase {
49 45
 		self::$instance->__sleep();
50 46
 	}
51 47
 
52
-	// --------------------------------------------------------------------------
53
-
54 48
 	public function testNoUnserialize()
55 49
 	{
56 50
 		$this->expectException(DomainException::class);
@@ -58,8 +52,6 @@ class ConnectionManagerTest extends TestCase {
58 52
 		self::$instance->__wakeup();
59 53
 	}
60 54
 
61
-	// --------------------------------------------------------------------------
62
-
63 55
 	public function testParseParams()
64 56
 	{
65 57
 		$params = (object) array(
@@ -80,8 +72,6 @@ class ConnectionManagerTest extends TestCase {
80 72
 		$this->assertEqual($expected, self::$instance->parseParams($params));
81 73
 	}
82 74
 
83
-	// --------------------------------------------------------------------------
84
-
85 75
 	public function testConnect()
86 76
 	{
87 77
 		$params = (object) array(
@@ -101,8 +91,6 @@ class ConnectionManagerTest extends TestCase {
101 91
 		$this->assertEqual($conn, self::$instance->getConnection());
102 92
 	}
103 93
 
104
-	// --------------------------------------------------------------------------
105
-
106 94
 	public function testGetConnection()
107 95
 	{
108 96
 		$params = (object) array(

+ 0
- 5
tests/CoreTest.php View File

@@ -14,9 +14,6 @@
14 14
  */
15 15
 namespace Query\Tests;
16 16
 
17
-
18
-// --------------------------------------------------------------------------
19
-
20 17
 /**
21 18
  * CoreTest class - Compatibility and core functionality tests
22 19
  *
@@ -36,8 +33,6 @@ class CoreTest extends TestCase {
36 33
 		$this->assertTrue(PHP_VERSION_ID >= 70000);
37 34
 	}
38 35
 
39
-	// --------------------------------------------------------------------------
40
-
41 36
 	/**
42 37
 	 * TestHasPDO function.
43 38
 	 *

+ 0
- 27
tests/Drivers/MySQL/MySQLDriverTest.php View File

@@ -22,7 +22,6 @@ use TypeError;
22 22
 /**
23 23
  * MySQLTest class.
24 24
  *
25
- * @extends DBTest
26 25
  * @requires extension pdo_mysql
27 26
  */
28 27
 class MySQLDriverTest extends BaseDriverTest {
@@ -47,22 +46,16 @@ class MySQLDriverTest extends BaseDriverTest {
47 46
 		self::$db->setTablePrefix('create_');
48 47
 	}
49 48
 
50
-	// --------------------------------------------------------------------------
51
-
52 49
 	public function testExists()
53 50
 	{
54 51
 		$this->assertTrue(\in_array('mysql', PDO::getAvailableDrivers(), TRUE));
55 52
 	}
56 53
 
57
-	// --------------------------------------------------------------------------
58
-
59 54
 	public function testConnection()
60 55
 	{
61 56
 		$this->assertIsA(self::$db, Driver::class);
62 57
 	}
63 58
 
64
-	// --------------------------------------------------------------------------
65
-
66 59
 	public function testCreateTable()
67 60
 	{
68 61
 		self::$db->exec(file_get_contents(QTEST_DIR.'/db_files/mysql.sql'));
@@ -101,8 +94,6 @@ class MySQLDriverTest extends BaseDriverTest {
101 94
 
102 95
 	}
103 96
 
104
-	// --------------------------------------------------------------------------
105
-
106 97
 	public function testTruncate()
107 98
 	{
108 99
 		self::$db->truncate('test');
@@ -112,8 +103,6 @@ class MySQLDriverTest extends BaseDriverTest {
112 103
 		$this->assertEquals(0, self::$db->countAll('join'));
113 104
 	}
114 105
 
115
-	// --------------------------------------------------------------------------
116
-
117 106
 	public function testPreparedStatements()
118 107
 	{
119 108
 		$sql = <<<SQL
@@ -128,8 +117,6 @@ SQL;
128 117
 
129 118
 	}
130 119
 
131
-	// --------------------------------------------------------------------------
132
-
133 120
 	public function testBadPreparedStatement()
134 121
 	{
135 122
 		$this->expectException(TypeError::class);
@@ -143,8 +130,6 @@ SQL;
143 130
 
144 131
 	}
145 132
 
146
-	// --------------------------------------------------------------------------
147
-
148 133
 	public function testPrepareExecute()
149 134
 	{
150 135
 		$sql = <<<SQL
@@ -159,8 +144,6 @@ SQL;
159 144
 
160 145
 	}
161 146
 
162
-	// --------------------------------------------------------------------------
163
-
164 147
 	public function testCommitTransaction()
165 148
 	{
166 149
 		$res = self::$db->beginTransaction();
@@ -172,8 +155,6 @@ SQL;
172 155
 		$this->assertTrue($res);
173 156
 	}
174 157
 
175
-	// --------------------------------------------------------------------------
176
-
177 158
 	public function testRollbackTransaction()
178 159
 	{
179 160
 		$res = self::$db->beginTransaction();
@@ -185,26 +166,18 @@ SQL;
185 166
 		$this->assertTrue($res);
186 167
 	}
187 168
 
188
-	// --------------------------------------------------------------------------
189
-
190 169
 	public function testGetSchemas()
191 170
 	{
192 171
 		$this->assertNull(self::$db->getSchemas());
193 172
 	}
194 173
 
195
-	// --------------------------------------------------------------------------
196
-
197 174
 	public function testGetSequences()
198 175
 	{
199 176
 		$this->assertNull(self::$db->getSequences());
200 177
 	}
201 178
 
202
-	// --------------------------------------------------------------------------
203
-
204 179
 	public function testBackup()
205 180
 	{
206 181
 		$this->assertTrue(is_string(self::$db->getUtil()->backupStructure()));
207 182
 	}
208
-
209
-
210 183
 }

+ 0
- 6
tests/Drivers/MySQL/MySQLQueryBuilderTest.php View File

@@ -17,8 +17,6 @@ namespace Query\Tests\Drivers\MySQL;
17 17
 use PDO;
18 18
 use Query\Tests\BaseQueryBuilderTest;
19 19
 
20
-// --------------------------------------------------------------------------
21
-
22 20
 /**
23 21
  * @requires extension pdo_mysql
24 22
  */
@@ -51,15 +49,11 @@ class MySQLQueryBuilderTest extends BaseQueryBuilderTest {
51 49
 		self::$db = Query($params);
52 50
 	}
53 51
 
54
-	// --------------------------------------------------------------------------
55
-
56 52
 	public function testExists()
57 53
 	{
58 54
 		$this->assertTrue(\in_array('mysql', PDO::getAvailableDrivers(), TRUE));
59 55
 	}
60 56
 
61
-	// --------------------------------------------------------------------------
62
-
63 57
 	public function testQueryExplain()
64 58
 	{
65 59
 		$query = self::$db->select('id, key as k, val')

+ 1
- 27
tests/Drivers/PgSQL/PgSQLDriverTest.php View File

@@ -12,11 +12,9 @@
12 12
  * @license     http://www.opensource.org/licenses/mit-license.html  MIT License
13 13
  * @link        https://git.timshomepage.net/aviat4ion/Query
14 14
  */
15
-namespace Query\Tests\Drivers\PgSQL;
16 15
 
17
-// --------------------------------------------------------------------------
16
+namespace Query\Tests\Drivers\PgSQL;
18 17
 
19
-use InvalidArgumentException;
20 18
 use PDO;
21 19
 use Query\Drivers\Pgsql\Driver;
22 20
 use Query\Tests\BaseDriverTest;
@@ -57,16 +55,12 @@ class PgSQLDriverTest extends BaseDriverTest {
57 55
 		self::$db->setTablePrefix('create_');
58 56
 	}
59 57
 
60
-	// --------------------------------------------------------------------------
61
-
62 58
 	public function testExists()
63 59
 	{
64 60
 		$drivers = PDO::getAvailableDrivers();
65 61
 		$this->assertTrue(in_array('pgsql', $drivers, TRUE));
66 62
 	}
67 63
 
68
-	// --------------------------------------------------------------------------
69
-
70 64
 	public function testConnection()
71 65
 	{
72 66
 		if (empty(self::$db))  return;
@@ -74,8 +68,6 @@ class PgSQLDriverTest extends BaseDriverTest {
74 68
 		$this->assertIsA(self::$db, Driver::class);
75 69
 	}
76 70
 
77
-	// --------------------------------------------------------------------------
78
-
79 71
 	public function testCreateTable()
80 72
 	{
81 73
 		self::$db->exec(file_get_contents(QTEST_DIR.'/db_files/pgsql.sql'));
@@ -126,8 +118,6 @@ class PgSQLDriverTest extends BaseDriverTest {
126 118
 
127 119
 	}
128 120
 
129
-	// --------------------------------------------------------------------------
130
-
131 121
 	public function testTruncate()
132 122
 	{
133 123
 		self::$db->truncate('test');
@@ -137,8 +127,6 @@ class PgSQLDriverTest extends BaseDriverTest {
137 127
 		$this->assertEquals(0, self::$db->countAll('join'));
138 128
 	}
139 129
 
140
-	// --------------------------------------------------------------------------
141
-
142 130
 	public function testPreparedStatements()
143 131
 	{
144 132
 		$sql = <<<SQL
@@ -159,8 +147,6 @@ SQL;
159 147
 		], $res);
160 148
 	}
161 149
 
162
-	// --------------------------------------------------------------------------
163
-
164 150
 	public function testBadPreparedStatement()
165 151
 	{
166 152
 		$this->expectException(TypeError::class);
@@ -173,8 +159,6 @@ SQL;
173 159
 		self::$db->prepareQuery($sql, 'foo');
174 160
 	}
175 161
 
176
-	// --------------------------------------------------------------------------
177
-
178 162
 	public function testPrepareExecute()
179 163
 	{
180 164
 		if (empty(self::$db))  return;
@@ -197,8 +181,6 @@ SQL;
197 181
 		], $res);
198 182
 	}
199 183
 
200
-	// --------------------------------------------------------------------------
201
-
202 184
 	public function testCommitTransaction()
203 185
 	{
204 186
 		if (empty(self::$db))  return;
@@ -212,8 +194,6 @@ SQL;
212 194
 		$this->assertTrue($res);
213 195
 	}
214 196
 
215
-	// --------------------------------------------------------------------------
216
-
217 197
 	public function testRollbackTransaction()
218 198
 	{
219 199
 		if (empty(self::$db))  return;
@@ -227,22 +207,16 @@ SQL;
227 207
 		$this->assertTrue($res);
228 208
 	}
229 209
 
230
-	// --------------------------------------------------------------------------
231
-
232 210
 	public function testGetSchemas()
233 211
 	{
234 212
 		$this->assertTrue(is_array(self::$db->getSchemas()));
235 213
 	}
236 214
 
237
-	// --------------------------------------------------------------------------
238
-
239 215
 	public function testGetDBs()
240 216
 	{
241 217
 		$this->assertTrue(is_array(self::$db->getDbs()));
242 218
 	}
243 219
 
244
-	// --------------------------------------------------------------------------
245
-
246 220
 	public function testGetFunctions()
247 221
 	{
248 222
 		$this->assertNull(self::$db->getFunctions());

+ 1
- 7
tests/Drivers/PgSQL/PgSQLQueryBuilderTest.php View File

@@ -17,8 +17,6 @@ namespace Query\Tests\Drivers\PgSQL;
17 17
 use PDO;
18 18
 use Query\Tests\BaseQueryBuilderTest;
19 19
 
20
-// --------------------------------------------------------------------------
21
-
22 20
 /**
23 21
  * @requires extension pdo_pgsql
24 22
  */
@@ -58,19 +56,15 @@ class PgSQLQueryBuilderTest extends BaseQueryBuilderTest {
58 56
  		// If the database isn't installed, skip the tests
59 57
 		if ( ! \in_array('pgsql', PDO::getAvailableDrivers(), TRUE))
60 58
 		{
61
-			$this->markTestSkipped("Postgres extension for PDO not loaded");
59
+			$this->markTestSkipped('Postgres extension for PDO not loaded');
62 60
 		}
63 61
  	}
64 62
 
65
- 	// --------------------------------------------------------------------------
66
-
67 63
 	public function testExists()
68 64
 	{
69 65
 		$this->assertTrue(\in_array('pgsql', PDO::getAvailableDrivers(), TRUE));
70 66
 	}
71 67
 
72
-	// --------------------------------------------------------------------------
73
-
74 68
 	public function testQueryExplain()
75 69
 	{
76 70
 		$query = self::$db->select('id, key as k, val')

+ 0
- 30
tests/Drivers/SQLite/SQLiteDriverTest.php View File

@@ -18,8 +18,6 @@ use PDO;
18 18
 use Query\Drivers\Sqlite\Driver;
19 19
 use Query\Tests\BaseDriverTest;
20 20
 
21
-// --------------------------------------------------------------------------
22
-
23 21
 /**
24 22
  * SQLiteTest class.
25 23
  *
@@ -64,8 +62,6 @@ class SQLiteDriverTest extends BaseDriverTest {
64 62
 		$this->assertTrue(\in_array('create_delete', $dbs, TRUE));
65 63
 	}
66 64
 
67
-	// --------------------------------------------------------------------------
68
-
69 65
 	/*public function testBackupData()
70 66
 	{
71 67
 		$sql = mb_trim(self::$db->getUtil()->backupData(array('create_join', 'create_test')));
@@ -83,8 +79,6 @@ SQL;
83 79
 		$this->assertEqual($expectedArray, $sqlArray);
84 80
 	}*/
85 81
 
86
-	// --------------------------------------------------------------------------
87
-
88 82
 	public function testBackupStructure()
89 83
 	{
90 84
 		$sql = mb_trim(self::$db->getUtil()->backupStructure());
@@ -159,8 +153,6 @@ SQL;
159 153
 		$this->assertEqual($expectedArray, $resultArray);
160 154
 	}
161 155
 
162
-	// --------------------------------------------------------------------------
163
-
164 156
 	public function testDeleteTable()
165 157
 	{
166 158
 		$sql = self::$db->getUtil()->deleteTable('create_delete');
@@ -188,16 +180,12 @@ SQL;
188 180
 		unset($db);
189 181
 	}
190 182
 
191
-	// --------------------------------------------------------------------------
192
-
193 183
 	public function testTruncate()
194 184
 	{
195 185
 		self::$db->truncate('create_test');
196 186
 		$this->assertEquals(0, self::$db->countAll('create_test'));
197 187
 	}
198 188
 
199
-	// --------------------------------------------------------------------------
200
-
201 189
 	public function testPreparedStatements()
202 190
 	{
203 191
 		$sql = <<<SQL
@@ -218,8 +206,6 @@ SQL;
218 206
 		], $res);
219 207
 	}
220 208
 
221
-	// --------------------------------------------------------------------------
222
-
223 209
 	public function testPrepareExecute()
224 210
 	{
225 211
 		$sql = <<<SQL
@@ -240,8 +226,6 @@ SQL;
240 226
 		], $res);
241 227
 	}
242 228
 
243
-	// --------------------------------------------------------------------------
244
-
245 229
 	public function testCommitTransaction()
246 230
 	{
247 231
 		$res = self::$db->beginTransaction();
@@ -253,8 +237,6 @@ SQL;
253 237
 		$this->assertTrue($res);
254 238
 	}
255 239
 
256
-	// --------------------------------------------------------------------------
257
-
258 240
 	public function testRollbackTransaction()
259 241
 	{
260 242
 		$res = self::$db->beginTransaction();
@@ -266,15 +248,11 @@ SQL;
266 248
 		$this->assertTrue($res);
267 249
 	}
268 250
 
269
-	// --------------------------------------------------------------------------
270
-
271 251
 	public function testGetDBs()
272 252
 	{
273 253
 		$this->assertTrue(is_array(self::$db->getDbs()));
274 254
 	}
275 255
 
276
-	// --------------------------------------------------------------------------
277
-
278 256
 	public function testGetSchemas()
279 257
 	{
280 258
 		$this->assertNull(self::$db->getSchemas());
@@ -296,30 +274,22 @@ SQL;
296 274
 		$this->assertEqual(NULL, $sql);
297 275
 	}
298 276
 
299
-	// --------------------------------------------------------------------------
300
-
301 277
 	public function testGetSystemTables()
302 278
 	{
303 279
 		$sql = self::$db->getSystemTables();
304 280
 		$this->assertTrue(\is_array($sql));
305 281
 	}
306 282
 
307
-	// --------------------------------------------------------------------------
308
-
309 283
 	public function testGetSequences()
310 284
 	{
311 285
 		$this->assertNull(self::$db->getSequences());
312 286
 	}
313 287
 
314
-	// --------------------------------------------------------------------------
315
-
316 288
 	public function testGetFunctions()
317 289
 	{
318 290
 		$this->assertNull(self::$db->getFunctions());
319 291
 	}
320 292
 
321
-	// --------------------------------------------------------------------------
322
-
323 293
 	public function testGetProcedures()
324 294
 	{
325 295
 		$this->assertNull(self::$db->getProcedures());

+ 0
- 6
tests/Drivers/SQLite/SQLiteQueryBuilderTest.php View File

@@ -17,8 +17,6 @@ namespace Query\Tests\Drivers\SQLite;
17 17
 use PDO;
18 18
 use Query\Tests\BaseQueryBuilderTest;
19 19
 
20
-// --------------------------------------------------------------------------
21
-
22 20
 /**
23 21
  * Class for testing Query Builder with SQLite
24 22
  *
@@ -32,8 +30,6 @@ use Query\Tests\BaseQueryBuilderTest;
32 30
 		self::$db = Query('test_sqlite');
33 31
 	}
34 32
 
35
- 	// --------------------------------------------------------------------------
36
-
37 33
 	public function testQueryFunctionAlias()
38 34
 	{
39 35
 		$db = Query('test_sqlite');
@@ -41,8 +37,6 @@ use Query\Tests\BaseQueryBuilderTest;
41 37
 		$this->assertTrue(self::$db === $db, "Alias passed into query function gives the original object back");
42 38
 	}
43 39
 
44
-	// --------------------------------------------------------------------------
45
-
46 40
 	public function testQueryExplain()
47 41
 	{
48 42
 		$query = self::$db->select('id, key as k, val')

+ 0
- 3
tests/bootstrap.php View File

@@ -18,8 +18,6 @@ define('QTEST_DIR', realpath(__DIR__));
18 18
 define('QBASE_DIR', realpath(QTEST_DIR.'/../') . '/');
19 19
 define('QDS', DIRECTORY_SEPARATOR);
20 20
 
21
-// --------------------------------------------------------------------------
22
-
23 21
 function get_json_config()
24 22
 {
25 23
 	$files = array(
@@ -38,7 +36,6 @@ function get_json_config()
38 36
 	return FALSE;
39 37
 }
40 38
 
41
-// --------------------------------------------------------------------------
42 39
 $path = QTEST_DIR.QDS.'db_files'.QDS.'test_sqlite.db';
43 40
 @unlink($path);
44 41