Skip to content

Commit

Permalink
Upgrade to drupol/php-conventions ^1.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jul 10, 2019
1 parent efa2d7d commit 6d5ee28
Show file tree
Hide file tree
Showing 34 changed files with 125 additions and 101 deletions.
4 changes: 2 additions & 2 deletions benchmarks/DrupolPhpTreeBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DrupolPhpTreeBench extends AbstractBench
* @Iterations(5)
* @Warmup(10)
*/
public function benchTreeAdd()
public function benchTreeAdd(): void
{
$this->tree = new ValueNode('root', 2);

Expand All @@ -35,7 +35,7 @@ public function benchTreeAdd()
/**
* Init the object.
*/
public function initObject()
public function initObject(): void
{
}
}
2 changes: 1 addition & 1 deletion grumphp.yml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
imports:
- { resource: vendor/drupol/php-conventions/config/php7/grumphp.yml }
- { resource: vendor/drupol/php-conventions/config/php71/grumphp.yml }

parameters:
extensions:
Expand Down
4 changes: 2 additions & 2 deletions spec/drupol/phptree/Exporter/AsciiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class AsciiSpec extends ObjectBehavior
{
public function it_can_export_to_ascii()
public function it_can_export_to_ascii(): void
{
$tree = new ValueNode('root', 2);

Expand Down Expand Up @@ -95,7 +95,7 @@ public function it_can_export_to_ascii()
->shouldReturn($expected);
}

public function it_is_initializable()
public function it_is_initializable(): void
{
$this->shouldHaveType(Ascii::class);
}
Expand Down
6 changes: 3 additions & 3 deletions spec/drupol/phptree/Exporter/GraphSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GraphSpec extends ObjectBehavior
public function getMatchers(): array
{
return [
'haveSameTextExport' => function ($left, $right) {
'haveSameTextExport' => static function ($left, $right) {
$importer = new Text();
$exporter = new Graph();

Expand All @@ -35,7 +35,7 @@ public function getMatchers(): array
];
}

public function it_can_generate_a_graph()
public function it_can_generate_a_graph(): void
{
$tree = new AttributeNode(['graphviz.label' => 'root']);
$child1 = new ValueNode('child1');
Expand All @@ -60,7 +60,7 @@ public function it_can_generate_a_graph()
->shouldHaveSameTextExport('[root[child1[child4]][child2][child3]]');
}

public function it_is_initializable()
public function it_is_initializable(): void
{
$this->shouldHaveType(Graph::class);
}
Expand Down
5 changes: 3 additions & 2 deletions spec/drupol/phptree/Exporter/GvSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class GvSpec extends ObjectBehavior
{
public function it_can_export_to_dot_gv()
public function it_can_export_to_dot_gv(): void
{
$attributes = [
'ratio' => 'fill',
Expand Down Expand Up @@ -104,7 +104,8 @@ public function it_can_export_to_dot_gv()
->export($tree)
->shouldReturn($result);
}
public function it_is_initializable()

public function it_is_initializable(): void
{
$this->shouldHaveType(Gv::class);
}
Expand Down
9 changes: 5 additions & 4 deletions spec/drupol/phptree/Exporter/ImageSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class ImageSpec extends ObjectBehavior
{
public function it_can_convert_a_tree_into_a_file()
public function it_can_convert_a_tree_into_a_file(): void
{
$tree = new ValueNode('root');

Expand All @@ -19,7 +19,7 @@ public function it_can_convert_a_tree_into_a_file()
->shouldBeString();
}

public function it_can_set_and_get_the_executable()
public function it_can_set_and_get_the_executable(): void
{
$this
->getExecutable()
Expand All @@ -34,7 +34,7 @@ public function it_can_set_and_get_the_executable()
->shouldBe('foo');
}

public function it_can_set_and_get_the_format()
public function it_can_set_and_get_the_format(): void
{
$this
->getFormat()
Expand All @@ -48,7 +48,8 @@ public function it_can_set_and_get_the_format()
->getFormat()
->shouldReturn('png');
}
public function it_is_initializable()

public function it_is_initializable(): void
{
$this->shouldHaveType(Image::class);

Expand Down
7 changes: 4 additions & 3 deletions spec/drupol/phptree/Exporter/SimpleArraySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class SimpleArraySpec extends ObjectBehavior
{
public function it_can_export_to_an_array()
public function it_can_export_to_an_array(): void
{
$tree = new ValueNode('root', 2);

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

$nodes = [];

foreach (\range('A', 'J') as $value) {
$nodes[$value] = new ValueNode($value, 2);
}
Expand Down Expand Up @@ -75,7 +76,7 @@ public function it_can_export_to_an_array()
->shouldReturn($return);
}

public function it_can_throw_an_error_when_tree_is_not_a_valuenode()
public function it_can_throw_an_error_when_tree_is_not_a_valuenode(): void
{
$tree = new Node();

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

public function it_is_initializable()
public function it_is_initializable(): void
{
$this->shouldHaveType(SimpleArray::class);
}
Expand Down
5 changes: 3 additions & 2 deletions spec/drupol/phptree/Exporter/TextSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class TextSpec extends ObjectBehavior
{
public function it_can_export_to_text()
public function it_can_export_to_text(): void
{
$tree = new ValueNode('root', 2);

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

$nodes = [];

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

public function it_is_initializable()
public function it_is_initializable(): void
{
$this->shouldHaveType(Text::class);
}
Expand Down
4 changes: 2 additions & 2 deletions spec/drupol/phptree/Importer/SimpleArraySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class SimpleArraySpec extends ObjectBehavior
{
public function it_can_import()
public function it_can_import(): void
{
$array = [
'value' => 'root',
Expand Down Expand Up @@ -39,7 +39,7 @@ public function it_can_import()
->shouldReturn(true);
}

public function it_is_initializable()
public function it_is_initializable(): void
{
$this->shouldHaveType(SimpleArray::class);
}
Expand Down
7 changes: 4 additions & 3 deletions spec/drupol/phptree/Importer/TextSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

class TextSpec extends ObjectBehavior
{
public function it_can_import()
public function it_can_import(): void
{
$string = '[root[A[C[G][H]][D[I][J]]][B[E][F]]]';

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

$nodes = [];

foreach (\range('A', 'J') as $value) {
$nodes[$value] = new ValueNode($value);
}
Expand All @@ -44,7 +45,7 @@ public function it_can_import()
->shouldReturn('root');
}

public function it_can_throw_an_error_when_cannot_import()
public function it_can_throw_an_error_when_cannot_import(): void
{
$string = 'invalid string';

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

public function it_is_initializable()
public function it_is_initializable(): void
{
$this->shouldHaveType(Text::class);
}
Expand Down
5 changes: 3 additions & 2 deletions spec/drupol/phptree/Modifier/ReverseSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

class ReverseSpec extends ObjectBehavior
{
public function it_can_reverse_a_tree()
public function it_can_reverse_a_tree(): void
{
$tree1 = new ValueNode('root');

$nodes = [];

foreach (\range('A', 'E') as $value) {
$nodes[] = new ValueNode($value);
}
Expand All @@ -31,7 +32,7 @@ public function it_can_reverse_a_tree()
$this->modify($tree1)->shouldNotBeEqualTo($tree2);
}

public function it_is_initializable()
public function it_is_initializable(): void
{
$this->shouldHaveType(Reverse::class);
}
Expand Down
6 changes: 4 additions & 2 deletions spec/drupol/phptree/Node/ABNodeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@

class ABNodeSpec extends NodeObjectBehavior
{
public function it_balance_a_tree()
public function it_balance_a_tree(): void
{
$this->beConstructedWith(1);

$data = \range(0, 40);

$nodes = [];

foreach ($data as $key => $value) {
$nodes[$key] = new ABNode(2);
}
Expand Down Expand Up @@ -62,7 +63,8 @@ public function it_balance_a_tree()
->count()
->shouldReturn(20);
}
public function it_is_initializable()

public function it_is_initializable(): void
{
$this->shouldHaveType(ABNode::class);
}
Expand Down
5 changes: 3 additions & 2 deletions spec/drupol/phptree/Node/AttributeNodeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class AttributeNodeSpec extends ObjectBehavior
{
public function it_can_set_and_get_the_attributes()
public function it_can_set_and_get_the_attributes(): void
{
$attributes = [
'foo' => 'bar',
Expand All @@ -27,7 +27,8 @@ public function it_can_set_and_get_the_attributes()
->getAttribute('bar')
->shouldReturn('foo');
}
public function it_is_initializable()

public function it_is_initializable(): void
{
$this->shouldHaveType(AttributeNode::class);
}
Expand Down
6 changes: 3 additions & 3 deletions spec/drupol/phptree/Node/KeyValueNodeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class KeyValueNodeSpec extends NodeObjectBehavior
{
public function it_can_be_set_with_a_key_and_value()
public function it_can_be_set_with_a_key_and_value(): void
{
$this
->beConstructedWith('key', 'root');
Expand All @@ -22,7 +22,7 @@ public function it_can_be_set_with_a_key_and_value()
->shouldReturn('root');
}

public function it_can_throw_an_error_when_capacity_is_invalid()
public function it_can_throw_an_error_when_capacity_is_invalid(): void
{
$this->beConstructedWith('key', 'value', -5);

Expand All @@ -31,7 +31,7 @@ public function it_can_throw_an_error_when_capacity_is_invalid()
->shouldReturn(-5);
}

public function it_is_initializable()
public function it_is_initializable(): void
{
$this->beConstructedWith('key', 'value');
$this->shouldHaveType(KeyValueNode::class);
Expand Down

0 comments on commit 6d5ee28

Please sign in to comment.