Skip to content

[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

Merged
merged 3 commits into from
May 19, 2017

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented May 19, 2017

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

-----

* Removed `ValidateWorkflowsPass`
* The `type` option of the `framework.workflows.*` configuration entries is `state_machine`
Copy link
Member

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 ?

Copy link
Member Author

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)
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member Author

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

Copy link
Contributor

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 😕

Copy link
Contributor

@Pierstoval Pierstoval May 19, 2017

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

Copy link
Member

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)

Copy link
Member Author

@lyrixx lyrixx May 19, 2017

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

Copy link
Member

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)

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 removed the new type hint, And I added it to the private method supports

@@ -1,6 +1,11 @@
CHANGELOG
=========

4.4.0
Copy link
Member

Choose a reason for hiding this comment

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

4.0.0

@lyrixx lyrixx force-pushed the workflow-spring-cleaning branch from 50df9f6 to 593fc09 Compare May 19, 2017 09:49
@nicolas-grekas nicolas-grekas added this to the 4.0 milestone May 19, 2017
@lyrixx lyrixx force-pushed the workflow-spring-cleaning branch from 593fc09 to 5a43888 Compare May 19, 2017 14:17
@lyrixx lyrixx force-pushed the workflow-spring-cleaning branch from 5a43888 to 3bed8f6 Compare May 19, 2017 15:59
@fabpot
Copy link
Member

fabpot commented May 19, 2017

Thank you @lyrixx.

@fabpot fabpot merged commit 3bed8f6 into symfony:master May 19, 2017
fabpot added a commit that referenced this pull request May 19, 2017
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
@lyrixx lyrixx deleted the workflow-spring-cleaning branch May 20, 2017 12:30
@fabpot fabpot mentioned this pull request Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants