Completed
Push — master ( f08c1d...ffbb02 )
by smiley
02:22
created
src/Query/CreateAbstract.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@
 block discarded – undo
28 28
 		return (new class($this->DBDriver, $this->dialect) extends StatementAbstract implements CreateDatabaseInterface{
29 29
 			use CharsetTrait, IfNotExistsTrait, NameTrait;
30 30
 
31
-			public function ifNotExists():CreateDatabaseInterface{return $this->_ifNotExists();}
32
-			public function name(string $dbname = null):CreateDatabaseInterface{return $this->_name($dbname);}
33
-			public function collate(string $collation):CreateDatabaseInterface{return $this->_collate($collation);}
31
+			public function ifNotExists():CreateDatabaseInterface{return $this->_ifNotExists(); }
32
+			public function name(string $dbname = null):CreateDatabaseInterface{return $this->_name($dbname); }
33
+			public function collate(string $collation):CreateDatabaseInterface{return $this->_collate($collation); }
34 34
 
35 35
 			public function sql():string{
36 36
 
Please login to merge, or discard this patch.
src/Query/Dialects/MySQL/CreateTable.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 
54 54
 		$type = strtoupper(trim($type));
55 55
 		$nolengthtypes = ['DATE', 'TINYBLOB', 'TINYTEXT', 'BLOB', 'TEXT', 'MEDIUMBLOB',
56
-		                  'MEDIUMTEXT', 'LONGBLOB', 'LONGTEXT', 'SERIAL', 'BOOLEAN', 'UUID'];
56
+						  'MEDIUMTEXT', 'LONGBLOB', 'LONGTEXT', 'SERIAL', 'BOOLEAN', 'UUID'];
57 57
 
58 58
 		$field[] = (is_int($length) || is_string($length) && count(explode(',', $length)) === 2) && !in_array($type, $nolengthtypes)
59 59
 			? $type.'('. $length . ')'
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 class CreateTable extends CreateTableAbstract{
20 20
 	use CharsetTrait;
21 21
 
22
-	public function collate(string $collation):CreateTableInterface{return $this->_collate($collation);}
22
+	public function collate(string $collation):CreateTableInterface{return $this->_collate($collation); }
23 23
 
24 24
 	public function sql():string{
25 25
 #		var_dump($this->cols);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		                  'MEDIUMTEXT', 'LONGBLOB', 'LONGTEXT', 'SERIAL', 'BOOLEAN', 'UUID'];
57 57
 
58 58
 		$field[] = (is_int($length) || is_string($length) && count(explode(',', $length)) === 2) && !in_array($type, $nolengthtypes)
59
-			? $type.'('. $length . ')'
59
+			? $type.'('.$length.')'
60 60
 			: $type;
61 61
 
62 62
 		if($attribute){
Please login to merge, or discard this patch.
src/Query/CreateTableInterface.php 1 patch
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -20,6 +20,10 @@  discard block
 block discarded – undo
20 20
 	public function ifNotExists():CreateTableInterface;
21 21
 	public function name(string $tablename = null):CreateTableInterface;
22 22
 	public function primaryKey(string $field):CreateTableInterface;
23
+
24
+	/**
25
+	 * @param string $defaultValue
26
+	 */
23 27
 	public function field(
24 28
 		string $name,
25 29
 		string $type,
@@ -31,5 +35,9 @@  discard block
 block discarded – undo
31 35
 		$defaultValue = null,
32 36
 		string $extra = null
33 37
 	):CreateTableInterface;
38
+
39
+	/**
40
+	 * @return void
41
+	 */
34 42
 	public function index($name);
35 43
 }
Please login to merge, or discard this patch.
src/Query/DeleteInterface.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -16,6 +16,9 @@
 block discarded – undo
16 16
  */
17 17
 interface DeleteInterface extends StatementInterface{
18 18
 
19
+	/**
20
+	 * @return void
21
+	 */
19 22
 	public function from();
20 23
 	public function where($val1, $val2, $operator = '=', $bind = true, $join = 'AND'):DeleteInterface;
21 24
 
Please login to merge, or discard this patch.
src/Query/StatementInterface.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -18,6 +18,10 @@
 block discarded – undo
18 18
 
19 19
 	public function sql():string;
20 20
 	public function bindValues():array;
21
+
22
+	/**
23
+	 * @return void
24
+	 */
21 25
 	public function execute();
22 26
 	public function quote(string $str):string;
23 27
 
Please login to merge, or discard this patch.
src/Query/Traits/WhereTrait.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 	/**
54 54
 	 * @param        $val1
55 55
 	 * @param null   $val2
56
-	 * @param null   $operator
56
+	 * @param string   $operator
57 57
 	 * @param bool   $bind
58 58
 	 * @param string $join
59 59
 	 *
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
 		$where = [];
142 142
 
143 143
 		foreach($this->where as $k => $v){
144
-			$last = $this->where[$k-1] ?? false;
144
+			$last = $this->where[$k - 1] ?? false;
145 145
 #			print_r([$last, $v]);
146 146
 
147 147
 			if(in_array($v, ['AND', 'OR', 'XOR', '(', ')'], true)){
Please login to merge, or discard this patch.
src/Query/UpdateInterface.php 1 patch
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -16,8 +16,19 @@
 block discarded – undo
16 16
  */
17 17
 interface UpdateInterface extends StatementInterface{
18 18
 
19
+	/**
20
+	 * @return void
21
+	 */
19 22
 	public function table();
23
+
24
+	/**
25
+	 * @return void
26
+	 */
20 27
 	public function set();
28
+
29
+	/**
30
+	 * @return UpdateAbstract
31
+	 */
21 32
 	public function where($val1, $val2, $operator = '=', $bind = true, $join = 'AND');
22 33
 
23 34
 }
Please login to merge, or discard this patch.
tests/Query/QueryTest.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@
 block discarded – undo
11 11
 
12 12
 namespace chillerlan\DatabaseTest\Query;
13 13
 
14
-use chillerlan\Database\Drivers\PDO\PDOMySQLDriver;
14
+use chillerlan\DatabaseTest\TestAbstract;
15 15
 use chillerlan\Database\DBQuery;
16
+use chillerlan\Database\Drivers\PDO\PDOMySQLDriver;
16 17
 use chillerlan\Database\Query\CreateInterface;
17 18
 use chillerlan\Database\Query\CreateTableInterface;
18 19
 use chillerlan\Database\Query\DeleteInterface;
19 20
 use chillerlan\Database\Query\SelectInterface;
20 21
 use chillerlan\Database\Query\StatementInterface;
21 22
 use chillerlan\Database\Query\UpdateInterface;
22
-use chillerlan\DatabaseTest\TestAbstract;
23 23
 
24 24
 /**
25 25
  * Class QueryTest
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 			->where('t2.what', 3)
55 55
 			->openBracket('and')
56 56
 			->where('t1.what', 't2.what', '>', false)
57
-			->where('t2.what', [1,2,3], 'in')
57
+			->where('t2.what', [1, 2, 3], 'in')
58 58
 			->closeBracket()
59 59
 			->where('t3.what', $this->statement->select->cols(['foo'])->from(['nope'])->where('bar', 42), 'in', true, 'or')
60 60
 			->groupby(['foo', 'bar'])
Please login to merge, or discard this patch.
src/Query/SelectAbstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		$from = $table;
91 91
 
92 92
 		if($ref){
93
-			$from = sprintf('%s AS %s', $table, $ref);// @todo: index hint
93
+			$from = sprintf('%s AS %s', $table, $ref); // @todo: index hint
94 94
 		}
95 95
 
96 96
 		$this->from[$ref ?? $table] = $from;
Please login to merge, or discard this patch.