Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1ccbe0b

Browse filesBrowse files
committed
[Workflow] Removed class name support in WorkflowRegistry::add() as second parameter
1 parent 31f74ca commit 1ccbe0b
Copy full SHA for 1ccbe0b

File tree

Expand file treeCollapse file tree

3 files changed

+9
-30
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+9
-30
lines changed

‎src/Symfony/Component/Workflow/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.0.0
5+
-----
6+
7+
* Removed class name support in `WorkflowRegistry::add()` as second parameter.
8+
49
3.3.0
510
-----
611

‎src/Symfony/Component/Workflow/Registry.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/Registry.php
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Workflow;
1313

1414
use Symfony\Component\Workflow\Exception\InvalidArgumentException;
15-
use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy;
1615
use Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface;
1716

1817
/**
@@ -24,15 +23,13 @@ class Registry
2423
private $workflows = array();
2524

2625
/**
27-
* @param Workflow $workflow
28-
* @param string|SupportStrategyInterface $supportStrategy
26+
* @param Workflow $workflow
27+
* @param SupportStrategyInterface $supportStrategy
2928
*/
3029
public function add(Workflow $workflow, $supportStrategy)
3130
{
3231
if (!$supportStrategy instanceof SupportStrategyInterface) {
33-
@trigger_error('Support of class name string was deprecated after version 3.2 and won\'t work anymore in 4.0.', E_USER_DEPRECATED);
34-
35-
$supportStrategy = new ClassInstanceSupportStrategy($supportStrategy);
32+
throw new \InvalidArgumentException('The "supportStrategy" is not an instance of SupportStrategyInterface.');
3633
}
3734

3835
$this->workflows[] = array($workflow, $supportStrategy);
@@ -64,7 +61,7 @@ public function get($subject, $workflowName = null)
6461
return $matched;
6562
}
6663

67-
private function supports(Workflow $workflow, $supportStrategy, $subject, $workflowName)
64+
private function supports(Workflow $workflow, SupportStrategyInterface $supportStrategy, $subject, $workflowName)
6865
{
6966
if (null !== $workflowName && $workflowName !== $workflow->getName()) {
7067
return false;

‎src/Symfony/Component/Workflow/Tests/RegistryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Workflow/Tests/RegistryTest.php
-23Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,6 @@ public function testGetWithNoMatch()
6565
$this->assertSame('workflow1', $w1->getName());
6666
}
6767

68-
/**
69-
* @group legacy
70-
*/
71-
public function testGetWithSuccessLegacyStrategy()
72-
{
73-
$registry = new Registry();
74-
75-
$registry->add(new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow1'), Subject1::class);
76-
$registry->add(new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow2'), Subject2::class);
77-
78-
$workflow = $registry->get(new Subject1());
79-
$this->assertInstanceOf(Workflow::class, $workflow);
80-
$this->assertSame('workflow1', $workflow->getName());
81-
82-
$workflow = $registry->get(new Subject1(), 'workflow1');
83-
$this->assertInstanceOf(Workflow::class, $workflow);
84-
$this->assertSame('workflow1', $workflow->getName());
85-
86-
$workflow = $registry->get(new Subject2(), 'workflow2');
87-
$this->assertInstanceOf(Workflow::class, $workflow);
88-
$this->assertSame('workflow2', $workflow->getName());
89-
}
90-
9168
private function createSupportStrategy($supportedClassName)
9269
{
9370
$strategy = $this->getMockBuilder(SupportStrategyInterface::class)->getMock();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.