bug #33835 [Workflow] Fixed BC break on WorkflowInterface (lyrixx)

This PR was merged into the 4.3 branch.

Discussion
----------

[Workflow] Fixed BC break on WorkflowInterface

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

1eb10b996a [Workflow] Fixed BC break on WorkflowInterface
This commit is contained in:
Grégoire Pineau 2019-10-03 18:32:51 +02:00
commit abe2745b15
5 changed files with 31 additions and 3 deletions

View File

@ -242,6 +242,28 @@ Workflow
initial_marking: [draft]
```
* `WorkflowInterface::apply()` will have a third argument in Symfony 5.0.
Before:
```php
class MyWorkflow implements WorkflowInterface
{
public function apply($subject, $transitionName)
{
}
}
```
After:
```php
class MyWorkflow implements WorkflowInterface
{
public function apply($subject, $transitionName, array $context = [])
{
}
}
```
* `MarkingStoreInterface::setMarking()` will have a third argument in Symfony 5.0.
Before:

View File

@ -414,6 +414,7 @@ Workflow
* `add` method has been removed use `addWorkflow` method in `Workflow\Registry` instead.
* `SupportStrategyInterface` has been removed, use `WorkflowSupportStrategyInterface` instead.
* `ClassInstanceSupportStrategy` has been removed, use `InstanceOfSupportStrategy` instead.
* `WorkflowInterface::apply()` has a third argument: `array $context = []`.
* `MarkingStoreInterface::setMarking()` has a third argument: `array $context = []`.
* Removed support of `initial_place`. Use `initial_places` instead.
* `MultipleStateMarkingStore` has been removed. Use `MethodMarkingStore` instead.

View File

@ -39,5 +39,5 @@ interface MarkingStoreInterface
* @param object $subject A subject
* @param array $context Some context
*/
public function setMarking($subject, Marking $marking /*, array $context = []*/);
public function setMarking($subject, Marking $marking/*, array $context = []*/);
}

View File

@ -150,9 +150,13 @@ class Workflow implements WorkflowInterface
/**
* {@inheritdoc}
*
* @param array $context Some context
*/
public function apply($subject, $transitionName, array $context = [])
public function apply($subject, $transitionName/*, array $context = []*/)
{
$context = \func_get_args()[2] ?? [];
$marking = $this->getMarking($subject);
$transitionBlockerList = null;

View File

@ -53,12 +53,13 @@ interface WorkflowInterface
*
* @param object $subject A subject
* @param string $transitionName A transition
* @param array $context Some context
*
* @return Marking The new Marking
*
* @throws LogicException If the transition is not applicable
*/
public function apply($subject, $transitionName, array $context = []);
public function apply($subject, $transitionName/*, array $context = []*/);
/**
* Returns all enabled transitions.