8000 Merge remote-tracking branch 'origin/4.3' into 4.4 · symfony/symfony@e95fa01 · GitHub
[go: up one dir, main page]

Skip to content

Commit e95fa01

Browse files
committed
Merge remote-tracking branch 'origin/4.3' into 4.4
* origin/4.3: [Workflow] Fixed BC break on WorkflowInterface
2 parents 76e5ea8 + abe2745 commit e95fa01

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

UPGRADE-4.3.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,28 @@ Workflow
242242
initial_marking: [draft]
243243
```
244244

245+
* `WorkflowInterface::apply()` will have a third argument in Symfony 5.0.
246+
247+
Before:
248+
```php
249+
class MyWorkflow implements WorkflowInterface
250+
{
251+
public function apply($subject, $transitionName)
252+
{
253+
}
254+
}
255+
```
256+
257+
After:
258+
```php
259+
class MyWorkflow implements WorkflowInterface
260+
{
261+
public function apply($subject, $transitionName, array $context = [])
262+
{
263+
}
264+
}
265+
```
266+
245267
* `MarkingStoreInterface::setMarking()` will have a third argument in Symfony 5.0.
246268

247269
Before:

UPGRADE-5.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ Workflow
611611
* `add` method has been removed use `addWorkflow` method in `Workflow\Registry` instead.
612612
* `SupportStrategyInterface` has been removed, use `WorkflowSupportStrategyInterface` instead.
613613
* `ClassInstanceSupportStrategy` has been removed, use `InstanceOfSupportStrategy` instead.
614+
* `WorkflowInterface::apply()` has a third argument: `array $context = []`.
614615
* `MarkingStoreInterface::setMarking()` has a third argument: `array $context = []`.
615616
* Removed support of `initial_place`. Use `initial_places` instead.
616617
* `MultipleStateMarkingStore` has been removed. Use `MethodMarkingStore` instead.

src/Symfony/Component/Workflow/MarkingStore/MarkingStoreInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ public function getMarking($subject);
3939
* @param object $subject A subject
4040
* @param array $context Some context
4141
*/
42-
public function setMarking($subject, Marking $marking /*, array $context = []*/);
42+
public function setMarking($subject, Marking $marking/*, array $context = []*/);
4343
}

src/Symfony/Component/Workflow/Workflow.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,13 @@ public function buildTransitionBlockerList($subject, string $transitionName): Tr
150150

151151
/**
152152
* {@inheritdoc}
153+
*
154+
* @param array $context Some context
153155
*/
154-
public function apply($subject, $transitionName, array $context = [])
156+
public function apply($subject, $transitionName/*, array $context = []*/)
155157
{
158+
$context = \func_get_args()[2] ?? [];
159+
156160
$marking = $this->getMarking($subject);
157161

158162
$transitionBlockerList = null;

src/Symfony/Component/Workflow/WorkflowInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ public function buildTransitionBlockerList($subject, string $transitionName): Tr
5353
*
5454
* @param object $subject A subject
5555
* @param string $transitionName A transition
56+
* @param array $context Some context
5657
*
5758
* @return Marking The new Marking
5859
*
5960
* @throws LogicException If the transition is not applicable
6061
*/
61-
public function apply($subject, $transitionName, array $context = []);
62+
public function apply($subject, $transitionName/*, array $context = []*/);
6263

6364
/**
6465
* Returns all enabled transitions.

0 commit comments

Comments
 (0)
0