X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fshell%2FCommand.php;h=109097ae8657109bd0b3d03b74942947e07c0c14;hb=55cdf18ecf7d312f016a3cb9a6f83c2cf209a26c;hp=d504611f7d44a2de229e7fa34bcdde7cf948ff57;hpb=f7ead5d3ca0e1ae673752f6c6118297bf47e1c88;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/shell/Command.php b/includes/shell/Command.php index d504611f7d..109097ae86 100644 --- a/includes/shell/Command.php +++ b/includes/shell/Command.php @@ -111,11 +111,10 @@ class Command { * 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 ): Command { 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 @@ -130,11 +129,10 @@ class Command { * 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 ): Command { 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 @@ -157,7 +155,7 @@ class Command { * filesize (for ulimit -f), memory, time, walltime. * @return $this */ - public function limits( array $limits ) { + public function limits( array $limits ): Command { if ( !isset( $limits['walltime'] ) && isset( $limits['time'] ) ) { // Emulate the behavior of old wfShellExec() where walltime fell back on time // if the latter was overridden and the former wasn't @@ -174,7 +172,7 @@ class Command { * @param string[] $env array of variable name => value * @return $this */ - public function environment( array $env ) { + public function environment( array $env ): Command { $this->env = $env; return $this; @@ -186,7 +184,7 @@ class Command { * @param string $method * @return $this */ - public function profileMethod( $method ) { + public function profileMethod( $method ): Command { $this->method = $method; return $this; @@ -198,7 +196,7 @@ class Command { * @param string|null $inputString * @return $this */ - public function input( $inputString ) { + public function input( $inputString ): Command { $this->inputString = is_null( $inputString ) ? null : (string)$inputString; return $this; @@ -211,7 +209,7 @@ class Command { * @param bool $yesno * @return $this */ - public function includeStderr( $yesno = true ) { + public function includeStderr( $yesno = true ): Command { $this->doIncludeStderr = $yesno; return $this; @@ -223,7 +221,7 @@ class Command { * @param bool $yesno * @return $this */ - public function logStderr( $yesno = true ) { + public function logStderr( $yesno = true ): Command { $this->doLogStderr = $yesno; return $this; @@ -235,7 +233,7 @@ class Command { * @param string|false $cgroup Absolute file path to the cgroup, or false to not use a cgroup * @return $this */ - public function cgroup( $cgroup ) { + public function cgroup( $cgroup ): Command { $this->cgroup = $cgroup; return $this; @@ -248,7 +246,7 @@ class Command { * @param int $restrictions * @return $this */ - public function restrict( $restrictions ) { + public function restrict( $restrictions ): Command { $this->restrictions |= $restrictions; return $this; @@ -275,7 +273,7 @@ class Command { * * @return $this */ - public function whitelistPaths( array $paths ) { + public function whitelistPaths( array $paths ): Command { // Default implementation is a no-op return $this; } @@ -429,13 +427,13 @@ class Command { } // 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 ) {