Completed
Push — master ( d508c6...ead087 )
by smiley
02:37
created
src/DBQuery.php 1 patch
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@
 block discarded – undo
14 14
 
15 15
 use chillerlan\Database\Drivers\DBDriverInterface;
16 16
 use chillerlan\Database\Query\AlterInterface;
17
+use chillerlan\Database\Query\CreateDatabaseInterface;
17 18
 use chillerlan\Database\Query\CreateInterface;
19
+use chillerlan\Database\Query\CreateTableInterface;
18 20
 use chillerlan\Database\Query\DropInterface;
19 21
 use chillerlan\Database\Query\StatementAbstract;
20
-use chillerlan\Database\Query\CreateDatabaseInterface;
21
-use chillerlan\Database\Query\CreateTableInterface;
22 22
 /**
23 23
  * @property \chillerlan\Database\Query\SelectInterface $select
24 24
  * @property \chillerlan\Database\Query\InsertInterface $insert
Please login to merge, or discard this patch.
src/Query/Dialects/SQLite/CreateTable.php 3 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 
13 13
 namespace chillerlan\Database\Query\Dialects\SQLite;
14 14
 
15
-use chillerlan\Database\Query\CreateTableInterface;
16 15
 use chillerlan\Database\Query\CreateTableAbstract;
16
+use chillerlan\Database\Query\CreateTableInterface;
17 17
 use chillerlan\Database\Query\QueryException;
18 18
 
19 19
 /**
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 			if($this->primaryKey){
53 53
 				$sql .=','.PHP_EOL."\t".'PRIMARY KEY ('.$this->quote($this->primaryKey)
54
-				       .(in_array($this->dir, ['ASC', 'DESC']) ? $this->dir : '').')';
54
+					   .(in_array($this->dir, ['ASC', 'DESC']) ? $this->dir : '').')';
55 55
 			}
56 56
 
57 57
 			$sql .= PHP_EOL.')';
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 
89 89
 		if(is_int($length)&& in_array($type, ['CHAR', 'NCHAR','VARCHAR', 'NVARCHAR', 'CHARACTER'])
90
-		    || is_string($length) && count(explode(',', $length)) === 2 && $type === 'DECIMAL'){
90
+			|| is_string($length) && count(explode(',', $length)) === 2 && $type === 'DECIMAL'){
91 91
 			$field[] = $type_translation.'('. $length . ')';
92 92
 		}
93 93
 		else{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$n = explode('.', $this->name);
46 46
 
47
-		$sql .= $this->quote($n[count($n)-1]);
47
+		$sql .= $this->quote($n[count($n) - 1]);
48 48
 
49 49
 		if(!empty($this->cols)){
50 50
 			$sql .= ' ('.PHP_EOL."\t".implode(','.PHP_EOL."\t", $this->cols);
51 51
 
52 52
 			if($this->primaryKey){
53
-				$sql .=','.PHP_EOL."\t".'PRIMARY KEY ('.$this->quote($this->primaryKey)
53
+				$sql .= ','.PHP_EOL."\t".'PRIMARY KEY ('.$this->quote($this->primaryKey)
54 54
 				       .(in_array($this->dir, ['ASC', 'DESC']) ? $this->dir : '').')';
55 55
 			}
56 56
 
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 
87 87
 
88 88
 
89
-		if(is_int($length)&& in_array($type, ['CHAR', 'NCHAR','VARCHAR', 'NVARCHAR', 'CHARACTER'])
89
+		if(is_int($length) && in_array($type, ['CHAR', 'NCHAR', 'VARCHAR', 'NVARCHAR', 'CHARACTER'])
90 90
 		    || is_string($length) && count(explode(',', $length)) === 2 && $type === 'DECIMAL'){
91
-			$field[] = $type_translation.'('. $length . ')';
91
+			$field[] = $type_translation.'('.$length.')';
92 92
 		}
93 93
 		else{
94 94
 			$field[] = $type_translation;
Please login to merge, or discard this patch.
src/Query/SelectAbstract.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
 	/**
51 51
 	 * @param      $expr1
52
-	 * @param null $expr2
52
+	 * @param string|null $expr2
53 53
 	 * @param null $func
54 54
 	 *
55 55
 	 * @return void
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			if(is_string($k)){
84 84
 				is_array($ref)
85 85
 					? $this->addColumn($ref[0], $k, $ref[1] ?? null)
86
-					: $this->addColumn($ref ,$k);
86
+					: $this->addColumn($ref, $k);
87 87
 			}
88 88
 			else{
89 89
 				is_array($ref)
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		$from = $this->quote($table);
106 106
 
107 107
 		if($ref){
108
-			$from = sprintf('%s AS %s', $this->quote($ref), $this->quote($table));// @todo: index hint
108
+			$from = sprintf('%s AS %s', $this->quote($ref), $this->quote($table)); // @todo: index hint
109 109
 		}
110 110
 
111 111
 		$this->from[$ref ?? $table] = $from;
Please login to merge, or discard this patch.
src/Query/Traits/WhereTrait.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -21,6 +21,9 @@
 block discarded – undo
21 21
 	 */
22 22
 	protected $where = [];
23 23
 
24
+	/**
25
+	 * @param string $operator
26
+	 */
24 27
 	protected function _addWhere($val1, $val2 = null, $operator = null, $bind = true, $join = 'AND'){
25 28
 		$operator = strtoupper(trim($operator));
26 29
 		$join = strtoupper(trim($join));
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
@@ -14,8 +14,19 @@
 block discarded – undo
14 14
 
15 15
 interface UpdateInterface extends StatementInterface{
16 16
 
17
+	/**
18
+	 * @return void
19
+	 */
17 20
 	public function table();
21
+
22
+	/**
23
+	 * @return void
24
+	 */
18 25
 	public function set();
26
+
27
+	/**
28
+	 * @return UpdateAbstract
29
+	 */
19 30
 	public function where($val1, $val2, $operator = '=', $bind = true, $join = 'AND');
20 31
 
21 32
 }
Please login to merge, or discard this patch.
src/Query/InsertAbstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 
32 32
 		$sql = 'INSERT ';
33 33
 		$sql .= 'INTO '.$this->quote($this->table);
34
-		$sql .=  ' ('.$this->quotes[0].implode($this->quotes[1].', '.$this->quotes[0], $fields).$this->quotes[1].')';
34
+		$sql .= ' ('.$this->quotes[0].implode($this->quotes[1].', '.$this->quotes[0], $fields).$this->quotes[1].')';
35 35
 		$sql .= ' VALUES ('.implode(',', array_fill(0, count($fields), '?')).')';
36 36
 
37 37
 		return $sql;
Please login to merge, or discard this patch.
src/Query/Dialects/MySQL/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
 
37 37
 		$sql  = 'SELECT ';
38 38
 		$sql .= $this->distinct ? 'DISTINCT ' : '';
39
-		$sql .= !empty($this->cols) ? implode($glue , $this->cols).PHP_EOL : '* ';
40
-		$sql .= 'FROM '.implode($glue , $this->from);
39
+		$sql .= !empty($this->cols) ? implode($glue, $this->cols).PHP_EOL : '* ';
40
+		$sql .= 'FROM '.implode($glue, $this->from);
41 41
 		$sql .= $this->_getWhere();
42 42
 		$sql .= !empty($this->groupby) ? PHP_EOL.'GROUP BY '.implode($glue, $this->groupby) : '';
43 43
 		$sql .= !empty($this->orderby) ? PHP_EOL.'ORDER BY '.implode($glue, $this->orderby) : '';
Please login to merge, or discard this patch.
src/Query/Dialects/Postgres/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
 
37 37
 		$sql  = 'SELECT ';
38 38
 		$sql .= $this->distinct ? 'DISTINCT ' : '';
39
-		$sql .= !empty($this->cols) ? implode($glue , $this->cols).PHP_EOL : '* ';
40
-		$sql .= 'FROM '.implode($glue , $this->from);
39
+		$sql .= !empty($this->cols) ? implode($glue, $this->cols).PHP_EOL : '* ';
40
+		$sql .= 'FROM '.implode($glue, $this->from);
41 41
 		$sql .= $this->_getWhere();
42 42
 		$sql .= !empty($this->groupby) ? PHP_EOL.'GROUP BY '.implode($glue, $this->groupby) : '';
43 43
 		$sql .= !empty($this->orderby) ? PHP_EOL.'ORDER BY '.implode($glue, $this->orderby) : '';
Please login to merge, or discard this patch.
src/Query/Dialects/Postgres/CreateTable.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 
34 34
 		$n = explode('.', $this->name);
35 35
 
36
-		$sql .= $this->quote($n[count($n)-1]);
36
+		$sql .= $this->quote($n[count($n) - 1]);
37 37
 
38 38
 		if(!empty($this->cols)){
39 39
 			$sql .= ' ('.PHP_EOL."\t".implode(','.PHP_EOL."\t", $this->cols);
40 40
 
41 41
 			if($this->primaryKey){
42
-				$sql .=','.PHP_EOL."\t".'PRIMARY KEY ('.$this->quote($this->primaryKey).')';
42
+				$sql .= ','.PHP_EOL."\t".'PRIMARY KEY ('.$this->quote($this->primaryKey).')';
43 43
 			}
44 44
 
45 45
 			$sql .= PHP_EOL.')';
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
 		if((is_int($length) || is_string($length) && count(explode(',', $length)) === 2)
85 85
 		   && in_array($type, ['BIT', 'VARBIT', 'CHAR', 'VARCHAR', 'DECIMAL', 'NUMERIC', 'TIME', 'TIMESTAMP', 'INTERVAL'])){
86
-			$field[] = $type_translation.'('. $length . ')';
86
+			$field[] = $type_translation.'('.$length.')';
87 87
 		}
88 88
 		else{
89 89
 			$field[] = $type_translation;
Please login to merge, or discard this patch.