Merge "build: Upgrade grunt-banana-checker from 0.6.0 to 0.7.0 and make pass"
[lhc/web/wiklou.git] / includes / shell / Shell.php
index ee9f1eb..19fa1da 100644 (file)
@@ -110,12 +110,13 @@ class Shell {
        /**
         * Returns a new instance of Command class
         *
+        * @note You should check Shell::isDisabled() before calling this
         * @param string|string[] ...$commands String or array of strings representing the command to
         * be executed, each value will be escaped.
         *   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
@@ -223,6 +224,7 @@ class Shell {
         * Note that $parameters should be a flat array and an option with an argument
         * should consist of two consecutive items in the array (do not use "--option value").
         *
+        * @note You should check Shell::isDisabled() before calling this
         * @param string $script MediaWiki CLI script with full path
         * @param string[] $parameters Arguments and options to the script
         * @param array $options Associative array of options:
@@ -230,12 +232,12 @@ 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.
                Hooks::run( 'wfShellWikiCmd', [ &$script, &$parameters, &$options ] );
-               $cmd = isset( $options['php'] ) ? [ $options['php'] ] : [ $wgPhpCli ];
+               $cmd = [ $options['php'] ?? $wgPhpCli ];
                if ( isset( $options['wrapper'] ) ) {
                        $cmd[] = $options['wrapper'];
                }