@@ -27,7 +27,7 @@ public function testGetMarkingWithInvalidStoreReturn()
27
27
{
28
28
$ subject = new \stdClass ();
29
29
$ subject ->marking = null ;
30
- $ workflow = new Workflow (new Definition (array (), array () ), $ this ->getMockBuilder (MarkingStoreInterface::class)->getMock ());
30
+ $ workflow = new Workflow (new Definition ([], [] ), $ this ->getMockBuilder (MarkingStoreInterface::class)->getMock ());
31
31
32
32
$ workflow ->getMarking ($ subject );
33
33
}
@@ -40,7 +40,7 @@ public function testGetMarkingWithEmptyDefinition()
40
40
{
41
41
$ subject = new \stdClass ();
42
42
$ subject ->marking = null ;
43
- $ workflow = new Workflow (new Definition (array (), array () ), new MultipleStateMarkingStore ());
43
+ $ workflow = new Workflow (new Definition ([], [] ), new MultipleStateMarkingStore ());
44
44
45
45
$ workflow ->getMarking ($ subject );
46
46
}
@@ -52,8 +52,8 @@ public function testGetMarkingWithEmptyDefinition()
52
52
public function testGetMarkingWithImpossiblePlace ()
53
53
{
54
54
$ subject = new \stdClass ();
55
- $ subject ->marking = array ( 'nope ' => 1 ) ;
56
- $ workflow = new Workflow (new Definition (array (), array () ), new MultipleStateMarkingStore ());
55
+ $ subject ->marking = [ 'nope ' => 1 ] ;
56
+ $ workflow = new Workflow (new Definition ([], [] ), new MultipleStateMarkingStore ());
57
57
58
58
$ workflow ->getMarking ($ subject );
59
59
}
@@ -69,15 +69,15 @@ public function testGetMarkingWithEmptyInitialMarking()
69
69
70
70
$ this ->assertInstanceOf (Marking::class, $ marking );
71
71
$ this ->assertTrue ($ marking ->has ('a ' ));
72
- $ this ->assertSame (array ( 'a ' => 1 ) , $ subject ->marking );
72
+ $ this ->assertSame ([ 'a ' => 1 ] , $ subject ->marking );
73
73
}
74
74
75
75
public function testGetMarkingWithExistingMarking ()
76
76
{
77
77
$ definition = $ this ->createComplexWorkflowDefinition ();
78
78
$ subject = new \stdClass ();
79
79
$ subject ->marking = null ;
80
- $ subject ->marking = array ( 'b ' => 1 , 'c ' => 1 ) ;
80
+ $ subject ->marking = [ 'b ' => 1 , 'c ' => 1 ] ;
81
81
$ workflow = new Workflow ($ definition , new MultipleStateMarkingStore ());
82
82
83
83
$ marking = $ workflow ->getMarking ($ subject );
@@ -107,19 +107,19 @@ public function testCan()
107
107
$ this ->assertTrue ($ workflow ->can ($ subject , 't1 ' ));
108
108
$ this ->assertFalse ($ workflow ->can ($ subject , 't2 ' ));
109
109
110
- $ subject ->marking = array ( 'b ' => 1 ) ;
110
+ $ subject ->marking = [ 'b ' => 1 ] ;
111
111
112
112
$ this ->assertFalse ($ workflow ->can ($ subject , 't1 ' ));
113
113
// In a workflow net, all "from" places should contain a token to enable
114
114
// the transition.
115
115
$ this ->assertFalse ($ workflow ->can ($ subject , 't2 ' ));
116
116
117
- $ subject ->marking = array ( 'b ' => 1 , 'c ' => 1 ) ;
117
+ $ subject ->marking = [ 'b ' => 1 , 'c ' => 1 ] ;
118
118
119
119
$ this ->assertFalse ($ workflow ->can ($ subject , 't1 ' ));
120
120
$ this ->assertTrue ($ workflow ->can ($ subject , 't2 ' ));
121
121
122
- $ subject ->marking = array ( 'f ' => 1 ) ;
122
+ $ subject ->marking = [ 'f ' => 1 ] ;
123
123
124
124
$ this ->assertFalse ($ workflow ->can ($ subject , 't5 ' ));
125
125
$ this ->assertTrue ($ workflow ->can ($ subject , 't6 ' ));
@@ -145,7 +145,7 @@ public function testCanDoesNotTriggerGuardEventsForNotEnabledTransitions()
145
145
$ subject = new \stdClass ();
146
146
$ subject ->marking = null ;
147
147
148
- $ dispatchedEvents = array () ;
148
+ $ dispatchedEvents = [] ;
149
149
$ eventDispatcher = new EventDispatcher ();
150
150
151
151
$ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ eventDispatcher , 'workflow_name ' );
@@ -161,7 +161,7 @@ public function testCanDoesNotTriggerGuardEventsForNotEnabledTransitions()
161
161
162
162
$ workflow ->can ($ subject , 't3 ' );
163
163
164
- $ this ->assertSame (array ( 'workflow_name.guard.t3 ' ) , $ dispatchedEvents );
164
+ $ this ->assertSame ([ 'workflow_name.guard.t3 ' ] , $ dispatchedEvents );
165
165
}
166
166
167
167
public function testCanWithSameNameTransition ()
@@ -175,7 +175,7 @@ public function testCanWithSameNameTransition()
175
175
$ this ->assertFalse ($ workflow ->can ($ subject , 'b_to_c ' ));
176
176
$ this ->assertFalse ($ workflow ->can ($ subject , 'to_a ' ));
177
177
178
- $ subject ->marking = array ( 'b ' => 1 ) ;
178
+ $ subject ->marking = [ 'b ' => 1 ] ;
179
179
$ this ->assertFalse ($ workflow ->can ($ subject , 'a_to_bc ' ));
180
180
$ this ->assertTrue ($ workflow ->can ($ subject , 'b_to_c ' ));
181
181
$ this ->assertTrue ($ workflow ->can ($ subject , 'to_a ' ));
@@ -205,17 +205,17 @@ public function testBuildTransitionBlockerList()
205
205
$ this ->assertTrue ($ workflow ->buildTransitionBlockerList ($ subject , 't1 ' )->isEmpty ());
206
206
$ this ->assertFalse ($ workflow ->buildTransitionBlockerList ($ subject , 't2 ' )->isEmpty ());
207
207
208
- $ subject ->marking = array ( 'b ' => 1 ) ;
208
+ $ subject ->marking = [ 'b ' => 1 ] ;
209
209
210
210
$ this ->assertFalse ($ workflow ->buildTransitionBlockerList ($ subject , 't1 ' )->isEmpty ());
211
211
$ this ->assertFalse ($ workflow ->buildTransitionBlockerList ($ subject , 't2 ' )->isEmpty ());
212
212
213
- $ subject ->marking = array ( 'b ' => 1 , 'c ' => 1 ) ;
213
+ $ subject ->marking = [ 'b ' => 1 , 'c ' => 1 ] ;
214
214
215
215
$ this ->assertFalse ($ workflow ->buildTransitionBlockerList ($ subject , 't1 ' )->isEmpty ());
216
216
$ this ->assertTrue ($ workflow ->buildTransitionBlockerList ($ subject , 't2 ' )->isEmpty ());
217
217
218
- $ subject ->marking = array ( 'f ' => 1 ) ;
218
+ $ subject ->marking = [ 'f ' => 1 ] ;
219
219
220
220
$ this ->assertFalse ($ workflow ->buildTransitionBlockerList ($ subject , 't5 ' )->isEmpty ());
221
221
$ this ->assertTrue ($ workflow ->buildTransitionBlockerList ($ subject , 't6 ' )->isEmpty ());
@@ -354,10 +354,10 @@ public function testApplyWithSameNameTransition()
354
354
public function testApplyWithSameNameTransition2 ()
355
355
{
356
356
$ subject = new \stdClass ();
357
- $ subject ->marking = array ( 'a ' => 1 , 'b ' => 1 ) ;
357
+ $ subject ->marking = [ 'a ' => 1 , 'b ' => 1 ] ;
358
358
359
359
$ places = range ('a ' , 'd ' );
360
- $ transitions = array () ;
360
+ $ transitions = [] ;
361
361
$ transitions [] = new Transition ('t ' , 'a ' , 'c ' );
362
362
$ transitions [] = new Transition ('t ' , 'b ' , 'd ' );
363
363
$ definition = new Definition ($ places , $ transitions );
@@ -374,10 +374,10 @@ public function testApplyWithSameNameTransition2()
374
374
public function testApplyWithSameNameTransition3 ()
375
375
{
376
376
$ subject = new \stdClass ();
377
- $ subject ->marking = array ( 'a ' => 1 ) ;
377
+ $ subject ->marking = [ 'a ' => 1 ] ;
378
378
379
379
$ places = range ('a ' , 'd ' );
380
- $ transitions = array () ;
380
+ $ transitions = [] ;
381
381
$ transitions [] = new Transition ('t ' , 'a ' , 'b ' );
382
382
$ transitions [] = new Transition ('t ' , 'b ' , 'c ' );
383
383
$ transitions [] = new Transition ('t ' , 'c ' , 'd ' );
@@ -398,7 +398,7 @@ public function testApplyWithEventDispatcher()
398
398
$ eventDispatcher = new EventDispatcherMock ();
399
399
$ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ eventDispatcher , 'workflow_name ' );
400
400
401
- $ eventNameExpected = array (
401
+ $ eventNameExpected = [
402
402
'workflow.entered ' ,
403
403
'workflow.workflow_name.entered ' ,
404
404
'workflow.guard ' ,
@@ -428,7 +428,7 @@ public function testApplyWithEventDispatcher()
428
428
'workflow.workflow_name.guard ' ,
429
429
'workflow.workflow_name.guard.t2 ' ,
430
430
'workflow.workflow_name.announce.t2 ' ,
431
- ) ;
431
+ ] ;
432
432
433
433
$ marking = $ workflow ->apply ($ subject , 't1 ' );
434
434
@@ -448,14 +448,14 @@ public function testEventName()
448
448
$ this ->assertEquals ($ name , $ event ->getWorkflowName ());
449
449
};
450
450
451
- $ eventNames = array (
451
+ $ eventNames = [
452
452
'workflow.guard ' ,
453
453
'workflow.leave ' ,
454
454
'workflow.transition ' ,
455
455
'workflow.enter ' ,
456
456
'workflow.entered ' ,
457
457
'workflow.announce ' ,
458
- ) ;
458
+ ] ;
459
459
460
460
foreach ($ eventNames as $ eventName ) {
461
461
$ dispatcher ->addListener ($ eventName , $ assertWorkflowName );
@@ -466,20 +466,20 @@ public function testEventName()
466
466
467
467
public function testMarkingStateOnApplyWithEventDispatcher ()
468
468
{
469
- $ definition = new Definition (range ('a ' , 'f ' ), array ( new Transition ('t ' , range ('a ' , 'c ' ), range ('d ' , 'f ' ))) );
469
+ $ definition = new Definition (range ('a ' , 'f ' ), [ new Transition ('t ' , range ('a ' , 'c ' ), range ('d ' , 'f ' ))] );
470
470
471
471
$ subject = new \stdClass ();
472
- $ subject ->marking = array ( 'a ' => 1 , 'b ' => 1 , 'c ' => 1 ) ;
472
+ $ subject ->marking = [ 'a ' => 1 , 'b ' => 1 , 'c ' => 1 ] ;
473
473
474
474
$ dispatcher = new EventDispatcher ();
475
475
476
476
$ workflow = new Workflow ($ definition , new MultipleStateMarkingStore (), $ dispatcher , 'test ' );
477
477
478
478
$ assertInitialState = function (Event $ event ) {
479
- $ this ->assertEquals (new Marking (array ( 'a ' => 1 , 'b ' => 1 , 'c ' => 1 ) ), $ event ->getMarking ());
479
+ $ this ->assertEquals (new Marking ([ 'a ' => 1 , 'b ' => 1 , 'c ' => 1 ] ), $ event ->getMarking ());
480
480
};
481
481
$ assertTransitionState = function (Event $ event ) {
482
- $ this ->assertEquals (new Marking (array () ), $ event ->getMarking ());
482
+ $ this ->assertEquals (new Marking ([] ), $ event ->getMarking ());
483
483
};
484
484
485
485
$ dispatcher ->addListener ('workflow.leave ' , $ assertInitialState );
@@ -512,13 +512,13 @@ public function testGetEnabledTransitions()
512
512
513
513
$ this ->assertEmpty ($ workflow ->getEnabledTransitions ($ subject ));
514
514
515
- $ subject ->marking = array ( 'd ' => 1 ) ;
515
+ $ subject ->marking = [ 'd ' => 1 ] ;
516
516
$ transitions = $ workflow ->getEnabledTransitions ($ subject );
517
517
$ this ->assertCount (2 , $ transitions );
518
518
$ this ->assertSame ('t3 ' , $ transitions [0 ]->getName ());
519
519
$ this ->assertSame ('t4 ' , $ transitions [1 ]->getName ());
520
520
521
- $ subject ->marking = array ( 'c ' => 1 , 'e ' => 1 ) ;
521
+ $ subject ->marking = [ 'c ' => 1 , 'e ' => 1 ] ;
522
522
$ transitions = $ workflow ->getEnabledTransitions ($ subject );
523
523
$ this ->assertCount (1 , $ transitions );
524
524
$ this ->assertSame ('t5 ' , $ transitions [0 ]->getName ());
@@ -535,7 +535,7 @@ public function testGetEnabledTransitionsWithSameNameTransition()
535
535
$ this ->assertCount (1 , $ transitions );
536
536
$ this ->assertSame ('a_to_bc ' , $ transitions [0 ]->getName ());
537
537
538
- $ subject ->marking = array ( 'b ' => 1 , 'c ' => 1 ) ;
538
+ $ subject ->marking = [ 'b ' => 1 , 'c ' => 1 ] ;
539
539
$ transitions = $ workflow ->getEnabledTransitions ($ subject );
540
540
$ this ->assertCount (3 , $ transitions );
541
541
$ this ->assertSame ('b_to_c ' , $ transitions [0 ]->getName ());
@@ -546,7 +546,7 @@ public function testGetEnabledTransitionsWithSameNameTransition()
546
546
547
547
class EventDispatcherMock implements \Symfony \Component \EventDispatcher \EventDispatcherInterface
548
548
{
549
- public $ dispatchedEvents = array () ;
549
+ public $ dispatchedEvents = [] ;
550
550
551
551
public function dispatch ($ eventName , \Symfony \Component \EventDispatcher \Event $ event = null )
552
552
{
0 commit comments