Skip to content

Add int return type to Console Command execute() methods - #20

Merged
mage-os-ci merged 3 commits into
masterfrom
fix/console-execute-return-type
May 18, 2026
Merged

mage-os-ci merged 3 commits into
masterfrom
fix/console-execute-return-type

Conversation

@rhoerr

@rhoerr rhoerr commented May 18, 2026

Copy link
Copy Markdown
Member

Summary

The three console commands in this module override Symfony\Component\Console\Command\Command::execute() but did not declare the parent's : int return type. Under PHP 8+ signature compatibility checks this produces a fatal error at autoload time:

PHP Fatal error:  Declaration of MageOS\PageBuilderTemplateImportExport\Console\Command\ExportTemplate::execute(...) must be compatible with Symfony\Component\Console\Command\Command::execute(...): int

Fix: add the matching : int return type to all three commands. Each already returns Cli::RETURN_SUCCESS / Cli::RETURN_FAILURE, so no behavior changes.

Files updated:

  • Console/Command/ExportTemplate.php
  • Console/Command/ImportTemplate.php
  • Console/Command/UpdateRemoteTemplateList.php

Test plan

  • Module loads on PHP 8.2/8.3/8.4 without fatal error
  • bin/magento mage-os:pagebuilder_template:export, :import, and :update_remote_template_list continue to run and return correct exit codes

Symfony Console Command::execute() declares a ': int' return type. The
three commands in this module did not, causing a PHP fatal error when
loaded under PHP 8+ strict signature checks.
@rhoerr
rhoerr requested review from a team and dadolun95 as code owners May 18, 2026 03:39
marcelmtz
marcelmtz previously approved these changes May 18, 2026
@mage-os-ci
mage-os-ci merged commit c89f991 into master May 18, 2026
2 checks passed
@mage-os-ci
mage-os-ci deleted the fix/console-execute-return-type branch May 18, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants