* Adds parameters to the command. All parameters are sanitized via Shell::escape().
* Null values are ignored.
*
- * @param string|string[] $args,...
+ * @param string|string[] ...$args
* @return $this
*/
- public function params( /* ... */ ) {
- $args = func_get_args();
+ public function params( ...$args ) {
if ( count( $args ) === 1 && is_array( reset( $args ) ) ) {
// If only one argument has been passed, and that argument is an array,
// treat it as a list of arguments
* Adds unsafe parameters to the command. These parameters are NOT sanitized in any way.
* Null values are ignored.
*
- * @param string|string[] $args,...
+ * @param string|string[] ...$args
* @return $this
*/
- public function unsafeParams( /* ... */ ) {
- $args = func_get_args();
+ public function unsafeParams( ...$args ) {
if ( count( $args ) === 1 && is_array( reset( $args ) ) ) {
// If only one argument has been passed, and that argument is an array,
// treat it as a list of arguments
}
// clear get_last_error without actually raising an error
- // from https://secure.php.net/manual/en/function.error-get-last.php#113518
+ // from https://www.php.net/manual/en/function.error-get-last.php#113518
// TODO replace with clear_last_error when requirements are bumped to PHP7
set_error_handler( function () {
}, 0 );
- \MediaWiki\suppressWarnings();
+ \Wikimedia\suppressWarnings();
trigger_error( '' );
- \MediaWiki\restoreWarnings();
+ \Wikimedia\restoreWarnings();
restore_error_handler();
$readPipes = array_filter( $pipes, function ( $fd ) use ( $desc ) {
return new Result( $retval, $buffers[1], $buffers[2] );
}
+
+ /**
+ * Returns the final command line before environment/limiting, etc are applied.
+ * Use string conversion only for debugging, don't try to pass this to
+ * some other execution medium.
+ *
+ * @return string
+ */
+ public function __toString() {
+ return "#Command: {$this->command}";
+ }
}