8000 [Console] Remove deprecations across the component by alexandre-daubois · Pull Request #50613 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Remove deprecations across the component #50613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

alexandre-daubois
Copy link
Member
@alexandre-daubois alexandre-daubois commented Jun 9, 2023
Q A
Branch? 7.0
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

In short: preparing the component for 7.0 🙂

@carsonbot carsonbot added this to the 7.0 milestone Jun 9, 2023
@alexandre-daubois alexandre-daubois force-pushed the console-deprecations branch 2 times, most recently from 903ba6a to 171965f Compare June 9, 2023 12:16
Copy link
Member
@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

let's finish existing PRs before opening new ones ;)

@alexandre-daubois alexandre-daubois changed the title [Console] Remove deprecations and add types across the component [Console] Remove deprecations across the component Jun 13, 2023
"symfony/console": "^6.4|^7.0",
"symfony/dotenv": "^6.4|^7.0",
"symfony/finder": "^6.4",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is necessary because composer/class-map-generator doesn't support Symfony ^7.0 yet. The highest dep for the Finder must be set to ^6.4 because of this for now.

Copy link
Member

Choose a reason for hiding this comment

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

please send a PR to class-map-generator instead

Copy link
Member Author

Choose a reason for hiding this comment

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

It has been dealt by @stloyd here, thanks!

I'll revert the change once it's merged.

Copy link
Member

Choose a reason for hiding this comment

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

Unlocked!

Copy link
Member Author

Choose a reason for hiding this comment

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

I was going to update when I saw you updated the file. Thank you! 🙂

@alexandre-daubois alexandre-daubois force-pushed the console-deprecations branch 7 times, most recently from 1a9a9f0 to a1854be Compare June 13, 2023 15:52
@@ -82,8 +71,7 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
protected function execute(InputInterface $input, OutputInterface $output): int
{
try {
// "symfony" must be kept for compat with the shell scripts generated by Symfony Console 5.4 - 6.1
$version = $input->getOption('symfony') ? '1' : $input->getOption('api-version');
$version = $input->getOption('api-version');
Copy link
Member

Choose a reason for hiding this comment

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

What about this one @wouterj? should we keep support for the deprecated flag to provide a smooth transition?
Also, we're missing a deprecation notice if this should be removed in 7.0

Copy link
Member
@GromNaN GromNaN Jun 29, 2023

Choose a reason for hiding this comment

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

This was modified by #46901.

We need to keep the symfony option if we want developers to be able use to bash completion for different projects with different Symfony versions on the same computer. The completion script in symfony/console from 5.4.x to 6.1.x sets the option -S but not -a. If the option is removed, the _complete command will fail.

local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-S{{ VERSION }}")

We can fallback to api-version=1 when not specified.

Suggested change
$version = $input->getOption('api-version');
$version = $input->getOption('api-version', 1);

It would be better to make this change in a dedicated PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

If I understand correctly, here is what you suggest:

  • Create a PR targeting 6.4 as a new feature, making api-version fallback to 1
  • Update symfony option deprecation to be removed in 8.0, when 5.4 is EOLed.

I'll take care of this if it is what you meant

Copy link
Member

Choose a reason for hiding this comment

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

I think we should revert this change completely and leave it as-is. Notice the comment says "kept for compat" without deprecating the old one, which is intentional.

Shell completion scripts are global and there is no reason to make life extremely difficult for developers that work on several Symfony versions, some of which are older than 7.0, for the gain of removing these 2 LOC :)

Copy link
Member Author

Choose a reason for hiding this comment

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

This suits me fine. As you said, these are just 2 lines of code 😄 I reverted this change

Choose a reason for hiding this comment

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

Do I have something to do with this?

$this->assertSame('This is a command I wrote all by myself', $command->getDescription());
}

public function testAttributeOverridesProperty()
Copy link
Member
@nicolas-grekas nicolas-grekas Jun 29, 2023

Choose a reason for hiding this comment

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

this one is not legacy 🤔

Copy link
Member Author
@alexandre-daubois alexandre-daubois Jun 29, 2023

Choose a reason for hiding this comment

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

That's right, but now that $defaultName and $defaultDescription are removed, it feels irrelevant to me to have this test. I guess this should have been marked as legacy as well when the properties were deprecated? Or maybe am I missing something?

However, I may update this test with a command without the attribute and checking that the getDefaultName() and getDefaultDescription() are null

Copy link
Member

Choose a reason for hiding this comment

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

We should still keep it to ensure no regressions on the topic. (Removing depreciation annotations on the fixture)

Copy link
Member Author

Choose a reason for hiding this comment

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

That's reverted and updated 👍

@nicolas-grekas
Copy link
Member

Thank you @alexandre-daubois.

95F9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0