aboutsummaryrefslogtreecommitdiffstats
path: root/includes/shell
diff options
context:
space:
mode:
authorMax Semenik <maxsem.wiki@gmail.com>2019-04-26 13:54:41 -0700
committerMax Semenik <maxsem.wiki@gmail.com>2019-04-26 13:54:41 -0700
commite7d13e88b8832af90ea02d0502609b267ec4a51d (patch)
treedf28bccb3b91e26f9bbb21f94556b54203f24293 /includes/shell
parenta3c8282068ac30d5947dc023e7e2b2bf21e83d50 (diff)
downloadmediawikicore-e7d13e88b8832af90ea02d0502609b267ec4a51d.tar.gz
mediawikicore-e7d13e88b8832af90ea02d0502609b267ec4a51d.zip
shell: annotate return types
Change-Id: I3ab0a6409088c86581d9d50a340e82b0ea354814
Diffstat (limited to 'includes/shell')
-rw-r--r--includes/shell/Command.php22
-rw-r--r--includes/shell/CommandFactory.php2
-rw-r--r--includes/shell/FirejailCommand.php2
-rw-r--r--includes/shell/Shell.php4
4 files changed, 15 insertions, 15 deletions
diff --git a/includes/shell/Command.php b/includes/shell/Command.php
index ba8133f24687..109097ae8657 100644
--- a/includes/shell/Command.php
+++ b/includes/shell/Command.php
@@ -114,7 +114,7 @@ class Command {
* @param string|string[] ...$args
* @return $this
*/
- public function params( ...$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
@@ -132,7 +132,7 @@ class Command {
* @param string|string[] ...$args
* @return $this
*/
- public function unsafeParams( ...$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
@@ -155,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
@@ -172,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;
@@ -184,7 +184,7 @@ class Command {
* @param string $method
* @return $this
*/
- public function profileMethod( $method ) {
+ public function profileMethod( $method ): Command {
$this->method = $method;
return $this;
@@ -196,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;
@@ -209,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;
@@ -221,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;
@@ -233,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;
@@ -246,7 +246,7 @@ class Command {
* @param int $restrictions
* @return $this
*/
- public function restrict( $restrictions ) {
+ public function restrict( $restrictions ): Command {
$this->restrictions |= $restrictions;
return $this;
@@ -273,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;
}
diff --git a/includes/shell/CommandFactory.php b/includes/shell/CommandFactory.php
index b4b9b921a969..d3e00b189606 100644
--- a/includes/shell/CommandFactory.php
+++ b/includes/shell/CommandFactory.php
@@ -97,7 +97,7 @@ class CommandFactory {
*
* @return Command
*/
- public function create() {
+ public function create(): Command {
if ( $this->restrictionMethod === 'firejail' ) {
$command = new FirejailCommand( $this->findFirejail() );
$command->restrict( Shell::RESTRICT_DEFAULT );
diff --git a/includes/shell/FirejailCommand.php b/includes/shell/FirejailCommand.php
index 7aed05f9bee5..6bf94cdbe0d2 100644
--- a/includes/shell/FirejailCommand.php
+++ b/includes/shell/FirejailCommand.php
@@ -51,7 +51,7 @@ class FirejailCommand extends Command {
/**
* @inheritDoc
*/
- public function whitelistPaths( array $paths ) {
+ public function whitelistPaths( array $paths ): Command {
$this->whitelistedPaths = array_merge( $this->whitelistedPaths, $paths );
return $this;
}
diff --git a/includes/shell/Shell.php b/includes/shell/Shell.php
index 467e4ef9a9dc..19fa1da89465 100644
--- a/includes/shell/Shell.php
+++ b/includes/shell/Shell.php
@@ -116,7 +116,7 @@ class Shell {
* Example: [ 'convert', '-font', 'font name' ] would produce "'convert' '-font' 'font name'"
* @return Command
*/
- public static function command( ...$commands ) {
+ public static function command( ...$commands ): Command {
if ( count( $commands ) === 1 && is_array( reset( $commands ) ) ) {
// If only one argument has been passed, and that argument is an array,
// treat it as a list of arguments
@@ -232,7 +232,7 @@ class Shell {
* 'wrapper': Path to a PHP wrapper to handle the maintenance script
* @return Command
*/
- public static function makeScriptCommand( $script, $parameters, $options = [] ) {
+ public static function makeScriptCommand( $script, $parameters, $options = [] ): Command {
global $wgPhpCli;
// Give site config file a chance to run the script in a wrapper.
// The caller may likely want to call wfBasename() on $script.