17
17
use Symfony \Component \Workflow \MarkingStore \MethodMarkingStore ;
18
18
use Symfony \Component \Workflow \Metadata \InMemoryMetadataStore ;
19
19
use Symfony \Component \Workflow \Registry ;
20
- use Symfony \Component \Workflow \SupportStrategy \ClassInstanceSupportStrategy ;
21
20
use Symfony \Component \Workflow \SupportStrategy \InstanceOfSupportStrategy ;
22
21
use Symfony \Component \Workflow \Transition ;
23
22
use Symfony \Component \Workflow \TransitionBlockerList ;
@@ -36,25 +35,19 @@ protected function setUp(): void
36
35
new Transition ('t2 ' , 'waiting_for_payment ' , 'processed ' ),
37
36
];
38
37
39
- $ metadataStore = null ;
40
- if (class_exists (InMemoryMetadataStore::class)) {
41
- $ transitionsMetadata = new \SplObjectStorage ();
42
- $ transitionsMetadata ->attach ($ this ->t1 , ['title ' => 't1 title ' ]);
43
- $ metadataStore = new InMemoryMetadataStore (
44
- ['title ' => 'workflow title ' ],
45
- ['orderer ' => ['title ' => 'ordered title ' ]],
46
- $ transitionsMetadata
47
- );
48
- }
38
+ $ transitionsMetadata = new \SplObjectStorage ();
39
+ $ transitionsMetadata ->attach ($ this ->t1 , ['title ' => 't1 title ' ]);
40
+ $ metadataStore = new InMemoryMetadataStore (
41
+ ['title ' => 'workflow title ' ],
42
+ ['orderer ' => ['title ' => 'ordered title ' ]],
43
+ $ transitionsMetadata
44
+ );
49
45
$ definition = new Definition ($ places , $ transitions , null , $ metadataStore );
50
46
$ workflow = new Workflow ($ definition , new MethodMarkingStore ());
51
47
52
48
$ registry = new Registry ();
53
- $ addWorkflow = method_exists ($ registry , 'addWorkflow ' ) ? 'addWorkflow ' : 'add ' ;
54
- $ supportStrategy = class_exists (InstanceOfSupportStrategy::class)
55
- ? new InstanceOfSupportStrategy (Subject::class)
56
- : new ClassInstanceSupportStrategy (Subject::class);
57
- $ registry ->$ addWorkflow ($ workflow , $ supportStrategy );
49
+ $ supportStrategy = new InstanceOfSupportStrategy (Subject::class);
50
+ $ registry ->addWorkflow ($ workflow , $ supportStrategy );
58
51
$ this ->extension = new WorkflowExtension ($ registry );
59
52
}
60
53
0 commit comments