Skip to content

Commit d1d4e07

Browse files
committed
fixed CS
1 parent b59185a commit d1d4e07

12 files changed

+101
-101
lines changed

Dumper/PlantUmlDumper.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,24 @@ class PlantUmlDumper implements DumperInterface
3131

3232
const STATEMACHINE_TRANSITION = 'arrow';
3333
const WORKFLOW_TRANSITION = 'square';
34-
const TRANSITION_TYPES = array(self::STATEMACHINE_TRANSITION, self::WORKFLOW_TRANSITION);
35-
const DEFAULT_OPTIONS = array(
36-
'skinparams' => array(
34+
const TRANSITION_TYPES = [self::STATEMACHINE_TRANSITION, self::WORKFLOW_TRANSITION];
35+
const DEFAULT_OPTIONS = [
36+
'skinparams' => [
3737
'titleBorderRoundCorner' => 15,
3838
'titleBorderThickness' => 2,
39-
'state' => array(
39+
'state' => [
4040
'BackgroundColor'.self::INITIAL => '#87b741',
4141
'BackgroundColor'.self::MARKED => '#3887C6',
4242
'BorderColor' => '#3887C6',
4343
'BorderColor'.self::MARKED => 'Black',
4444
'FontColor'.self::MARKED => 'White',
45-
),
46-
'agent' => array(
45+
],
46+
'agent' => [
4747
'BackgroundColor' => '#ffffff',
4848
'BorderColor' => '#3887C6',
49-
),
50-
),
51-
);
49+
],
50+
],
51+
];
5252

5353
private $transitionType = self::STATEMACHINE_TRANSITION;
5454

@@ -60,7 +60,7 @@ public function __construct(string $transitionType = null)
6060
$this->transitionType = $transitionType;
6161
}
6262

63-
public function dump(Definition $definition, Marking $marking = null, array $options = array()): string
63+
public function dump(Definition $definition, Marking $marking = null, array $options = []): string
6464
{
6565
$options = array_replace_recursive(self::DEFAULT_OPTIONS, $options);
6666
$code = $this->initialize($options);
@@ -84,10 +84,10 @@ public function dump(Definition $definition, Marking $marking = null, array $opt
8484
foreach ($transition->getTos() as $to) {
8585
$toEscaped = $this->escape($to);
8686
if ($this->isWorkflowTransitionType()) {
87-
$lines = array(
87+
$lines = [
8888
"$fromEscaped --> $transitionEscaped",
8989
"$transitionEscaped --> $toEscaped",
90-
);
90+
];
9191
foreach ($lines as $line) {
9292
if (!\in_array($line, $code)) {
9393
$code[] = $line;
@@ -128,7 +128,7 @@ private function getLines(array $code): string
128128

129129
private function initialize(array $options): array
130130
{
131-
$code = array();
131+
$code = [];
132132
if (isset($options['title'])) {
133133
$code[] = "title {$options['title']}";
134134
}

Metadata/InMemoryMetadataStore.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class InMemoryMetadataStore implements MetadataStoreInterface
2424
private $placesMetadata;
2525
private $transitionsMetadata;
2626

27-
public function __construct(array $workflowMetadata = array(), array $placesMetadata = array(), \SplObjectStorage $transitionsMetadata = null)
27+
public function __construct(array $workflowMetadata = [], array $placesMetadata = [], \SplObjectStorage $transitionsMetadata = null)
2828
{
2929
$this->workflowMetadata = $workflowMetadata;
3030
$this->placesMetadata = $placesMetadata;
@@ -38,11 +38,11 @@ public function getWorkflowMetadata(): array
3838

3939
public function getPlaceMetadata(string $place): array
4040
{
41-
return $this->placesMetadata[$place] ?? array();
41+
return $this->placesMetadata[$place] ?? [];
4242
}
4343

4444
public function getTransitionMetadata(Transition $transition): array
4545
{
46-
return $this->transitionsMetadata[$transition] ?? array();
46+
return $this->transitionsMetadata[$transition] ?? [];
4747
}
4848
}

Registry.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class Registry
2323
{
24-
private $workflows = array();
24+
private $workflows = [];
2525

2626
/**
2727
* @param Workflow $workflow
@@ -32,12 +32,12 @@ class Registry
3232
public function add(Workflow $workflow, $supportStrategy)
3333
{
3434
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use addWorkflow() instead.', __METHOD__), E_USER_DEPRECATED);
35-
$this->workflows[] = array($workflow, $supportStrategy);
35+
$this->workflows[] = [$workflow, $supportStrategy];
3636
}
3737

3838
public function addWorkflow(WorkflowInterface $workflow, WorkflowSupportStrategyInterface $supportStrategy)
3939
{
40-
$this->workflows[] = array($workflow, $supportStrategy);
40+
$this->workflows[] = [$workflow, $supportStrategy];
4141
}
4242

4343
/**
@@ -73,7 +73,7 @@ public function get($subject, $workflowName = null)
7373
*/
7474
public function all($subject): array
7575
{
76-
$matched = array();
76+
$matched = [];
7777
foreach ($this->workflows as list($workflow, $supportStrategy)) {
7878
if ($supportStrategy->supports($workflow, $subject)) {
7979
$matched[] = $workflow;

Tests/DefinitionBuilderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class DefinitionBuilderTest extends TestCase
1111
{
1212
public function testSetInitialPlace()
1313
{
14-
$builder = new DefinitionBuilder(array('a', 'b'));
14+
$builder = new DefinitionBuilder(['a', 'b']);
1515
$builder->setInitialPlace('b');
1616
$definition = $builder->build();
1717

@@ -24,7 +24,7 @@ public function testAddTransition()
2424

2525
$transition0 = new Transition('name0', $places[0], $places[1]);
2626
$transition1 = new Transition('name1', $places[0], $places[1]);
27-
$builder = new DefinitionBuilder($places, array($transition0));
27+
$builder = new DefinitionBuilder($places, [$transition0]);
2828
$builder->addTransition($transition1);
2929

3030
$definition = $builder->build();
@@ -36,7 +36,7 @@ public function testAddTransition()
3636

3737
public function testAddPlace()
3838
{
39-
$builder = new DefinitionBuilder(array('a'), array());
39+
$builder = new DefinitionBuilder(['a'], []);
4040
$builder->addPlace('b');
4141

4242
$definition = $builder->build();
@@ -48,7 +48,7 @@ public function testAddPlace()
4848

4949
public function testSetMetadataStore()
5050
{
51-
$builder = new DefinitionBuilder(array('a'));
51+
$builder = new DefinitionBuilder(['a']);
5252
$metadataStore = new InMemoryMetadataStore();
5353
$builder->setMetadataStore($metadataStore);
5454
$definition = $builder->build();

Tests/DefinitionTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class DefinitionTest extends TestCase
1111
public function testAddPlaces()
1212
{
1313
$places = range('a', 'e');
14-
$definition = new Definition($places, array());
14+
$definition = new Definition($places, []);
1515

1616
$this->assertCount(5, $definition->getPlaces());
1717

@@ -21,7 +21,7 @@ public function testAddPlaces()
2121
public function testSetInitialPlace()
2222
{
2323
$places = range('a', 'e');
24-
$definition = new Definition($places, array(), $places[3]);
24+
$definition = new Definition($places, [], $places[3]);
2525

2626
$this->assertEquals($places[3], $definition->getInitialPlace());
2727
}
@@ -32,15 +32,15 @@ public function testSetInitialPlace()
3232
*/
3333
public function testSetInitialPlaceAndPlaceIsNotDefined()
3434
{
35-
$definition = new Definition(array(), array(), 'd');
35+
$definition = new Definition([], [], 'd');
3636
}
3737

3838
public function testAddTransition()
3939
{
4040
$places = range('a', 'b');
4141

4242
$transition = new Transition('name', $places[0], $places[1]);
43-
$definition = new Definition($places, array($transition));
43+
$definition = new Definition($places, [$transition]);
4444

4545
$this->assertCount(1, $definition->getTransitions());
4646
$this->assertSame($transition, $definition->getTransitions()[0]);
@@ -54,7 +54,7 @@ public function testAddTransitionAndFromPlaceIsNotDefined()
5454
{
5555
$places = range('a', 'b');
5656

57-
new Definition($places, array(new Transition('name', 'c', $places[1])));
57+
new Definition($places, [new Transition('name', 'c', $places[1])]);
5858
}
5959

6060
/**
@@ -65,6 +65,6 @@ public function testAddTransitionAndToPlaceIsNotDefined()
6565
{
6666
$places = range('a', 'b');
6767

68-
new Definition($places, array(new Transition('name', $places[0], 'c')));
68+
new Definition($places, [new Transition('name', $places[0], 'c')]);
6969
}
7070
}

Tests/Dumper/PlantUmlDumperTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PlantUmlDumperTest extends TestCase
2525
public function testDumpWorkflowWithoutMarking($definition, $marking, $expectedFileName, $title)
2626
{
2727
$dumper = new PlantUmlDumper(PlantUmlDumper::WORKFLOW_TRANSITION);
28-
$dump = $dumper->dump($definition, $marking, array('title' => $title));
28+
$dump = $dumper->dump($definition, $marking, ['title' => $title]);
2929
// handle windows, and avoid to create more fixtures
3030
$dump = str_replace(PHP_EOL, "\n", $dump.PHP_EOL);
3131
$file = $this->getFixturePath($expectedFileName, PlantUmlDumper::WORKFLOW_TRANSITION);
@@ -34,12 +34,12 @@ public function testDumpWorkflowWithoutMarking($definition, $marking, $expectedF
3434

3535
public function provideWorkflowDefinitionWithoutMarking()
3636
{
37-
yield array($this->createSimpleWorkflowDefinition(), null, 'simple-workflow-nomarking', 'SimpleDiagram');
38-
yield array($this->createComplexWorkflowDefinition(), null, 'complex-workflow-nomarking', 'ComplexDiagram');
39-
$marking = new Marking(array('b' => 1));
40-
yield array($this->createSimpleWorkflowDefinition(), $marking, 'simple-workflow-marking', 'SimpleDiagram');
41-
$marking = new Marking(array('c' => 1, 'e' => 1));
42-
yield array($this->createComplexWorkflowDefinition(), $marking, 'complex-workflow-marking', 'ComplexDiagram');
37+
yield [$this->createSimpleWorkflowDefinition(), null, 'simple-workflow-nomarking', 'SimpleDiagram'];
38+
yield [$this->createComplexWorkflowDefinition(), null, 'complex-workflow-nomarking', 'ComplexDiagram'];
39+
$marking = new Marking(['b' => 1]);
40+
yield [$this->createSimpleWorkflowDefinition(), $marking, 'simple-workflow-marking', 'SimpleDiagram'];
41+
$marking = new Marking(['c' => 1, 'e' => 1]);
42+
yield [$this->createComplexWorkflowDefinition(), $marking, 'complex-workflow-marking', 'ComplexDiagram'];
4343
}
4444

4545
/**
@@ -48,7 +48,7 @@ public function provideWorkflowDefinitionWithoutMarking()
4848
public function testDumpStateMachineWithoutMarking($definition, $marking, $expectedFileName, $title)
4949
{
5050
$dumper = new PlantUmlDumper(PlantUmlDumper::STATEMACHINE_TRANSITION);
51-
$dump = $dumper->dump($definition, $marking, array('title' => $title));
51+
$dump = $dumper->dump($definition, $marking, ['title' => $title]);
5252
// handle windows, and avoid to create more fixtures
5353
$dump = str_replace(PHP_EOL, "\n", $dump.PHP_EOL);
5454
$file = $this->getFixturePath($expectedFileName, PlantUmlDumper::STATEMACHINE_TRANSITION);
@@ -57,9 +57,9 @@ public function testDumpStateMachineWithoutMarking($definition, $marking, $expec
5757

5858
public function provideStateMachineDefinitionWithoutMarking()
5959
{
60-
yield array($this->createComplexStateMachineDefinition(), null, 'complex-state-machine-nomarking', 'SimpleDiagram');
61-
$marking = new Marking(array('c' => 1, 'e' => 1));
62-
yield array($this->createComplexStateMachineDefinition(), $marking, 'complex-state-machine-marking', 'SimpleDiagram');
60+
yield [$this->createComplexStateMachineDefinition(), null, 'complex-state-machine-nomarking', 'SimpleDiagram'];
61+
$marking = new Marking(['c' => 1, 'e' => 1]);
62+
yield [$this->createComplexStateMachineDefinition(), $marking, 'complex-state-machine-marking', 'SimpleDiagram'];
6363
}
6464

6565
private function getFixturePath($name, $transitionType)

Tests/Metadata/InMemoryMetadataStoreTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ class InMemoryMetadataStoreTest extends TestCase
1616

1717
protected function setUp()
1818
{
19-
$workflowMetadata = array(
19+
$workflowMetadata = [
2020
'title' => 'workflow title',
21-
);
22-
$placesMetadata = array(
23-
'place_a' => array(
21+
];
22+
$placesMetadata = [
23+
'place_a' => [
2424
'title' => 'place_a title',
25-
),
26-
);
25+
],
26+
];
2727
$transitionsMetadata = new \SplObjectStorage();
28-
$this->transition = new Transition('transition_1', array(), array());
29-
$transitionsMetadata[$this->transition] = array(
28+
$this->transition = new Transition('transition_1', [], []);
29+
$transitionsMetadata[$this->transition] = [
3030
'title' => 'transition_1 title',
31-
);
31+
];
3232

3333
$this->store = new InMemoryMetadataStore($workflowMetadata, $placesMetadata, $transitionsMetadata);
3434
}
@@ -42,7 +42,7 @@ public function testGetWorkflowMetadata()
4242
public function testGetUnexistingPlaceMetadata()
4343
{
4444
$metadataBag = $this->store->getPlaceMetadata('place_b');
45-
$this->assertSame(array(), $metadataBag);
45+
$this->assertSame([], $metadataBag);
4646
}
4747

4848
public function testGetExistingPlaceMetadata()
@@ -53,8 +53,8 @@ public function testGetExistingPlaceMetadata()
5353

5454
public function testGetUnexistingTransitionMetadata()
5555
{
56-
$metadataBag = $this->store->getTransitionMetadata(new Transition('transition_2', array(), array()));
57-
$this->assertSame(array(), $metadataBag);
56+
$metadataBag = $this->store->getTransitionMetadata(new Transition('transition_2', [], []));
57+
$this->assertSame([], $metadataBag);
5858
}
5959

6060
public function testGetExistingTransitionMetadata()
@@ -72,7 +72,7 @@ public function testGetMetadata()
7272
$this->assertNull($this->store->getMetadata('description', 'place_b'));
7373
$this->assertSame('transition_1 title', $this->store->getMetadata('title', $this->transition));
7474
$this->assertNull($this->store->getMetadata('description', $this->transition));
75-
$this->assertNull($this->store->getMetadata('description', new Transition('transition_2', array(), array())));
75+
$this->assertNull($this->store->getMetadata('description', new Transition('transition_2', [], [])));
7676
}
7777

7878
/**

Tests/RegistryTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ protected function setUp()
1919
{
2020
$this->registry = new Registry();
2121

22-
$this->registry->addWorkflow(new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow1'), $this->createWorkflowSupportStrategy(Subject1::class));
23-
$this->registry->addWorkflow(new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow2'), $this->createWorkflowSupportStrategy(Subject2::class));
24-
$this->registry->addWorkflow(new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow3'), $this->createWorkflowSupportStrategy(Subject2::class));
22+
$this->registry->addWorkflow(new Workflow(new Definition([], []), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow1'), $this->createWorkflowSupportStrategy(Subject1::class));
23+
$this->registry->addWorkflow(new Workflow(new Definition([], []), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow2'), $this->createWorkflowSupportStrategy(Subject2::class));
24+
$this->registry->addWorkflow(new Workflow(new Definition([], []), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow3'), $this->createWorkflowSupportStrategy(Subject2::class));
2525
}
2626

2727
protected function tearDown()
@@ -37,7 +37,7 @@ public function testAddIsDeprecated()
3737
{
3838
$registry = new Registry();
3939

40-
$registry->add($w = new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow1'), $this->createSupportStrategy(Subject1::class));
40+
$registry->add($w = new Workflow(new Definition([], []), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow1'), $this->createSupportStrategy(Subject1::class));
4141

4242
$workflow = $registry->get(new Subject1());
4343
$this->assertInstanceOf(Workflow::class, $workflow);

0 commit comments

Comments
 (0)