Skip to content

Commit

Permalink
Update to newest drupol/php-conventions.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Aug 13, 2019
1 parent b1e3dc5 commit 63a4e73
Show file tree
Hide file tree
Showing 60 changed files with 165 additions and 167 deletions.
4 changes: 2 additions & 2 deletions benchmarks/AbstractBench.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace drupol\phptree\benchmarks;

Expand All @@ -11,6 +11,6 @@ abstract class AbstractBench
*/
public function getData()
{
return \range(1, 100);
return range(1, 100);
}
}
2 changes: 1 addition & 1 deletion benchmarks/DrupolPhpTreeBench.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace drupol\phptree\benchmarks;

Expand Down
2 changes: 0 additions & 2 deletions grumphp.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ imports:
- { resource: vendor/drupol/php-conventions/config/php71/grumphp.yml }

parameters:
extensions:
- drupol\PhpConventions\GrumphpTasksExtension
extra_tasks:
phpspec:
verbose: true
Expand Down
6 changes: 3 additions & 3 deletions spec/drupol/phptree/Exporter/AsciiSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;

Expand All @@ -14,11 +14,11 @@ public function it_can_export_to_ascii(): void
{
$tree = new ValueNode('root', 2);

foreach (\range('A', 'Z') as $key => $value) {
foreach (range('A', 'Z') as $key => $value) {
$nodes[$value] = new ValueNode($value, 2);
}

$tree->add(...\array_values($nodes));
$tree->add(...array_values($nodes));

$expected = <<<'EOF'
├─ root
Expand Down
2 changes: 1 addition & 1 deletion spec/drupol/phptree/Exporter/GraphSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;

Expand Down
12 changes: 6 additions & 6 deletions spec/drupol/phptree/Exporter/GvSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;

Expand Down Expand Up @@ -34,23 +34,23 @@ public function it_can_export_to_dot_gv(): void
->add($child1, $child2, $child3);

$nodes['root'] = [
'hash' => \sha1(\spl_object_hash($tree)),
'hash' => sha1(spl_object_hash($tree)),
'value' => 'root',
];
$nodes['child1'] = [
'hash' => \sha1(\spl_object_hash($child1)),
'hash' => sha1(spl_object_hash($child1)),
'value' => $child1->getValue(),
];
$nodes['child2'] = [
'hash' => \sha1(\spl_object_hash($child2)),
'hash' => sha1(spl_object_hash($child2)),
'value' => $child2->getValue(),
];
$nodes['child3'] = [
'hash' => \sha1(\spl_object_hash($child3)),
'hash' => sha1(spl_object_hash($child3)),
'value' => $child3->getValue(),
];
$nodes['child4'] = [
'hash' => \sha1(\spl_object_hash($child4)),
'hash' => sha1(spl_object_hash($child4)),
'value' => $child4->getValue(),
];

Expand Down
2 changes: 1 addition & 1 deletion spec/drupol/phptree/Exporter/ImageSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;

Expand Down
10 changes: 5 additions & 5 deletions spec/drupol/phptree/Exporter/SimpleArraySpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;

Expand All @@ -21,11 +21,11 @@ public function it_can_export_to_an_array(): void

$nodes = [];

foreach (\range('A', 'J') as $value) {
foreach (range('A', 'J') as $value) {
$nodes[$value] = new ValueNode($value, 2);
}

$tree->add(...\array_values($nodes));
$tree->add(...array_values($nodes));

$return = [
'value' => 'root',
Expand Down Expand Up @@ -80,11 +80,11 @@ public function it_can_throw_an_error_when_tree_is_not_a_valuenode(): void
{
$tree = new Node();

foreach (\range('A', 'Z') as $key => $value) {
foreach (range('A', 'Z') as $key => $value) {
$nodes[$value] = new Node();
}

$tree->add(...\array_values($nodes));
$tree->add(...array_values($nodes));

$this
->shouldThrow(\InvalidArgumentException::class)
Expand Down
6 changes: 3 additions & 3 deletions spec/drupol/phptree/Exporter/TextSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Exporter;

Expand All @@ -20,11 +20,11 @@ public function it_can_export_to_text(): void

$nodes = [];

foreach (\range('A', 'J') as $value) {
foreach (range('A', 'J') as $value) {
$nodes[$value] = new ValueNode($value, 2);
}

$tree->add(...\array_values($nodes));
$tree->add(...array_values($nodes));

$this
->export($tree)
Expand Down
2 changes: 1 addition & 1 deletion spec/drupol/phptree/Importer/SimpleArraySpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Importer;

Expand Down
6 changes: 3 additions & 3 deletions spec/drupol/phptree/Importer/TextSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Importer;

Expand All @@ -19,11 +19,11 @@ public function it_can_import(): void

$nodes = [];

foreach (\range('A', 'J') as $value) {
foreach (range('A', 'J') as $value) {
$nodes[$value] = new ValueNode($value);
}

$tree->add(...\array_values($nodes));
$tree->add(...array_values($nodes));

$this
->import($string)
Expand Down
6 changes: 3 additions & 3 deletions spec/drupol/phptree/Modifier/ReverseSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Modifier;

Expand All @@ -16,13 +16,13 @@ public function it_can_reverse_a_tree(): void

$nodes = [];

foreach (\range('A', 'E') as $value) {
foreach (range('A', 'E') as $value) {
$nodes[] = new ValueNode($value);
}
$tree1->add(...$nodes);

$tree2 = new ValueNode('root');
$tree2->add(...\array_reverse($nodes));
$tree2->add(...array_reverse($nodes));

$this
->modify($tree1)
Expand Down
4 changes: 2 additions & 2 deletions spec/drupol/phptree/Node/ABNodeSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Node;

Expand All @@ -12,7 +12,7 @@ public function it_balance_a_tree(): void
{
$this->beConstructedWith(1);

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

$nodes = [];

Expand Down
2 changes: 1 addition & 1 deletion spec/drupol/phptree/Node/AttributeNodeSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Node;

Expand Down
2 changes: 1 addition & 1 deletion spec/drupol/phptree/Node/KeyValueNodeSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Node;

Expand Down
4 changes: 2 additions & 2 deletions spec/drupol/phptree/Node/NaryNodeSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Node;

Expand All @@ -17,7 +17,7 @@ public function it_can_be_counted(): void
{
$this->beConstructedWith(2);

foreach (\range('A', 'Z') as $value) {
foreach (range('A', 'Z') as $value) {
$this->add(new ValueNode($value, 3));
}

Expand Down
6 changes: 3 additions & 3 deletions spec/drupol/phptree/Node/NodeObjectBehavior.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Node;

Expand Down Expand Up @@ -58,12 +58,12 @@ public function getMatchers(): array
$left = (new GraphViz())->setFormat('png')->createImageFile($left);
$right = (new GraphViz())->setFormat('png')->createImageFile($right);

return \file_get_contents($left) === \file_get_contents($right);
return file_get_contents($left) === file_get_contents($right);
},
'haveSameGraphImageFile' => static function ($subject, $key) {
$left = (new GraphViz())->setFormat('png')->createImageFile($subject);

return \file_get_contents($left) === \file_get_contents($key);
return file_get_contents($left) === file_get_contents($key);
},
];
}
Expand Down
12 changes: 6 additions & 6 deletions spec/drupol/phptree/Node/NodeSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Node;

Expand Down Expand Up @@ -171,7 +171,7 @@ public function it_can_get_its_depth(): void

$nodes = [];

foreach (\range('A', 'Z') as $v) {
foreach (range('A', 'Z') as $v) {
$nodes[] = new ValueNode($v, 2);
}

Expand All @@ -190,7 +190,7 @@ public function it_can_get_its_height(): void

$tree = $this;

foreach (\range('A', 'B') as $key => $v) {
foreach (range('A', 'B') as $key => $v) {
$node = new ValueNode($v, 1);
$tree->add($node);
$tree = $node;
Expand All @@ -200,7 +200,7 @@ public function it_can_get_its_height(): void
->height()
->shouldReturn(2);

foreach (\range('C', 'F') as $key => $v) {
foreach (range('C', 'F') as $key => $v) {
$node = new ValueNode($v, 1);
$tree->add($node);
$tree = $node;
Expand Down Expand Up @@ -238,11 +238,11 @@ public function it_can_get_the_size(): void
$nodes = [];
$linearNodes = [];

foreach (\range('a', 'e') as $lowercaseValue) {
foreach (range('a', 'e') as $lowercaseValue) {
$node1 = new Node();
$linearNodes[] = $node1;

foreach (\range('A', 'E') as $uppercaseValue) {
foreach (range('A', 'E') as $uppercaseValue) {
$node2 = new Node();
$linearNodes[] = $node2;

Expand Down
2 changes: 1 addition & 1 deletion spec/drupol/phptree/Node/TrieNodeSpec.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace spec\drupol\phptree\Node;

Expand Down

0 comments on commit 63a4e73

Please sign in to comment.