Skip to content

Commit

Permalink
execute() - Declare explicit return type
Browse files Browse the repository at this point in the history
This is strictly necessary for Symfony 5. However, the actual beahvior
in S5 is the throw an error if you don't return `int`.  So we might
as well get the IDE to give hints about this.
  • Loading branch information
totten committed Aug 10, 2024
1 parent a0e70a9 commit cd90760
Show file tree
Hide file tree
Showing 24 changed files with 24 additions and 24 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
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/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
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
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
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
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 cd90760

Please sign in to comment.