Problem/Motivation

Method "Symfony\Component\Console\Command\Command::execute()" will return "int" as of its next major version. Doing the same in child class "Drupal\Tests\system\Kernel\Scripts\DbCommandBaseTester" will be required when upgrading.

The problem is bigger then only the method execute() from the stated class. There are a lot more overrides for that method in other classes.

Steps to reproduce

Proposed resolution

Add the "int" return type hint
.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3233456-2.patch8.39 KBdaffie

Comments

daffie created an issue. See original summary.

daffie’s picture

Status: Active » Needs review
StatusFileSize
new8.39 KB

There are almost a 100 overrides in contrib for this method. Therefor we shall have to wait for the 10.0 branch before this can be committed. See: http://grep.xnddx.ru/search?text=protected+function+execute%28InputInter....

longwave’s picture

I would be surprised if any of those contrib ones actually extend one of our implementations, though? I would think that all commands are standalone implementations.

daffie’s picture

Status: Needs review » Postponed

I was hoping that @longwave was right and we could do this in the 9.3 branch.

I have searched and I found 2 modules that extending one of the classes. The first is a hardly used module called smart_db_tools. It is overriding the class Drupal\Core\Command\DbDumpCommand and the method execute() in http://grep.xnddx.ru/node/31801282. The issue to fix the problem is: #3238741: Add return type hint to the method Drupal\smart_db_tools\SmartDbDumpCommand::execute().

The second instance is the module ckeditor_media_embed with a reported ~14k sites using it. It is overriding the class Drupal\Core\Command\DbDumpCommand and the method execute() in http://grep.xnddx.ru/node/31540748. The issue to fix the problem is: #3238738: Add return type hint to the method Drupal\ckeditor_media_embed\Command::execute().

Postponing this issue on fixing the 2 modules for the 9.3 branch. It can be committed to the 10.0 branch.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

longwave’s picture

Version: 9.4.x-dev » 10.0.x-dev
Status: Postponed » Reviewed & tested by the community

This is OK to go into 10.0.x, we can decide to backport parts of it later if we want to.

  • catch committed 30eb18c on 10.0.x
    Issue #3233456 by daffie, longwave: [Symfony 6] Add "int" type hint to...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 30eb18c and pushed to 10.0.x. Thanks!

If we find a good reason to backport parts of this I think we can, but marking it fixed against 10.0.x for now since we definitely can't get to a clean slate with Symfony type hints in 9.x, so the only reason would be to minimise code divergence. But this isn't that much divergence in the scheme of things compared to having to do 9.x-specific backports anyway.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.