8000 [Workflow] Fixed BC break on WorkflowInterface by lyrixx · Pull Request #33835 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Workflow] Fixed BC break on WorkflowInterface #33835

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
Oct 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions UPGRADE-4.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ public function getMarking($subject);
* @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 = []*/);
}
6 changes: 5 additions & 1 deletion src/Symfony/Component/Workflow/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,13 @@ public function buildTransitionBlockerList($subject, string $transitionName): Tr

/**
* {@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;
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Workflow/WorkflowInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ public function buildTransitionBlockerList($subject, string $transitionName): Tr
*
* @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.
Expand Down
0