Skip to content

Commit

Permalink
Merge pull request #208 from totten/master-return
Browse files Browse the repository at this point in the history
execute() - Update return types for more methods
  • Loading branch information
totten authored Aug 10, 2024
2 parents 3fa725d + cd90760 commit 3889cb2
Show file tree
Hide file tree
Showing 31 changed files with 38 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/Command/AngularHtmlListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);
if (!$input->getOption('user')) {
$output->getErrorOutput()->writeln("<comment>For a full list, try passing --user=[username].</comment>");
Expand Down
2 changes: 1 addition & 1 deletion src/Command/AngularHtmlShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);
if (!$input->getOption('user')) {
$output->getErrorOutput()->writeln("<comment>For a full list, try passing --user=[username].</comment>");
Expand Down
2 changes: 1 addition & 1 deletion src/Command/AngularModuleListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);
if (!$input->getOption('user')) {
$output->getErrorOutput()->writeln("<comment>For a full list, try passing --user=[username].</comment>");
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Api4Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$C = '<comment>';
$_C = '</comment>';
$I = '<info>';
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ApiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$C = '<comment>';
$_C = '</comment>';
$I = '<info>';
Expand Down
3 changes: 2 additions & 1 deletion src/Command/CliCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);

$cv = new Application();
Expand All @@ -32,6 +32,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
// new ApiMatcher(),
//));
$sh->run();
return 0;
}

}
2 changes: 1 addition & 1 deletion src/Command/CoreCheckReqCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function configure() {
$this->configureBootOptions('none');
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$filterSeverities = $this->parseFilter($input);

$showBootMsgsByDefault = in_array($input->getOption('out'), ['table', 'pretty']);
Expand Down
2 changes: 1 addition & 1 deletion src/Command/CoreInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function configure() {
$this->configureBootOptions('none');
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$setup = $this->bootSetupSubsystem($input, $output);

$debugMode = FALSE;
Expand Down
4 changes: 3 additions & 1 deletion src/Command/CoreUninstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function configure() {
$this->configureBootOptions('none');
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$setup = $this->bootSetupSubsystem($input, $output);

$debugEvent = $this->parseOptionalOption($input, ['--debug-event'], NULL, '');
Expand Down Expand Up @@ -74,6 +74,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln(sprintf("<info>Removing <comment>%s</comment> from <comment>%s</comment></info>", basename($setup->getModel()->settingsPath), dirname($setup->getModel()->settingsPath)));
$setup->uninstallFiles();
}

return 0;
}

}
2 changes: 1 addition & 1 deletion src/Command/EditCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct($name = NULL) {
});
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);

$config = Config::read();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/EvalCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);

if ($input->getOption('out') === 'auto') {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExtensionDisableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);
list ($foundKeys, $missingKeys) = $this->parseKeys($input, $output);

Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExtensionDownloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
parent::initialize($input, $output);
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$fs = new Filesystem();

if ($extRepoUrl = $this->parseRepoUrl($input)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExtensionEnableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);

// Refresh extensions if (a) ---refresh enabled or (b) there's a cache-miss.
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExtensionListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$wo = ($input->getOption('out') === 'table')
? (OutputInterface::OUTPUT_NORMAL | OutputInterface::VERBOSITY_NORMAL)
: (OutputInterface::OUTPUT_NORMAL | OutputInterface::VERBOSITY_VERBOSE);
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExtensionUninstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);
list ($foundKeys, $missingKeys) = $this->parseKeys($input, $output);

Expand Down
3 changes: 2 additions & 1 deletion src/Command/FillCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function __construct($name = NULL) {
);
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);
if (!$input->getOption('file')) {
$reader = new SiteConfigReader(CIVICRM_SETTINGS_PATH);
Expand Down Expand Up @@ -105,6 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
});
$output->writeln(sprintf("<info>Please edit</info> %s", Config::getFileName()));
}
return 0;
}

}
2 changes: 1 addition & 1 deletion src/Command/FlushCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
// The main reason we have this as separate command -- so we can ignore
// stale class-references that might be retained by the container cache.
define('CIVICRM_CONTAINER_CACHE', 'never');
Expand Down
3 changes: 2 additions & 1 deletion src/Command/HttpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);

$method = $input->getOption('request');
Expand All @@ -67,6 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$statusCode = $this->sendRequest($output, $method, $row['value'], array_merge($headers, $row['headers'] ?? []), $data);
return ($statusCode >= 200 && $statusCode < 300) ? 0 : $statusCode;
}
return 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Command/PathCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);

if (!$input->getOption('ext') && !$input->getOption('config') && !$input->getOption('dynamic')) {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/PipeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);
if (!is_callable(['Civi', 'pipe'])) {
fwrite(STDERR, "This version of CiviCRM does not include Civi::pipe() support.\n");
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ScriptCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$fs = new Filesystem();
$origScript = $fs->toAbsolutePath($input->getArgument('script'));
$scriptArguments = $input->getArgument('scriptArguments');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SettingGetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);

$filter = $this->createSettingFilter($input->getArgument('name'));
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SettingRevertCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);
$errorOutput = is_callable([$output, 'getErrorOutput']) ? $output->getErrorOutput() : $output;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/SettingSetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$C = '<comment>';
$_C = '</comment>';
$I = '<info>';
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SqlCliCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
}
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->boot($input, $output);

$datasource = new Datasource();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/UpgradeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function configure() {
// parent::configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {

throw new \RuntimeException("FIXME: Calls to run() should be escaped, e.g. with Process::sprintf()");

Expand Down
3 changes: 2 additions & 1 deletion src/Command/UpgradeDlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function configure() {
// parent::configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
// Figure out the URL, whether specified or automatic
$url = $input->getOption('url');
if (empty($url)) {
Expand Down Expand Up @@ -114,6 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$result['installedTo'] = $dest;

$this->sendResult($input, $output, $result);
return 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Command/UpgradeGetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function configure() {
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$result = array();
$exitCode = 0;
$stability = $input->getOption('stability');
Expand Down
3 changes: 2 additions & 1 deletion src/Command/UpgradeReportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function configure() {
// parent::configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
// $report will be POSTed too https://upgrade.civicrm.org/report.
// See also: https://github.com/civicrm/civicrm-dist-manager#route-post-report-web-service

Expand Down Expand Up @@ -111,6 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$report['response'] = $this->reportToCivi($report);

$this->sendResult($input, $output, $report);
return 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Command/UrlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
}
}

protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
if (in_array($input->getOption('out'), Encoder::getTabularFormats())
&& !in_array($input->getOption('out'), Encoder::getFormats())) {
$input->setOption('tabular', TRUE);
Expand Down

0 comments on commit 3889cb2

Please sign in to comment.