Skip to content

Commit 3357238

Browse files
Merge pull request #20042 from kamil-tekiela/exportRawQuery
Remove nullability from $db param
2 parents 8334b3d + 6b502d7 commit 3357238

14 files changed

Lines changed: 62 additions & 62 deletions

‎src/Plugins/Export/ExportCsv.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,16 @@ public function exportData(
213213
/**
214214
* Outputs result of raw query in CSV format
215215
*
216-
* @param string|null $db the database where the query is executed
217-
* @param string $sqlQuery the rawquery to output
216+
* @param string $db the database where the query is executed
217+
* @param string $sqlQuery the rawquery to output
218218
*/
219-
public function exportRawQuery(string|null $db, string $sqlQuery): void
219+
public function exportRawQuery(string $db, string $sqlQuery): void
220220
{
221-
if ($db !== null) {
221+
if ($db !== '') {
222222
DatabaseInterface::getInstance()->selectDb($db);
223223
}
224224

225-
$this->exportData($db ?? '', '', $sqlQuery);
225+
$this->exportData($db, '', $sqlQuery);
226226
}
227227

228228
/** @inheritDoc */

‎src/Plugins/Export/ExportExcel.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,16 @@ public function exportData(
211211
/**
212212
* Outputs result of raw query in CSV format
213213
*
214-
* @param string|null $db the database where the query is executed
215-
* @param string $sqlQuery the rawquery to output
214+
* @param string $db the database where the query is executed
215+
* @param string $sqlQuery the rawquery to output
216216
*/
217-
public function exportRawQuery(string|null $db, string $sqlQuery): void
217+
public function exportRawQuery(string $db, string $sqlQuery): void
218218
{
219-
if ($db !== null) {
219+
if ($db !== '') {
220220
DatabaseInterface::getInstance()->selectDb($db);
221221
}
222222

223-
$this->exportData($db ?? '', '', $sqlQuery);
223+
$this->exportData($db, '', $sqlQuery);
224224
}
225225

226226
/** @inheritDoc */

‎src/Plugins/Export/ExportJson.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,18 +276,18 @@ private function doExportForQuery(
276276
/**
277277
* Outputs result raw query in JSON format
278278
*
279-
* @param string|null $db the database where the query is executed
280-
* @param string $sqlQuery the rawquery to output
279+
* @param string $db the database where the query is executed
280+
* @param string $sqlQuery the rawquery to output
281281
*/
282-
public function exportRawQuery(string|null $db, string $sqlQuery): void
282+
public function exportRawQuery(string $db, string $sqlQuery): void
283283
{
284284
$buffer = $this->encode(['type' => 'raw', 'data' => '@@DATA@@']);
285285
if ($buffer === false) {
286286
throw new ExportException('Failure during data export.');
287287
}
288288

289289
$dbi = DatabaseInterface::getInstance();
290-
if ($db !== null) {
290+
if ($db !== '') {
291291
$dbi->selectDb($db);
292292
}
293293

‎src/Plugins/Export/ExportLatex.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,16 @@ public function exportData(
371371
/**
372372
* Outputs result raw query
373373
*
374-
* @param string|null $db the database where the query is executed
375-
* @param string $sqlQuery the rawquery to output
374+
* @param string $db the database where the query is executed
375+
* @param string $sqlQuery the rawquery to output
376376
*/
377-
public function exportRawQuery(string|null $db, string $sqlQuery): void
377+
public function exportRawQuery(string $db, string $sqlQuery): void
378378
{
379-
if ($db !== null) {
379+
if ($db !== '') {
380380
DatabaseInterface::getInstance()->selectDb($db);
381381
}
382382

383-
$this->exportData($db ?? '', '', $sqlQuery);
383+
$this->exportData($db, '', $sqlQuery);
384384
}
385385

386386
/**

‎src/Plugins/Export/ExportMediawiki.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,16 @@ public function exportData(
246246
/**
247247
* Outputs result raw query in MediaWiki format
248248
*
249-
* @param string|null $db the database where the query is executed
250-
* @param string $sqlQuery the rawquery to output
249+
* @param string $db the database where the query is executed
250+
* @param string $sqlQuery the rawquery to output
251251
*/
252-
public function exportRawQuery(string|null $db, string $sqlQuery): void
252+
public function exportRawQuery(string $db, string $sqlQuery): void
253253
{
254-
if ($db !== null) {
254+
if ($db !== '') {
255255
DatabaseInterface::getInstance()->selectDb($db);
256256
}
257257

258-
$this->exportData($db ?? '', '', $sqlQuery);
258+
$this->exportData($db, '', $sqlQuery);
259259
}
260260

261261
/**

‎src/Plugins/Export/ExportOds.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,16 @@ public function exportData(
259259
/**
260260
* Outputs result raw query in ODS format
261261
*
262-
* @param string|null $db the database where the query is executed
263-
* @param string $sqlQuery the rawquery to output
262+
* @param string $db the database where the query is executed
263+
* @param string $sqlQuery the rawquery to output
264264
*/
265-
public function exportRawQuery(string|null $db, string $sqlQuery): void
265+
public function exportRawQuery(string $db, string $sqlQuery): void
266266
{
267-
if ($db !== null) {
267+
if ($db !== '') {
268268
DatabaseInterface::getInstance()->selectDb($db);
269269
}
270270

271-
$this->exportData($db ?? '', '', $sqlQuery);
271+
$this->exportData($db, '', $sqlQuery);
272272
}
273273

274274
/** @inheritDoc */

‎src/Plugins/Export/ExportOdt.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,16 +281,16 @@ public function exportData(
281281
/**
282282
* Outputs result raw query in ODT format
283283
*
284-
* @param string|null $db the database where the query is executed
285-
* @param string $sqlQuery the rawquery to output
284+
* @param string $db the database where the query is executed
285+
* @param string $sqlQuery the rawquery to output
286286
*/
287-
public function exportRawQuery(string|null $db, string $sqlQuery): void
287+
public function exportRawQuery(string $db, string $sqlQuery): void
288288
{
289-
if ($db !== null) {
289+
if ($db !== '') {
290290
DatabaseInterface::getInstance()->selectDb($db);
291291
}
292292

293-
$this->exportData($db ?? '', '', $sqlQuery);
293+
$this->exportData($db, '', $sqlQuery);
294294
}
295295

296296
/**

‎src/Plugins/Export/ExportPdf.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@ public function exportData(
135135
/**
136136
* Outputs result of raw query in PDF format
137137
*
138-
* @param string|null $db the database where the query is executed
139-
* @param string $sqlQuery the rawquery to output
138+
* @param string $db the database where the query is executed
139+
* @param string $sqlQuery the rawquery to output
140140
*/
141-
public function exportRawQuery(string|null $db, string $sqlQuery): void
141+
public function exportRawQuery(string $db, string $sqlQuery): void
142142
{
143143
$this->pdf->setDbAlias('----');
144144
$this->pdf->setTableAlias('----');
145145
$this->pdf->setPurpose(__('Query result data'));
146146

147-
if ($db !== null) {
147+
if ($db !== '') {
148148
$this->pdf->setCurrentDb($db);
149149
DatabaseInterface::getInstance()->selectDb($db);
150150
}

‎src/Plugins/Export/ExportPhparray.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,16 @@ public function exportData(
191191
/**
192192
* Outputs result of raw query as PHP array
193193
*
194-
* @param string|null $db the database where the query is executed
195-
* @param string $sqlQuery the rawquery to output
194+
* @param string $db the database where the query is executed
195+
* @param string $sqlQuery the rawquery to output
196196
*/
197-
public function exportRawQuery(string|null $db, string $sqlQuery): void
197+
public function exportRawQuery(string $db, string $sqlQuery): void
198198
{
199-
if ($db !== null) {
199+
if ($db !== '') {
200200
DatabaseInterface::getInstance()->selectDb($db);
201201
}
202202

203-
$this->exportData($db ?? '', '', $sqlQuery);
203+
$this->exportData($db, '', $sqlQuery);
204204
}
205205

206206
/** @inheritDoc */

‎src/Plugins/Export/ExportSql.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,16 +1807,16 @@ private function getTableComments(string $db, string $table, array $aliases = []
18071807
/**
18081808
* Outputs a raw query
18091809
*
1810-
* @param string|null $db the database where the query is executed
1811-
* @param string $sqlQuery the rawquery to output
1810+
* @param string $db the database where the query is executed
1811+
* @param string $sqlQuery the rawquery to output
18121812
*/
1813-
public function exportRawQuery(string|null $db, string $sqlQuery): void
1813+
public function exportRawQuery(string $db, string $sqlQuery): void
18141814
{
1815-
if ($db !== null) {
1815+
if ($db !== '') {
18161816
DatabaseInterface::getInstance()->selectDb($db);
18171817
}
18181818

1819-
$this->exportData($db ?? '', '', $sqlQuery);
1819+
$this->exportData($db, '', $sqlQuery);
18201820
}
18211821

18221822
/**

0 commit comments

Comments
 (0)