Skip to content

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Aug 5, 2025

Q A
Type improvement
BC Break no
Fixed issues PHPORM-375

Summary

Dependencies blocking Symfony upgrade:

Support for Native Lazy objects is required, as Symfony 8.0 drops support for lazy ghost objects. This version will never be compatible with symfony/var-exporter:8

@GromNaN GromNaN force-pushed the symfony8 branch 3 times, most recently from d144a24 to 5781c4a Compare August 6, 2025 09:31
@GromNaN GromNaN force-pushed the symfony8 branch 3 times, most recently from e73943c to 230d603 Compare August 8, 2025 15:36
@GromNaN GromNaN requested a review from Copilot August 8, 2025 15:37
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for Symfony 8.0 by implementing compatibility layers for console command configurations that now require return type declarations. The main change addresses Symfony 8.0's requirement for the configure() method to have a void return type.

  • Introduces compatibility traits to handle different Symfony versions' return type requirements for console commands
  • Updates dependency constraints to include Symfony 8.0 support
  • Adds CI testing for Symfony 8.0 with conditional dependency handling

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
composer.json Updates Symfony dependencies to support version 8.0, excludes symfony/var-exporter 8.0 due to lazy ghost removal
lib/Doctrine/ODM/MongoDB/Tools/Console/Command/CommandCompatibility.php Adds Symfony 8.0 compatibility with return type declarations for configure() method
lib/Doctrine/ODM/MongoDB/Tools/Console/Command/Schema/AbstractCommandCompatibility.php New trait providing configure() method compatibility for schema commands
lib/Doctrine/ODM/MongoDB/Tools/Console/Command/Schema/AbstractCommand.php Refactors to use compatibility trait and renames configure to configureCommonOptions
Various command files Updates configure() method signatures to use doConfigure() pattern for compatibility
.github/workflows/continuous-integration.yml Adds Symfony 8.0 testing with conditional dependency installation
phpcs.xml.dist Excludes new compatibility file from PSR1 multiple classes rule

@GromNaN GromNaN marked this pull request as ready for review August 8, 2025 16:15
@GromNaN GromNaN requested a review from jmikola August 8, 2025 16:16
Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, but LGTM if no changes are required.

{
parent::configure();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You remove the call to parent::configure() here but it's not included in any of the new implementations in AbstractCommandCompatibility. Does that mean this parent call was never required?

Comment on lines +17 to +20
protected function configure(): void
{
$this->doConfigure();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I'm missing something but I don't think we need this trait here.
Since we already require PHP 8.1+, we should be able to use void in child classes as per: https://3v4l.org/Mv3oq

I did something similar in https://github.com/IonBazan/composer-diff/blob/8907711f0bf74677041f7b356da2367afea44a53/src/Command/BaseTypedCommand.php#L9-L14 but that's only needed to support different PHP versions.

If the parent does not declare a return type then the child is allowed to declare one.

See: https://wiki.php.net/rfc/return_types

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.

4 participants