Skip to content
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

[Workflow] Draft: Add Enum Support to Workflow component #48919

Open
wants to merge 2 commits into
base: 6.3
Choose a base branch
from

Conversation

bartrail
Copy link

@bartrail bartrail commented Jan 8, 2023

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #44211
License MIT
Doc PR symfony/symfony-docs#...

@carsonbot
Copy link

Hey!

To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?

Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

Cheers!

Carsonbot

@bartrail bartrail marked this pull request as ready for review Jan 8, 2023
@bartrail bartrail requested a review from lyrixx as a code owner Jan 8, 2023
@carsonbot carsonbot added this to the 6.3 milestone Jan 8, 2023
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.3 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@bartrail bartrail changed the title Draft: First draft of adding Enum Support to Workflow component Draft: Add Enum Support to Workflow component Jan 8, 2023
@@ -48,15 +48,15 @@ public function __construct(array $places, array $transitions, string|array $ini
}

/**
* @return string[]
* @return Place[]
Copy link
Member

Choose a reason for hiding this comment

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

Switching from strings to your new class everywhere will break a lot of applications that currently use the component. You'll need to find another way.

@carsonbot carsonbot changed the title Draft: Add Enum Support to Workflow component [Workflow] Draft: Add Enum Support to Workflow component Jan 9, 2023
@OskarStark
Copy link
Contributor

This was rejected in the past. I don't have the PR/issue at hand

@derrabus
Copy link
Member

derrabus commented Jan 9, 2023

This was rejected in the past. I don't have the PR/issue at hand

#44211, the issue is linked in the PR description. 🙂

The issue was closed after @lyrixx' assessment that implementing the feature is not worth the effort. A good PR could prove the opposite.

@OskarStark
Copy link
Contributor

Sorry, I overlooked the referenced issue.

A good PR could prove the opposite.

Sure, go ahead then 👍

@stof
Copy link
Member

stof commented Jan 9, 2023

This PR contains lots of BC breaks, and so it is a no-go as is. That's one of the reason why @lyrixx assessed that the feature is probably not worth the effort: you did less than half of the effort for now.
Side note: using UnitEnum::$name as fallback for BackedEnum::$value when an enum is not backed does not make sense. Names and values are not the same concept (and this probably indicates a bad integration of enums in the component)

@bartrail
Copy link
Author

bartrail commented Jan 9, 2023

This PR contains lots of BC breaks, and so it is a no-go as is. That's one of the reason why @lyrixx assessed that the feature is probably not worth the effort: you did less than half of the effort for now. Side note: using UnitEnum::$name as fallback for BackedEnum::$value when an enum is not backed does not make sense. Names and values are not the same concept (and this probably indicates a bad integration of enums in the component)

I just opened the PR as draft so nothing is finished for now :) I am sure aware of the BC breaks and most of the tests are failing. So I will have a closer look at the BC concerns.

Regarding the UnitEnum vs BackedEnum case, I have started with UnitEnum as the least common denominator, but realised quick that it requires some custom code in the used Enum which feels a bit clunky. I would suggest using BackedEnum because it's more feasible.

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.

Support Enum as workflow places
6 participants