Skip to content

Commit 4fe4ac4

Browse files
committed
style: Use short array syntax
1 parent 76531da commit 4fe4ac4

File tree

7 files changed

+16
-17
lines changed

7 files changed

+16
-17
lines changed

.styleci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
preset: psr2
22

33
enabled:
4-
- long_array_syntax
54
- concat_with_spaces

src/Collection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,6 @@ public function rewind()
113113

114114
public function __call($name, $arguments)
115115
{
116-
return call_user_func_array(array($this->parser, $name), $arguments);
116+
return call_user_func_array([$this->parser, $name], $arguments);
117117
}
118118
}

src/Fields/Field.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ public function __construct(\File_MARC_Field $field)
1515

1616
public function __call($name, $args)
1717
{
18-
return call_user_func_array(array($this->field, $name), $args);
18+
return call_user_func_array([$this->field, $name], $args);
1919
}
2020

2121
public function __get($key)
2222
{
2323
$method = 'get' . ucfirst($key);
2424
if (method_exists($this, $method)) {
25-
return call_user_func(array($this, $method));
25+
return call_user_func([$this, $method]);
2626
}
2727
}
2828

src/Fields/Subject.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Subject extends Field implements FieldInterface
2424
const CURRICULUM_OBJECTIVE = '658';
2525
const HIERARCHICAL_PLACE_NAME = '662';
2626

27-
protected $vocabularies = array(
27+
protected $vocabularies = [
2828
'0' => 'lcsh', // 0: Library of Congress Subject Headings
2929
'1' => 'lccsh', // 1: LC subject headings for children's literature
3030
'2' => 'mesh', // 2: Medical Subject Headings
@@ -33,7 +33,7 @@ class Subject extends Field implements FieldInterface
3333
'5' => 'cash', // 5: Canadian Subject Headings
3434
'6' => 'rvm', // 6: Répertoire de vedettes-matière
3535
// 7: Source specified in subfield $2
36-
);
36+
];
3737

3838
public static function get(Record $record)
3939
{
@@ -70,9 +70,9 @@ public function getControlNumber()
7070

7171
public function getParts()
7272
{
73-
$parts = array();
73+
$parts = [];
7474
foreach ($this->field->getSubfields() as $c) {
75-
if (in_array($c->getCode(), array('a', 'b', 'x', 'y', 'z'))) {
75+
if (in_array($c->getCode(), ['a', 'b', 'x', 'y', 'z'])) {
7676
$parts[] = $c->getData();
7777
}
7878
}

src/Fields/Title.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __toString()
2727
// $b is not repeated
2828
$b = $this->field->getSubfield('b');
2929
if ($b) {
30-
if (!in_array(substr($title, strlen($title) - 1), array(':', ';', '=', '.'))) {
30+
if (!in_array(substr($title, strlen($title) - 1), [':', ';', '=', '.'])) {
3131
// Add colon if no ISBD marker present ("British style")
3232
$title .= ' :';
3333
}
@@ -36,7 +36,7 @@ public function __toString()
3636

3737
// Part number and title can be repeated
3838
foreach ($this->field->getSubfields() as $sf) {
39-
if (in_array($sf->getCode(), array('n', 'p'))) {
39+
if (in_array($sf->getCode(), ['n', 'p'])) {
4040
$title .= ' ' . $sf->getData();
4141
}
4242
}

src/Importers/XmlImporter.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public function getMarcNamespace($namespaces)
3131
{
3232
foreach ($namespaces as $prefix => $ns) {
3333
if ($ns == 'info:lc/xmlns/marcxchange-v1') {
34-
return array($prefix, $ns);
34+
return [$prefix, $ns];
3535
} elseif ($ns == 'http://www.loc.gov/MARC21/slim') {
36-
return array($prefix, $ns);
36+
return [$prefix, $ns];
3737
}
3838
}
3939

40-
return array('', '');
40+
return ['', ''];
4141
}
4242

4343
public function getRecords()
@@ -47,7 +47,7 @@ public function getRecords()
4747

4848
// If root node is record:
4949
if ($this->source->getName() == 'record') {
50-
return array($this->source);
50+
return [$this->source];
5151
}
5252

5353
$marcRecords = $this->source->xpath('.//x:record');
@@ -63,7 +63,7 @@ public function getRecords()
6363
return $marcRecords;
6464
}
6565

66-
return array();
66+
return [];
6767
}
6868

6969
public function getCollection()

src/Record.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,14 @@ public function getSubjects($vocabulary = null, $tag = null)
194194

195195
public function __call($name, $args)
196196
{
197-
return call_user_func_array(array($this->record, $name), $args);
197+
return call_user_func_array([$this->record, $name], $args);
198198
}
199199

200200
public function __get($key)
201201
{
202202
$method = 'get' . ucfirst($key);
203203
if (method_exists($this, $method)) {
204-
return call_user_func(array($this, $method));
204+
return call_user_func([$this, $method]);
205205
}
206206
}
207207

0 commit comments

Comments
 (0)