Skip to content

Commit 3ee30de

Browse files
authored
Merge pull request #22 from shochdoerfer/feature/select_mock
Add Select mock file to fix where() doc block
2 parents 3f32a03 + ffeaf91 commit 3ee30de

File tree

2 files changed

+329
-3
lines changed

2 files changed

+329
-3
lines changed

build.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
<exec executable="./vendor/bin/phpcs"
77
passthru="true"
88
checkreturn="true">
9-
<arg value="--standard=PSR2"/>
10-
<arg path="${phing.dir}/src"/>
11-
<arg path="${phing.dir}/tests"/>
9+
<arg value="--ignore=src/Magento/*"/>
1210
</exec>
1311
</target>
1412

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the phpstan-magento package.
5+
*
6+
* (c) bitExpert AG
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Magento\Framework\DB;
13+
14+
use Magento\Framework\App\ResourceConnection;
15+
use Magento\Framework\DB\Adapter\AdapterInterface;
16+
17+
/**
18+
* Class for SQL SELECT generation and results.
19+
*
20+
* @api
21+
* @method \Magento\Framework\DB\Select from($name, $cols = '*', $schema = null)
22+
* @method \Magento\Framework\DB\Select join($name, $cond, $cols = '*', $schema = null)
23+
* @method \Magento\Framework\DB\Select joinInner($name, $cond, $cols = '*', $schema = null)
24+
* @method \Magento\Framework\DB\Select joinLeft($name, $cond, $cols = '*', $schema = null)
25+
* @method \Magento\Framework\DB\Select joinNatural($name, $cond, $cols = '*', $schema = null)
26+
* @method \Magento\Framework\DB\Select joinFull($name, $cond, $cols = '*', $schema = null)
27+
* @method \Magento\Framework\DB\Select joinRight($name, $cond, $cols = '*', $schema = null)
28+
* @method \Magento\Framework\DB\Select joinCross($name, $cols = '*', $schema = null)
29+
* @method \Magento\Framework\DB\Select orWhere($cond, $value = null, $type = null)
30+
* @method \Magento\Framework\DB\Select group($spec)
31+
* @method \Magento\Framework\DB\Select order($spec)
32+
* @method \Magento\Framework\DB\Select limitPage($page, $rowCount)
33+
* @method \Magento\Framework\DB\Select forUpdate($flag = true)
34+
* @method \Magento\Framework\DB\Select distinct($flag = true)
35+
* @method \Magento\Framework\DB\Select reset($part = null)
36+
* @method \Magento\Framework\DB\Select columns($cols = '*', $correlationName = null)
37+
* @since 100.0.2
38+
*/
39+
class Select extends \Zend_Db_Select
40+
{
41+
/**
42+
* Condition type
43+
*/
44+
const TYPE_CONDITION = 'TYPE_CONDITION';
45+
46+
/**
47+
* Straight join key
48+
*/
49+
const STRAIGHT_JOIN = 'straightjoin';
50+
51+
/**
52+
* Sql straight join
53+
*/
54+
const SQL_STRAIGHT_JOIN = 'STRAIGHT_JOIN';
55+
56+
/**
57+
* Class constructor
58+
* Add straight join support
59+
*
60+
* @param Adapter\Pdo\Mysql $adapter
61+
* @param Select\SelectRenderer $selectRenderer
62+
* @param array $parts
63+
*/
64+
public function __construct(
65+
\Magento\Framework\DB\Adapter\Pdo\Mysql $adapter,
66+
\Magento\Framework\DB\Select\SelectRenderer $selectRenderer,
67+
$parts = []
68+
) {
69+
}
70+
71+
/**
72+
* Adds a WHERE condition to the query by AND.
73+
*
74+
* If a value is passed as the second param, it will be quoted
75+
* and replaced into the condition wherever a question-mark
76+
* appears. Array values are quoted and comma-separated.
77+
*
78+
* <code>
79+
* // simplest but non-secure
80+
* $select->where("id = $id");
81+
*
82+
* // secure (ID is quoted but matched anyway)
83+
* $select->where('id = ?', $id);
84+
*
85+
* // alternatively, with named binding
86+
* $select->where('id = :id');
87+
* </code>
88+
*
89+
* Note that it is more correct to use named bindings in your
90+
* queries for values other than strings. When you use named
91+
* bindings, don't forget to pass the values when actually
92+
* making a query:
93+
*
94+
* <code>
95+
* $db->fetchAll($select, array('id' => 5));
96+
* </code>
97+
*
98+
* @param string $cond The WHERE condition.
99+
* @param string|int|array|null $value OPTIONAL A single value to quote into the condition.
100+
* @param string|int|null $type OPTIONAL The type of the given value
101+
* @return \Magento\Framework\DB\Select
102+
*/
103+
public function where($cond, $value = null, $type = null)
104+
{
105+
}
106+
107+
/**
108+
* Reset unused LEFT JOIN(s)
109+
*
110+
* @return $this
111+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
112+
* @SuppressWarnings(PHPMD.NPathComplexity)
113+
*/
114+
public function resetJoinLeft()
115+
{
116+
}
117+
118+
/**
119+
* Validate LEFT joins, and remove it if not exists
120+
*
121+
* @return $this
122+
*/
123+
protected function _resetJoinLeft()
124+
{
125+
}
126+
127+
/**
128+
* Find table name in condition (where, column)
129+
*
130+
* @param string $table
131+
* @param string $cond
132+
* @return bool
133+
*/
134+
protected function _findTableInCond($table, $cond)
135+
{
136+
}
137+
138+
/**
139+
* Populate the {@link $_parts} 'join' key
140+
*
141+
* Does the dirty work of populating the join key.
142+
*
143+
* The $name and $cols parameters follow the same logic
144+
* as described in the from() method.
145+
*
146+
* @param null|string $type Type of join; inner, left, and null are currently supported
147+
* @param array|string|\Zend_Db_Expr $name Table name
148+
* @param string $cond Join on this condition
149+
* @param array|string $cols The columns to select from the joined table
150+
* @param string $schema The database name to specify, if any.
151+
* @return \Magento\Framework\DB\Select This \Magento\Framework\DB\Select object
152+
* @throws \Zend_Db_Select_Exception
153+
*/
154+
protected function _join($type, $name, $cond, $cols, $schema = null)
155+
{
156+
}
157+
158+
/**
159+
* Sets a limit count and offset to the query.
160+
*
161+
* @param int $count OPTIONAL The number of rows to return.
162+
* @param int $offset OPTIONAL Start returning after this many rows.
163+
* @return $this
164+
*/
165+
public function limit($count = null, $offset = null)
166+
{
167+
}
168+
169+
/**
170+
* Cross Table Update From Current select
171+
*
172+
* @param string|array $table
173+
* @return string
174+
*/
175+
public function crossUpdateFromSelect($table)
176+
{
177+
}
178+
179+
/**
180+
* Insert to table from current select
181+
*
182+
* @param string $tableName
183+
* @param array $fields
184+
* @param bool $onDuplicate
185+
* @return string
186+
*/
187+
public function insertFromSelect($tableName, $fields = [], $onDuplicate = true)
188+
{
189+
}
190+
191+
/**
192+
* Generate INSERT IGNORE query to the table from current select
193+
*
194+
* @param string $tableName
195+
* @param array $fields
196+
* @return string
197+
*/
198+
public function insertIgnoreFromSelect($tableName, $fields = [])
199+
{
200+
}
201+
202+
/**
203+
* Retrieve DELETE query from select
204+
*
205+
* @param string $table The table name or alias
206+
* @return string
207+
*/
208+
public function deleteFromSelect($table)
209+
{
210+
}
211+
212+
/**
213+
* Modify (hack) part of the structured information for the current query
214+
*
215+
* @param string $part
216+
* @param mixed $value
217+
* @return $this
218+
* @throws \Zend_Db_Select_Exception
219+
*/
220+
public function setPart($part, $value)
221+
{
222+
}
223+
224+
/**
225+
* Use a STRAIGHT_JOIN for the SQL Select
226+
*
227+
* @param bool $flag Whether or not the SELECT use STRAIGHT_JOIN (default true).
228+
* @return $this
229+
*/
230+
public function useStraightJoin($flag = true)
231+
{
232+
}
233+
234+
/**
235+
* Render STRAIGHT_JOIN clause
236+
*
237+
* @param string $sql SQL query
238+
* @return string
239+
*/
240+
protected function _renderStraightjoin($sql)
241+
{
242+
}
243+
244+
/**
245+
* Adds to the internal table-to-column mapping array.
246+
*
247+
* @param string $correlationName The table/join the columns come from.
248+
* @param array|string $cols The list of columns; preferably as an array,
249+
* but possibly as a string containing one column.
250+
* @param bool|string $afterCorrelationName True if it should be prepended,
251+
* a correlation name if it should be inserted
252+
* @return void
253+
*/
254+
protected function _tableCols($correlationName, $cols, $afterCorrelationName = null)
255+
{
256+
}
257+
258+
/**
259+
* Adds the random order to query
260+
*
261+
* @param string $field integer field name
262+
* @return $this
263+
*/
264+
public function orderRand($field = null)
265+
{
266+
}
267+
268+
/**
269+
* Render FOR UPDATE clause
270+
*
271+
* @param string $sql SQL query
272+
* @return string
273+
*/
274+
protected function _renderForupdate($sql)
275+
{
276+
}
277+
278+
/**
279+
* Add EXISTS clause
280+
*
281+
* @param Select $select
282+
* @param string $joinCondition
283+
* @param bool $isExists
284+
* @return $this
285+
*/
286+
public function exists($select, $joinCondition, $isExists = true)
287+
{
288+
}
289+
290+
/**
291+
* Get adapter
292+
*
293+
* @return \Magento\Framework\DB\Adapter\AdapterInterface
294+
*/
295+
public function getConnection()
296+
{
297+
}
298+
299+
/**
300+
* Converts this object to an SQL SELECT string.
301+
*
302+
* @return string|null This object as a SELECT string. (or null if a string cannot be produced.)
303+
* @since 100.1.0
304+
*/
305+
public function assemble()
306+
{
307+
}
308+
309+
/**
310+
* Sleep magic method.
311+
*
312+
* @return string[]
313+
* @since 100.0.11
314+
*/
315+
public function __sleep()
316+
{
317+
}
318+
319+
/**
320+
* Init not serializable fields
321+
*
322+
* @return void
323+
* @since 100.0.11
324+
*/
325+
public function __wakeup()
326+
{
327+
}
328+
}

0 commit comments

Comments
 (0)