[Workflow] Fixed BC break with `MarkingStoreInterface::setMarking()`

This commit is contained in:
Grégoire Pineau 2019-03-12 10:26:19 +01:00
parent 29f81b003f
commit 7a94e5eaba
5 changed files with 35 additions and 4 deletions

View File

@ -116,3 +116,28 @@ Yaml
----
* Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0.
Workflow
--------
* `MarkingStoreInterface::setMarking()` will have a third argument in Symfony 5.0.
Before:
```php
class MyMarkingStore implements MarkingStoreInterface
{
public function setMarking($subject, Marking $marking)
{
}
}
```
After:
```php
class MyMarkingStore implements MarkingStoreInterface
{
public function setMarking($subject, Marking $marking , array $context = [])
{
}
}
```

View File

@ -84,7 +84,7 @@ Finder
Form
----
* Removed support for using the `format` option of `DateType` and `DateTimeType` when the `html5` option is enabled.
* Using names for buttons that do not start with a letter, a digit, or an underscore leads to an exception.
* Using names for buttons that do not contain only letters, digits, underscores, hyphens, and colons leads to an
@ -352,6 +352,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.
* `MarkingStoreInterface::setMarking()` has a third argument: `array $context = []`.
Yaml
----

View File

@ -37,6 +37,7 @@ interface MarkingStoreInterface
* Sets a Marking to a 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 = []*/);
}

View File

@ -45,8 +45,10 @@ class MultipleStateMarkingStore implements MarkingStoreInterface
/**
* {@inheritdoc}
*
* @param array $context Some context
*/
public function setMarking($subject, Marking $marking, array $context = [])
public function setMarking($subject, Marking $marking/*, array $context = []*/)
{
$this->propertyAccessor->setValue($subject, $this->property, $marking->getPlaces());
}

View File

@ -50,8 +50,10 @@ class SingleStateMarkingStore implements MarkingStoreInterface
/**
* {@inheritdoc}
*
* @param array $context Some context
*/
public function setMarking($subject, Marking $marking, array $context = [])
public function setMarking($subject, Marking $marking/*, array $context = []*/)
{
$this->propertyAccessor->setValue($subject, $this->property, key($marking->getPlaces()));
}