Skip to content

Commit 660dd9a

Browse files
committed
Update CS and static files.
1 parent 966b1ee commit 660dd9a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+313
-180
lines changed

.gitattributes

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/spec export-ignore
2+
.editorconfig export-ignore
3+
.gitattributes export-ignore
4+
.gitignore export-ignore
5+
.scrutinizer.yml export-ignore
6+
.travis.yml export-ignore
7+
phpunit.xml.dist export-ignore
8+
infection.json.dist export-ignore
9+
grumphp.yml.dist export-ignore
10+
phpspec.yml.dist export-ignore

.github/settings.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# https://github.com/probot/settings
2+
3+
branches:
4+
- name: master
5+
protection:
6+
enforce_admins: false
7+
required_pull_request_reviews:
8+
dismiss_stale_reviews: true
9+
require_code_owner_reviews: true
10+
required_approving_review_count: 1
11+
required_status_checks:
12+
contexts:
13+
- "Grumphp"
14+
strict: false
15+
restrictions: null
16+
17+
labels:
18+
- name: bug
19+
color: ee0701
20+
21+
- name: dependencies
22+
color: 0366d6
23+
24+
- name: enhancement
25+
color: 0e8a16
26+
27+
- name: question
28+
color: cc317c
29+
30+
- name: security
31+
color: ee0701
32+
33+
- name: stale
34+
color: eeeeee
35+
36+
repository:
37+
allow_merge_commit: true
38+
allow_rebase_merge: false
39+
allow_squash_merge: false
40+
default_branch: master
41+
description: "An implementation of tree data structure"
42+
topics: tree,data structure,binary tree
43+
has_downloads: true
44+
has_issues: true
45+
has_pages: false
46+
has_projects: false
47+
has_wiki: false
48+
name: phptree
49+
private: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
name: "Continuous Integration"
8+
9+
jobs:
10+
grumphp:
11+
name: "Grumphp"
12+
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
php-binary:
18+
- php7.1
19+
- php7.2
20+
- php7.3
21+
22+
dependencies:
23+
- lowest
24+
- highest
25+
26+
steps:
27+
- name: "Checkout"
28+
uses: actions/checkout@master
29+
with:
30+
fetch-depth: 1
31+
32+
- name: "Composer install"
33+
run: ${{ matrix.php-binary }} $(which composer) install --no-interaction --no-progress --no-suggest
34+
35+
- name: "Composer install lowest dependencies"
36+
if: matrix.dependencies == 'lowest'
37+
run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest --prefer-lowest
38+
39+
- name: "Install Graphviz"
40+
run: sudo apt-get install graphviz
41+
42+
- name: "Run Grumphp"
43+
run: ${{ matrix.php-binary }} vendor/bin/grumphp run
44+
env:
45+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
46+
47+
- name: "Scrutinizer"
48+
run: wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

.travis.yml

-27
This file was deleted.

README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Latest Stable Version](https://img.shields.io/packagist/v/drupol/phptree.svg?style=flat-square)](https://packagist.org/packages/drupol/phptree)
22
[![GitHub stars](https://img.shields.io/github/stars/drupol/phptree.svg?style=flat-square)](https://packagist.org/packages/drupol/phptree)
33
[![Total Downloads](https://img.shields.io/packagist/dt/drupol/phptree.svg?style=flat-square)](https://packagist.org/packages/drupol/phptree)
4-
[![Build Status](https://img.shields.io/travis/drupol/phptree/master.svg?style=flat-square)](https://travis-ci.org/drupol/phptree)
4+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/drupol/phptree/Continuous%20Integration?style=flat-square)](https://github.com/drupol/phptree/actions)
55
[![Scrutinizer code quality](https://img.shields.io/scrutinizer/quality/g/drupol/phptree/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/phptree/?branch=master)
66
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/drupol/phptree/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/drupol/phptree/?branch=master)
77
[![Mutation testing badge](https://badge.stryker-mutator.io/github.com/drupol/phptree/master)](https://stryker-mutator.github.io)
@@ -40,8 +40,6 @@ Modifier:
4040

4141
## Documentation
4242

43-
API documentation is automatically generated with [APIGen](https://github.com/ApiGen/ApiGen) and available at [this address](https://not-a-number.io/phptree/).
44-
4543
Blog post: [https://not-a-number.io/2018/phptree-a-fast-tree-implementation](https://not-a-number.io/2018/phptree-a-fast-tree-implementation)
4644

4745
## Requirements
@@ -105,7 +103,7 @@ Launcher::open($imagePath);
105103

106104
## Code quality, tests and benchmarks
107105

108-
Every time changes are introduced into the library, [Travis CI](https://travis-ci.org/drupol/phptree/builds) run the tests and the benchmarks.
106+
Every time changes are introduced into the library, [Github](https://github.com/drupol/phptree/actions) run the tests and the benchmarks.
109107

110108
The library has tests written with [PHPSpec](http://www.phpspec.net/).
111109
Feel free to check them out in the `spec` directory. Run `composer phpspec` to trigger the tests.

apigen.yml

-6
This file was deleted.

composer.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
"php": ">= 7.1"
2020
},
2121
"require-dev": {
22-
"drupol/launcher": "^2.2",
23-
"drupol/php-conventions": "^1",
22+
"drupol/launcher": "^2.2.2",
23+
"drupol/php-conventions": "^1.6.7",
2424
"drupol/phpspec-annotation": "^1",
25-
"drupol/phpspec-code-coverage": "^4 || ^5",
25+
"friends-of-phpspec/phpspec-code-coverage": "^4 || ^5",
2626
"graphp/graphviz": "^0.2",
27-
"infection/infection": "^0.13",
28-
"phpbench/phpbench": "^0.16",
29-
"phpspec/phpspec": "^4 || ^5",
27+
"infection/infection": "^0.13.6",
28+
"phpbench/phpbench": "^0.16.10",
29+
"phpspec/phpspec": "^5 || ^6 || ^7",
3030
"phptaskman/changelog": "^1.0",
31-
"scrutinizer/ocular": "^1"
31+
"sebastian/comparator": "^3"
3232
},
3333
"config": {
3434
"sort-packages": true

infection.json.dist

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@
1414
"branch": "master"
1515
}
1616
},
17-
"testFramework":"phpspec",
18-
"tmpDir": "build"
17+
"testFramework":"phpspec"
1918
}

spec/drupol/phptree/Exporter/SimpleArraySpec.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use drupol\phptree\Exporter\SimpleArray;
88
use drupol\phptree\Node\Node;
99
use drupol\phptree\Node\ValueNode;
10+
use InvalidArgumentException;
1011
use PhpSpec\ObjectBehavior;
1112

1213
class SimpleArraySpec extends ObjectBehavior
@@ -87,7 +88,7 @@ public function it_can_throw_an_error_when_tree_is_not_a_valuenode(): void
8788
$tree->add(...array_values($nodes));
8889

8990
$this
90-
->shouldThrow(\InvalidArgumentException::class)
91+
->shouldThrow(InvalidArgumentException::class)
9192
->during('export', [$tree]);
9293
}
9394

spec/drupol/phptree/Importer/TextSpec.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use drupol\phptree\Importer\Text;
88
use drupol\phptree\Node\ValueNode;
99
use drupol\phptree\Node\ValueNodeInterface;
10+
use InvalidArgumentException;
1011
use PhpSpec\ObjectBehavior;
1112

1213
class TextSpec extends ObjectBehavior
@@ -50,7 +51,7 @@ public function it_can_throw_an_error_when_cannot_import(): void
5051
$string = 'invalid string';
5152

5253
$this
53-
->shouldThrow(\InvalidArgumentException::class)
54+
->shouldThrow(InvalidArgumentException::class)
5455
->during('import', [$string]);
5556
}
5657

spec/drupol/phptree/Node/AttributeNodeSpec.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace spec\drupol\phptree\Node;
66

7+
use ArrayObject;
78
use drupol\phptree\Node\AttributeNode;
89
use PhpSpec\ObjectBehavior;
910

@@ -15,7 +16,7 @@ public function it_can_set_and_get_the_attributes(): void
1516
'foo' => 'bar',
1617
];
1718

18-
$attributes = new \ArrayObject($attributes);
19+
$attributes = new ArrayObject($attributes);
1920

2021
$this
2122
->setAttributes($attributes)

spec/drupol/phptree/Node/NaryNodeSpec.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use drupol\phptree\Traverser\BreadthFirst;
1111
use drupol\phptree\Traverser\PreOrder;
1212
use drupol\phptree\Traverser\TraverserInterface;
13+
use Exception;
1314

1415
class NaryNodeSpec extends NodeObjectBehavior
1516
{
@@ -62,7 +63,7 @@ public function it_can_have_children(): void
6263
$this->degree()->shouldReturn(2);
6364
$this->count()->shouldReturn(4);
6465

65-
$this->shouldThrow(\Exception::class)
66+
$this->shouldThrow(Exception::class)
6667
->during('add', [new Node()]);
6768
}
6869

@@ -74,7 +75,7 @@ public function it_can_throw_an_error_when_capacity_is_invalid(): void
7475
->capacity()
7576
->shouldBeNull();
7677

77-
$this->shouldThrow(\Exception::class)
78+
$this->shouldThrow(Exception::class)
7879
->during('add', [new NaryNode()]);
7980
}
8081

spec/drupol/phptree/Node/NodeSpec.php

+13-10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
namespace spec\drupol\phptree\Node;
66

7+
use ArrayIterator;
78
use drupol\phptree\Node\Node;
89
use drupol\phptree\Node\NodeInterface;
910
use drupol\phptree\Node\ValueNode;
11+
use Generator;
12+
use InvalidArgumentException;
1013

1114
class NodeSpec extends NodeObjectBehavior
1215
{
@@ -101,7 +104,7 @@ public function it_can_delete(): void
101104
->shouldReturn(null);
102105

103106
$this
104-
->shouldThrow(\InvalidArgumentException::class)
107+
->shouldThrow(InvalidArgumentException::class)
105108
->during('delete', [$this]);
106109
}
107110

@@ -123,7 +126,7 @@ public function it_can_get_its_ancestors(): void
123126
{
124127
$this
125128
->getAncestors()
126-
->shouldYield(new \ArrayIterator([]));
129+
->shouldYield(new ArrayIterator([]));
127130

128131
$root = new Node();
129132
$level1 = new Node($root);
@@ -133,26 +136,26 @@ public function it_can_get_its_ancestors(): void
133136

134137
$this
135138
->getAncestors()
136-
->shouldYield(new \ArrayIterator([$level2, $level1, $root]));
139+
->shouldYield(new ArrayIterator([$level2, $level1, $root]));
137140
}
138141

139142
public function it_can_get_its_children(): void
140143
{
141144
$this
142145
->children()
143-
->shouldBeAnInstanceOf(\Generator::class);
146+
->shouldBeAnInstanceOf(Generator::class);
144147

145148
$this
146149
->children()
147-
->shouldYield(new \ArrayIterator([]));
150+
->shouldYield(new ArrayIterator([]));
148151

149152
$node = new Node();
150153

151154
$this
152155
->add($node)
153156
->add($node)
154157
->children()
155-
->shouldYield(new \ArrayIterator([$node, $node]));
158+
->shouldYield(new ArrayIterator([$node, $node]));
156159
}
157160

158161
public function it_can_get_its_depth(): void
@@ -220,7 +223,7 @@ public function it_can_get_its_sibblings(): void
220223
{
221224
$this
222225
->getSibblings()
223-
->shouldYield(new \ArrayIterator([]));
226+
->shouldYield(new ArrayIterator([]));
224227

225228
$node1 = new Node();
226229
$node2 = new Node();
@@ -230,7 +233,7 @@ public function it_can_get_its_sibblings(): void
230233

231234
$this
232235
->getSibblings()
233-
->shouldYield(new \ArrayIterator([$node2, $node3]));
236+
->shouldYield(new ArrayIterator([$node2, $node3]));
234237
}
235238

236239
public function it_can_get_the_size(): void
@@ -297,12 +300,12 @@ public function it_can_use_withChildren(): void
297300
$this
298301
->withChildren($child)
299302
->children()
300-
->shouldYield(new \ArrayIterator([$child]));
303+
->shouldYield(new ArrayIterator([$child]));
301304

302305
$this
303306
->withChildren()
304307
->children()
305-
->shouldYield(new \ArrayIterator([]));
308+
->shouldYield(new ArrayIterator([]));
306309
}
307310

308311
public function it_has_a_degree(): void

0 commit comments

Comments
 (0)