Skip to content

Commit 4b25bea

Browse files
committed
switched array() to []
1 parent 5036cc9 commit 4b25bea

29 files changed

+142
-142
lines changed

Definition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222
final class Definition
2323
{
24-
private $places = array();
25-
private $transitions = array();
24+
private $places = [];
25+
private $transitions = [];
2626
private $initialPlace;
2727

2828
/**

DefinitionBuilder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
*/
2323
class DefinitionBuilder
2424
{
25-
private $places = array();
26-
private $transitions = array();
25+
private $places = [];
26+
private $transitions = [];
2727
private $initialPlace;
2828

2929
/**
3030
* @param string[] $places
3131
* @param Transition[] $transitions
3232
*/
33-
public function __construct(array $places = array(), array $transitions = array())
33+
public function __construct(array $places = [], array $transitions = [])
3434
{
3535
$this->addPlaces($places);
3636
$this->addTransitions($transitions);
@@ -51,8 +51,8 @@ public function build()
5151
*/
5252
public function reset()
5353
{
54-
$this->places = array();
55-
$this->transitions = array();
54+
$this->places = [];
55+
$this->transitions = [];
5656
$this->initialPlace = null;
5757

5858
return $this;

Dumper/DumperInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ interface DumperInterface
3131
*
3232
* @return string The representation of the workflow
3333
*/
34-
public function dump(Definition $definition, Marking $marking = null, array $options = array());
34+
public function dump(Definition $definition, Marking $marking = null, array $options = []);
3535
}

Dumper/GraphvizDumper.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
*/
2727
class GraphvizDumper implements DumperInterface
2828
{
29-
protected static $defaultOptions = array(
30-
'graph' => array('ratio' => 'compress', 'rankdir' => 'LR'),
31-
'node' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'fillcolor' => 'lightblue', 'fixedsize' => true, 'width' => 1),
32-
'edge' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'arrowhead' => 'normal', 'arrowsize' => 0.5),
33-
);
29+
protected static $defaultOptions = [
30+
'graph' => ['ratio' => 'compress', 'rankdir' => 'LR'],
31+
'node' => ['fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'fillcolor' => 'lightblue', 'fixedsize' => true, 'width' => 1],
32+
'edge' => ['fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'arrowhead' => 'normal', 'arrowsize' => 0.5],
33+
];
3434

3535
/**
3636
* {@inheritdoc}
@@ -43,7 +43,7 @@ class GraphvizDumper implements DumperInterface
4343
* * node: The default options for nodes (places + transitions)
4444
* * edge: The default options for edges
4545
*/
46-
public function dump(Definition $definition, Marking $marking = null, array $options = array())
46+
public function dump(Definition $definition, Marking $marking = null, array $options = [])
4747
{
4848
$places = $this->findPlaces($definition, $marking);
4949
$transitions = $this->findTransitions($definition);
@@ -63,20 +63,20 @@ public function dump(Definition $definition, Marking $marking = null, array $opt
6363
*/
6464
protected function findPlaces(Definition $definition, Marking $marking = null)
6565
{
66-
$places = array();
66+
$places = [];
6767

6868
foreach ($definition->getPlaces() as $place) {
69-
$attributes = array();
69+
$attributes = [];
7070
if ($place === $definition->getInitialPlace()) {
7171
$attributes['style'] = 'filled';
7272
}
7373
if ($marking && $marking->has($place)) {
7474
$attributes['color'] = '#FF0000';
7575
$attributes['shape'] = 'doublecircle';
7676
}
77-
$places[$place] = array(
77+
$places[$place] = [
7878
'attributes' => $attributes,
79-
);
79+
];
8080
}
8181

8282
return $places;
@@ -87,13 +87,13 @@ protected function findPlaces(Definition $definition, Marking $marking = null)
8787
*/
8888
protected function findTransitions(Definition $definition)
8989
{
90-
$transitions = array();
90+
$transitions = [];
9191

9292
foreach ($definition->getTransitions() as $transition) {
93-
$transitions[] = array(
94-
'attributes' => array('shape' => 'box', 'regular' => true),
93+
$transitions[] = [
94+
'attributes' => ['shape' => 'box', 'regular' => true],
9595
'name' => $transition->getName(),
96-
);
96+
];
9797
}
9898

9999
return $transitions;
@@ -132,22 +132,22 @@ protected function addTransitions(array $transitions)
132132
*/
133133
protected function findEdges(Definition $definition)
134134
{
135-
$dotEdges = array();
135+
$dotEdges = [];
136136

137137
foreach ($definition->getTransitions() as $transition) {
138138
foreach ($transition->getFroms() as $from) {
139-
$dotEdges[] = array(
139+
$dotEdges[] = [
140140
'from' => $from,
141141
'to' => $transition->getName(),
142142
'direction' => 'from',
143-
);
143+
];
144144
}
145145
foreach ($transition->getTos() as $to) {
146-
$dotEdges[] = array(
146+
$dotEdges[] = [
147147
'from' => $transition->getName(),
148148
'to' => $to,
149149
'direction' => 'to',
150-
);
150+
];
151151
}
152152
}
153153

@@ -203,7 +203,7 @@ protected function dotize($id)
203203

204204
private function addAttributes(array $attributes)
205205
{
206-
$code = array();
206+
$code = [];
207207

208208
foreach ($attributes as $k => $v) {
209209
$code[] = sprintf('%s="%s"', $k, $v);
@@ -214,7 +214,7 @@ private function addAttributes(array $attributes)
214214

215215
private function addOptions(array $options)
216216
{
217-
$code = array();
217+
$code = [];
218218

219219
foreach ($options as $k => $v) {
220220
$code[] = sprintf('%s="%s"', $k, $v);

Dumper/StateMachineGraphvizDumper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class StateMachineGraphvizDumper extends GraphvizDumper
2727
* * node: The default options for nodes (places)
2828
* * edge: The default options for edges
2929
*/
30-
public function dump(Definition $definition, Marking $marking = null, array $options = array())
30+
public function dump(Definition $definition, Marking $marking = null, array $options = [])
3131
{
3232
$places = $this->findPlaces($definition, $marking);
3333
$edges = $this->findEdges($definition);
@@ -46,15 +46,15 @@ public function dump(Definition $definition, Marking $marking = null, array $opt
4646
*/
4747
protected function findEdges(Definition $definition)
4848
{
49-
$edges = array();
49+
$edges = [];
5050

5151
foreach ($definition->getTransitions() as $transition) {
5252
foreach ($transition->getFroms() as $from) {
5353
foreach ($transition->getTos() as $to) {
54-
$edges[$from][] = array(
54+
$edges[$from][] = [
5555
'name' => $transition->getName(),
5656
'to' => $to,
57-
);
57+
];
5858
}
5959
}
6060
}

EventListener/AuditTrailListener.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public function onEnter(Event $event)
4848

4949
public static function getSubscribedEvents()
5050
{
51-
return array(
52-
'workflow.leave' => array('onLeave'),
53-
'workflow.transition' => array('onTransition'),
54-
'workflow.enter' => array('onEnter'),
55-
);
51+
return [
52+
'workflow.leave' => ['onLeave'],
53+
'workflow.transition' => ['onTransition'],
54+
'workflow.enter' => ['onEnter'],
55+
];
5656
}
5757
}

EventListener/GuardListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private function getVariables(GuardEvent $event)
8484
$roles = $token->getRoles();
8585
}
8686

87-
$variables = array(
87+
$variables = [
8888
'token' => $token,
8989
'user' => $token->getUser(),
9090
'subject' => $event->getSubject(),
@@ -97,7 +97,7 @@ private function getVariables(GuardEvent $event)
9797
'trust_resolver' => $this->trustResolver,
9898
// needed for the is_valid expression function
9999
'validator' => $this->validator,
100-
);
100+
];
101101

102102
return $variables;
103103
}

Marking.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
*/
1919
class Marking
2020
{
21-
private $places = array();
21+
private $places = [];
2222

2323
/**
2424
* @param int[] $representation Keys are the place name and values should be 1
2525
*/
26-
public function __construct(array $representation = array())
26+
public function __construct(array $representation = [])
2727
{
2828
foreach ($representation as $place => $nbToken) {
2929
$this->mark($place);

MarkingStore/MultipleStateMarkingStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($property = 'marking', PropertyAccessorInterface $pr
4444
*/
4545
public function getMarking($subject)
4646
{
47-
return new Marking($this->propertyAccessor->getValue($subject, $this->property) ?: array());
47+
return new Marking($this->propertyAccessor->getValue($subject, $this->property) ?: []);
4848
}
4949

5050
/**

MarkingStore/SingleStateMarkingStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getMarking($subject)
4949
return new Marking();
5050
}
5151

52-
return new Marking(array($placeName => 1));
52+
return new Marking([$placeName => 1]);
5353
}
5454

5555
/**

0 commit comments

Comments
 (0)