Skip to content

Commit 6d5ee28

Browse files
committed
Upgrade to drupol/php-conventions ^1.4.
1 parent efa2d7d commit 6d5ee28

34 files changed

+125
-101
lines changed

benchmarks/DrupolPhpTreeBench.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class DrupolPhpTreeBench extends AbstractBench
2323
* @Iterations(5)
2424
* @Warmup(10)
2525
*/
26-
public function benchTreeAdd()
26+
public function benchTreeAdd(): void
2727
{
2828
$this->tree = new ValueNode('root', 2);
2929

@@ -35,7 +35,7 @@ public function benchTreeAdd()
3535
/**
3636
* Init the object.
3737
*/
38-
public function initObject()
38+
public function initObject(): void
3939
{
4040
}
4141
}

grumphp.yml.dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
imports:
2-
- { resource: vendor/drupol/php-conventions/config/php7/grumphp.yml }
2+
- { resource: vendor/drupol/php-conventions/config/php71/grumphp.yml }
33

44
parameters:
55
extensions:

spec/drupol/phptree/Exporter/AsciiSpec.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class AsciiSpec extends ObjectBehavior
1212
{
13-
public function it_can_export_to_ascii()
13+
public function it_can_export_to_ascii(): void
1414
{
1515
$tree = new ValueNode('root', 2);
1616

@@ -95,7 +95,7 @@ public function it_can_export_to_ascii()
9595
->shouldReturn($expected);
9696
}
9797

98-
public function it_is_initializable()
98+
public function it_is_initializable(): void
9999
{
100100
$this->shouldHaveType(Ascii::class);
101101
}

spec/drupol/phptree/Exporter/GraphSpec.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class GraphSpec extends ObjectBehavior
2424
public function getMatchers(): array
2525
{
2626
return [
27-
'haveSameTextExport' => function ($left, $right) {
27+
'haveSameTextExport' => static function ($left, $right) {
2828
$importer = new Text();
2929
$exporter = new Graph();
3030

@@ -35,7 +35,7 @@ public function getMatchers(): array
3535
];
3636
}
3737

38-
public function it_can_generate_a_graph()
38+
public function it_can_generate_a_graph(): void
3939
{
4040
$tree = new AttributeNode(['graphviz.label' => 'root']);
4141
$child1 = new ValueNode('child1');
@@ -60,7 +60,7 @@ public function it_can_generate_a_graph()
6060
->shouldHaveSameTextExport('[root[child1[child4]][child2][child3]]');
6161
}
6262

63-
public function it_is_initializable()
63+
public function it_is_initializable(): void
6464
{
6565
$this->shouldHaveType(Graph::class);
6666
}

spec/drupol/phptree/Exporter/GvSpec.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class GvSpec extends ObjectBehavior
1313
{
14-
public function it_can_export_to_dot_gv()
14+
public function it_can_export_to_dot_gv(): void
1515
{
1616
$attributes = [
1717
'ratio' => 'fill',
@@ -104,7 +104,8 @@ public function it_can_export_to_dot_gv()
104104
->export($tree)
105105
->shouldReturn($result);
106106
}
107-
public function it_is_initializable()
107+
108+
public function it_is_initializable(): void
108109
{
109110
$this->shouldHaveType(Gv::class);
110111
}

spec/drupol/phptree/Exporter/ImageSpec.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class ImageSpec extends ObjectBehavior
1212
{
13-
public function it_can_convert_a_tree_into_a_file()
13+
public function it_can_convert_a_tree_into_a_file(): void
1414
{
1515
$tree = new ValueNode('root');
1616

@@ -19,7 +19,7 @@ public function it_can_convert_a_tree_into_a_file()
1919
->shouldBeString();
2020
}
2121

22-
public function it_can_set_and_get_the_executable()
22+
public function it_can_set_and_get_the_executable(): void
2323
{
2424
$this
2525
->getExecutable()
@@ -34,7 +34,7 @@ public function it_can_set_and_get_the_executable()
3434
->shouldBe('foo');
3535
}
3636

37-
public function it_can_set_and_get_the_format()
37+
public function it_can_set_and_get_the_format(): void
3838
{
3939
$this
4040
->getFormat()
@@ -48,7 +48,8 @@ public function it_can_set_and_get_the_format()
4848
->getFormat()
4949
->shouldReturn('png');
5050
}
51-
public function it_is_initializable()
51+
52+
public function it_is_initializable(): void
5253
{
5354
$this->shouldHaveType(Image::class);
5455

spec/drupol/phptree/Exporter/SimpleArraySpec.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class SimpleArraySpec extends ObjectBehavior
1313
{
14-
public function it_can_export_to_an_array()
14+
public function it_can_export_to_an_array(): void
1515
{
1616
$tree = new ValueNode('root', 2);
1717

@@ -20,6 +20,7 @@ public function it_can_export_to_an_array()
2020
->shouldReturn(['value' => 'root']);
2121

2222
$nodes = [];
23+
2324
foreach (\range('A', 'J') as $value) {
2425
$nodes[$value] = new ValueNode($value, 2);
2526
}
@@ -75,7 +76,7 @@ public function it_can_export_to_an_array()
7576
->shouldReturn($return);
7677
}
7778

78-
public function it_can_throw_an_error_when_tree_is_not_a_valuenode()
79+
public function it_can_throw_an_error_when_tree_is_not_a_valuenode(): void
7980
{
8081
$tree = new Node();
8182

@@ -90,7 +91,7 @@ public function it_can_throw_an_error_when_tree_is_not_a_valuenode()
9091
->during('export', [$tree]);
9192
}
9293

93-
public function it_is_initializable()
94+
public function it_is_initializable(): void
9495
{
9596
$this->shouldHaveType(SimpleArray::class);
9697
}

spec/drupol/phptree/Exporter/TextSpec.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class TextSpec extends ObjectBehavior
1212
{
13-
public function it_can_export_to_text()
13+
public function it_can_export_to_text(): void
1414
{
1515
$tree = new ValueNode('root', 2);
1616

@@ -19,6 +19,7 @@ public function it_can_export_to_text()
1919
->shouldReturn('[root]');
2020

2121
$nodes = [];
22+
2223
foreach (\range('A', 'J') as $value) {
2324
$nodes[$value] = new ValueNode($value, 2);
2425
}
@@ -30,7 +31,7 @@ public function it_can_export_to_text()
3031
->shouldReturn('[root[A[C[G][H]][D[I][J]]][B[E][F]]]');
3132
}
3233

33-
public function it_is_initializable()
34+
public function it_is_initializable(): void
3435
{
3536
$this->shouldHaveType(Text::class);
3637
}

spec/drupol/phptree/Importer/SimpleArraySpec.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class SimpleArraySpec extends ObjectBehavior
1212
{
13-
public function it_can_import()
13+
public function it_can_import(): void
1414
{
1515
$array = [
1616
'value' => 'root',
@@ -39,7 +39,7 @@ public function it_can_import()
3939
->shouldReturn(true);
4040
}
4141

42-
public function it_is_initializable()
42+
public function it_is_initializable(): void
4343
{
4444
$this->shouldHaveType(SimpleArray::class);
4545
}

spec/drupol/phptree/Importer/TextSpec.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
class TextSpec extends ObjectBehavior
1313
{
14-
public function it_can_import()
14+
public function it_can_import(): void
1515
{
1616
$string = '[root[A[C[G][H]][D[I][J]]][B[E][F]]]';
1717

1818
$tree = new ValueNode('root', 2);
1919

2020
$nodes = [];
21+
2122
foreach (\range('A', 'J') as $value) {
2223
$nodes[$value] = new ValueNode($value);
2324
}
@@ -44,7 +45,7 @@ public function it_can_import()
4445
->shouldReturn('root');
4546
}
4647

47-
public function it_can_throw_an_error_when_cannot_import()
48+
public function it_can_throw_an_error_when_cannot_import(): void
4849
{
4950
$string = 'invalid string';
5051

@@ -53,7 +54,7 @@ public function it_can_throw_an_error_when_cannot_import()
5354
->during('import', [$string]);
5455
}
5556

56-
public function it_is_initializable()
57+
public function it_is_initializable(): void
5758
{
5859
$this->shouldHaveType(Text::class);
5960
}

spec/drupol/phptree/Modifier/ReverseSpec.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010

1111
class ReverseSpec extends ObjectBehavior
1212
{
13-
public function it_can_reverse_a_tree()
13+
public function it_can_reverse_a_tree(): void
1414
{
1515
$tree1 = new ValueNode('root');
1616

1717
$nodes = [];
18+
1819
foreach (\range('A', 'E') as $value) {
1920
$nodes[] = new ValueNode($value);
2021
}
@@ -31,7 +32,7 @@ public function it_can_reverse_a_tree()
3132
$this->modify($tree1)->shouldNotBeEqualTo($tree2);
3233
}
3334

34-
public function it_is_initializable()
35+
public function it_is_initializable(): void
3536
{
3637
$this->shouldHaveType(Reverse::class);
3738
}

spec/drupol/phptree/Node/ABNodeSpec.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88

99
class ABNodeSpec extends NodeObjectBehavior
1010
{
11-
public function it_balance_a_tree()
11+
public function it_balance_a_tree(): void
1212
{
1313
$this->beConstructedWith(1);
1414

1515
$data = \range(0, 40);
1616

1717
$nodes = [];
18+
1819
foreach ($data as $key => $value) {
1920
$nodes[$key] = new ABNode(2);
2021
}
@@ -62,7 +63,8 @@ public function it_balance_a_tree()
6263
->count()
6364
->shouldReturn(20);
6465
}
65-
public function it_is_initializable()
66+
67+
public function it_is_initializable(): void
6668
{
6769
$this->shouldHaveType(ABNode::class);
6870
}

spec/drupol/phptree/Node/AttributeNodeSpec.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class AttributeNodeSpec extends ObjectBehavior
1111
{
12-
public function it_can_set_and_get_the_attributes()
12+
public function it_can_set_and_get_the_attributes(): void
1313
{
1414
$attributes = [
1515
'foo' => 'bar',
@@ -27,7 +27,8 @@ public function it_can_set_and_get_the_attributes()
2727
->getAttribute('bar')
2828
->shouldReturn('foo');
2929
}
30-
public function it_is_initializable()
30+
31+
public function it_is_initializable(): void
3132
{
3233
$this->shouldHaveType(AttributeNode::class);
3334
}

spec/drupol/phptree/Node/KeyValueNodeSpec.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class KeyValueNodeSpec extends NodeObjectBehavior
1010
{
11-
public function it_can_be_set_with_a_key_and_value()
11+
public function it_can_be_set_with_a_key_and_value(): void
1212
{
1313
$this
1414
->beConstructedWith('key', 'root');
@@ -22,7 +22,7 @@ public function it_can_be_set_with_a_key_and_value()
2222
->shouldReturn('root');
2323
}
2424

25-
public function it_can_throw_an_error_when_capacity_is_invalid()
25+
public function it_can_throw_an_error_when_capacity_is_invalid(): void
2626
{
2727
$this->beConstructedWith('key', 'value', -5);
2828

@@ -31,7 +31,7 @@ public function it_can_throw_an_error_when_capacity_is_invalid()
3131
->shouldReturn(-5);
3232
}
3333

34-
public function it_is_initializable()
34+
public function it_is_initializable(): void
3535
{
3636
$this->beConstructedWith('key', 'value');
3737
$this->shouldHaveType(KeyValueNode::class);

0 commit comments

Comments
 (0)