From 1927fda9093fdccea5541f4621591ee4e3d55282 Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Sun, 15 Sep 2019 11:10:29 +0200 Subject: [PATCH] export: Align docs of close(Rename/Reopen) methods The base implementation says it can accept an array with a single element, but the subclasses only had `string` in the docblock (although they could handle the array case). Hence, replace docblocks in subclasses with @inheritDoc to copy the parent description and avoid such discrepancies in the future. Plus, change `array` to `string[]` for better type inference. Change-Id: Ica9929fd50f31d8d5f0e29f7c60364086ea39ae5 --- includes/export/Dump7ZipOutput.php | 3 +-- includes/export/DumpFileOutput.php | 5 ++--- includes/export/DumpFilter.php | 6 ++++-- includes/export/DumpOutput.php | 4 ++-- includes/export/DumpPipeOutput.php | 5 ++--- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/includes/export/Dump7ZipOutput.php b/includes/export/Dump7ZipOutput.php index a50150e085..833d553696 100644 --- a/includes/export/Dump7ZipOutput.php +++ b/includes/export/Dump7ZipOutput.php @@ -60,8 +60,7 @@ class Dump7ZipOutput extends DumpPipeOutput { } /** - * @param string $newname - * @param bool $open + * @inheritDoc */ function closeAndRename( $newname, $open = false ) { $newname = $this->checkRenameArgCount( $newname ); diff --git a/includes/export/DumpFileOutput.php b/includes/export/DumpFileOutput.php index d0256fd877..ad68109999 100644 --- a/includes/export/DumpFileOutput.php +++ b/includes/export/DumpFileOutput.php @@ -59,7 +59,7 @@ class DumpFileOutput extends DumpOutput { } /** - * @param string $newname + * @inheritDoc */ function closeRenameAndReopen( $newname ) { $this->closeAndRename( $newname, true ); @@ -92,8 +92,7 @@ class DumpFileOutput extends DumpOutput { } /** - * @param string $newname - * @param bool $open + * @inheritDoc */ function closeAndRename( $newname, $open = false ) { $newname = $this->checkRenameArgCount( $newname ); diff --git a/includes/export/DumpFilter.php b/includes/export/DumpFilter.php index 75e149cea3..143fb8efe8 100644 --- a/includes/export/DumpFilter.php +++ b/includes/export/DumpFilter.php @@ -102,14 +102,16 @@ class DumpFilter { } /** - * @param string $newname + * @see DumpOutput::closeRenameAndReopen() + * @param string|string[] $newname */ function closeRenameAndReopen( $newname ) { $this->sink->closeRenameAndReopen( $newname ); } /** - * @param string $newname + * @see DumpOutput::closeAndRename() + * @param string|string[] $newname * @param bool $open */ function closeAndRename( $newname, $open = false ) { diff --git a/includes/export/DumpOutput.php b/includes/export/DumpOutput.php index ab925b75ff..5c15c5f9c0 100644 --- a/includes/export/DumpOutput.php +++ b/includes/export/DumpOutput.php @@ -86,7 +86,7 @@ class DumpOutput { * and reopen new file with the old name. Use this * for writing out a file in multiple pieces * at specified checkpoints (e.g. every n hours). - * @param string|array $newname File name. May be a string or an array with one element + * @param string|string[] $newname File name. May be a string or an array with one element */ function closeRenameAndReopen( $newname ) { } @@ -95,7 +95,7 @@ class DumpOutput { * Close the old file, and move it to a specified name. * Use this for the last piece of a file written out * at specified checkpoints (e.g. every n hours). - * @param string|array $newname File name. May be a string or an array with one element + * @param string|string[] $newname File name. May be a string or an array with one element * @param bool $open If true, a new file with the old filename will be opened * again for writing (default: false) */ diff --git a/includes/export/DumpPipeOutput.php b/includes/export/DumpPipeOutput.php index 0521c5a131..4e61434f50 100644 --- a/includes/export/DumpPipeOutput.php +++ b/includes/export/DumpPipeOutput.php @@ -73,15 +73,14 @@ class DumpPipeOutput extends DumpFileOutput { } /** - * @param string $newname + * @inheritDoc */ function closeRenameAndReopen( $newname ) { $this->closeAndRename( $newname, true ); } /** - * @param string $newname - * @param bool $open + * @inheritDoc */ function closeAndRename( $newname, $open = false ) { $newname = $this->checkRenameArgCount( $newname ); -- 2.20.1