Skip to content

Conversation

@jonasdekeukelaere
Copy link
Member

@jonasdekeukelaere jonasdekeukelaere commented Jan 15, 2026

Summary by Sourcery

Align console commands and error reporting configuration with PHP 8.5 expectations.

Bug Fixes:

  • Return proper exit status codes from console commands on success and failure to comply with Symfony and PHP 8.5 requirements.

Enhancements:

  • Standardize console command execute methods to return an integer status code instead of void for clearer process outcomes.

Build:

  • Add a php.ini configuration to report all errors except deprecated and user-deprecated notices for PHP 8.5.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 15, 2026

Reviewer's Guide

Aligns multiple Symfony console commands with PHP 8.5/Symfony expectations by returning integer status codes (SUCCESS/FAILURE) from execute() and adds a php.ini file to suppress deprecated notices, especially user deprecations.

Class diagram for updated Symfony console commands execute signatures

classDiagram
    class Command {
        <<abstract>>
        +execute(input : InputInterface, output : OutputInterface) int
    }

    class EnableLocaleCommand {
        +execute(input : InputInterface, output : OutputInterface) int
        -askToInstall() bool
        -askToAddInterfaceLocale() void
        -askToMakeTheLocaleAccessibleToVisitors() bool
        -askToEnableTheLocaleForRedirecting() void
        -showLocaleOverview() void
        -selectWorkingLocale() void
    }

    class ResetPasswordCommand {
        +execute(input : InputInterface, output : OutputInterface) int
    }

    class MediaGalleryDeleteAllCommand {
        +execute(input : InputInterface, output : OutputInterface) int
        -checkOptions(input : InputInterface) void
        -deleteMediaGalleries() void
    }

    class CacheClearCommand {
        +execute(input : InputInterface, output : OutputInterface) int
        -checkOptions(input : InputInterface) void
        -deleteCachedFolders() void
        -getMessage() string
    }

    class ImportLocaleCommand {
        +execute(input : InputInterface, output : OutputInterface) int
        -importLocale(localePath : string, overwriteOption : bool, output : OutputInterface, localeOption : string) void
    }

    class GenerateThumbnailsCommand {
        +__construct(thumbnails : Thumbnails)
        +execute(input : InputInterface, output : OutputInterface) int
        -retrieveSourceFilesAndDestinationFolders(input : InputInterface, output : OutputInterface) void
        -generateThumbnails(input : InputInterface, output : OutputInterface) void
    }

    class InstallModuleCommand {
        +execute(input : InputInterface, output : OutputInterface) int
        -getModuleToInstall(input : InputInterface, output : OutputInterface) string
    }

    Command <|-- EnableLocaleCommand
    Command <|-- ResetPasswordCommand
    Command <|-- MediaGalleryDeleteAllCommand
    Command <|-- CacheClearCommand
    Command <|-- ImportLocaleCommand
    Command <|-- GenerateThumbnailsCommand
    Command <|-- InstallModuleCommand

    class InputInterface
    class OutputInterface
    class Thumbnails

    EnableLocaleCommand ..> InputInterface
    EnableLocaleCommand ..> OutputInterface

    ResetPasswordCommand ..> InputInterface
    ResetPasswordCommand ..> OutputInterface

    MediaGalleryDeleteAllCommand ..> InputInterface
    MediaGalleryDeleteAllCommand ..> OutputInterface

    CacheClearCommand ..> InputInterface
    CacheClearCommand ..> OutputInterface

    ImportLocaleCommand ..> InputInterface
    ImportLocaleCommand ..> OutputInterface

    GenerateThumbnailsCommand ..> InputInterface
    GenerateThumbnailsCommand ..> OutputInterface
    GenerateThumbnailsCommand ..> Thumbnails

    InstallModuleCommand ..> InputInterface
    InstallModuleCommand ..> OutputInterface
Loading

Flow diagram for EnableLocaleCommand execute success and failure paths

flowchart TD
    A[Start execute] --> B[Assign input and output]
    B --> C{isLocaleExist}
    C -- no --> D[Write error: Locale does not exist]
    D --> E[Return Command::FAILURE]
    C -- yes --> F[Load installedLocale]
    F --> G[showLocaleOverview]
    G --> H[selectWorkingLocale]
    H --> I{askToInstall returns true?}
    I -- no --> J[Return Command::FAILURE]
    I -- yes --> K[askToAddInterfaceLocale]
    K --> L{askToMakeTheLocaleAccessibleToVisitors returns true?}
    L -- yes --> M[askToEnableTheLocaleForRedirecting]
    L -- no --> N[Skip redirect enabling]
    M --> O[Return Command::SUCCESS]
    N --> O[Return Command::SUCCESS]
Loading

File-Level Changes

Change Details Files
Update console commands to return int status codes from execute() instead of void and ensure all execution paths return an explicit status.
  • Change execute() method signatures from void to int in several console command classes to match Symfony\Component\Console\Command expectations.
  • Return Command::FAILURE where execution aborts early due to invalid or missing input or business rules.
  • Return Command::SUCCESS at the end of successful command execution paths.
src/Console/Locale/EnableLocaleCommand.php
src/Backend/Modules/Users/Console/ResetPasswordCommand.php
src/Backend/Modules/MediaGalleries/Console/MediaGalleryDeleteAllCommand.php
src/Backend/Modules/MediaLibrary/Console/CacheClearCommand.php
src/Console/Locale/ImportLocaleCommand.php
src/Console/Thumbnails/GenerateThumbnailsCommand.php
src/ForkCMS/Bundle/InstallerBundle/Console/InstallModuleCommand.php
Add php.ini configuration to adjust error reporting for PHP 8.5 by excluding deprecated notices.
  • Introduce a project-level php.ini file.
  • Configure error_reporting to E_ALL excluding E_DEPRECATED and E_USER_DEPRECATED to avoid deprecation noise while keeping other errors visible.
php.ini

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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