-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Workflow] Removed deprecated features #22771
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
Conversation
----- | ||
|
||
* Removed `ValidateWorkflowsPass` | ||
* The `type` option of the `framework.workflows.*` configuration entries is `state_machine` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't you missing by default
in this sentence ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed ;) I will add it.
*/ | ||
public function add(Workflow $workflow, $supportStrategy) | ||
public function add(Workflow $workflow, SupportStrategyInterface $supportStrategy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the typehint is a BC break as the class/method was not final. Non-updated child classes will trigger a deprecation warning (see https://3v4l.org/KO9T1), and updated child class will be incompatible with 3.4. So this BC break does not have an upgrade path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there was a deprecation notice in 3.* and now it's 4.0 so we can broke the BC, right ?
And I agree there is no clean upgrade path. Users should just add this new type hint.
Do you think I should remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we can bump symfony to PHP 7.2 to get https://wiki.php.net/rfc/parameter-no-type-variance :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be possible to deprecate using something else than a SupportStrategyInterface
in 3.4 and add this type-hint for 4.0, I don't see the problem 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lyrixx:
To explain with more words:
Keep the add(Workflow $workflow, $supportStrategy)
for 3.x, but starting from 3.4, you can add this code in the add function:
public function add(Workflow $workflow, $supportStrategy)
{
if (!$supportStrategy instanceof SupportStrategyInterface) {
@trigger_error('Using a strategy that does not implement '.SupportStrategyInterface::class.' is deprecated since version 3.4 and will be removed in 4.0.', E_USER_DEPRECATED);
}
}
This is for 3.4
And for 4.0, you remove this deprecation and add the type-hint for SupportStrategyInterface
.
That's all, it allows users that extend this method to be warned that the signature will be changed as of 4.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pierstoval the issue about adding the typehint is not for people calling this code (this already has the proper deprecation). It is for people extending it (and indeed, this is solved on PHP 7.2+, which is a good news for our future)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1/ This is wrong. This is a real BC on 3.4 and this is strictly not possible to do that. We have to allow string argument to respect the BC promise
2/ There is already a deprecation notice in the 3.* branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pierstoval the issue is that changing the typehint does not allow them to support both 3.4 and 4.0 at the same time in their child class => no continuous upgrade path)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the new type hint, And I added it to the private method supports
@@ -1,6 +1,11 @@ | |||
CHANGELOG | |||
========= | |||
|
|||
4.4.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4.0.0
50df9f6
to
593fc09
Compare
593fc09
to
5a43888
Compare
… second parameter
…tion entries is `state_machine`
5a43888
to
3bed8f6
Compare
Thank you @lyrixx. |
This PR was squashed before being merged into the 4.0-dev branch (closes #22771). Discussion ---------- [Workflow] Removed deprecated features | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a --- Note: all commits are atomic Commits ------- 3bed8f6 [Workflow] The `type` option of the `framework.workflows.*` configuration entries is `state_machine` fd25777 [Workflow] Removed FrameworkBundle/DependencyInjection/Compiler/ValidateWorkflowsPass 1ccbe0b [Workflow] Removed class name support in `WorkflowRegistry::add()` as second parameter
Note: all commits are atomic