Skip to content

Commit 624c450

Browse files
committed
Converted coroutines to fibers (first pass: tests passing, mutants escaping).
1 parent fe50a38 commit 624c450

31 files changed

+185
-366
lines changed
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
name: CI
1+
name: Tests
22

33
on:
44
push:
55
pull_request:
6+
workflow_dispatch:
7+
schedule:
8+
- cron: 0 6 * * *
69

710
jobs:
811
Test:
@@ -12,16 +15,14 @@ jobs:
1215
fail-fast: false
1316
matrix:
1417
php:
15-
- 7.3
16-
- 7.4
17-
- 8.0
1818
- 8.1
19+
- 8.2
1920
dependencies:
2021
- hi
2122
- lo
2223

2324
steps:
24-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2526

2627
- name: Setup PHP ${{ matrix.php }}
2728
uses: shivammathur/setup-php@v2
@@ -34,7 +35,7 @@ jobs:
3435

3536
- name: Cache dependencies
3637
id: composer-cache
37-
uses: actions/cache@v2
38+
uses: actions/cache@v3
3839
with:
3940
path: vendor
4041
key: php-${{ matrix.php }}-${{ matrix.dependencies }}-${{ hashFiles('composer.json') }}
@@ -51,9 +52,7 @@ jobs:
5152
run: |
5253
curl -Os https://uploader.codecov.io/latest/linux/codecov
5354
chmod +x codecov
54-
./codecov -t $CODECOV_TOKEN
55-
env:
56-
COVERALLS_REPO_TOKEN: ${{ secrets.CODECOV_TOKEN }}
55+
./codecov
5756
5857
- name: Run mutation tests
5958
run: |

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Porter <img src="https://github.com/ScriptFUSION/Porter/blob/master/docs/images/
55
[![Latest version][Version image]][Releases]
66
[![Total downloads][Downloads image]][Downloads]
77
[![Build status][Build image]][Build]
8-
[![Mutation score][MSI image]][Build]
8+
[![Mutation score][MSI image]][MSI report]
99
[![Test coverage][Coverage image]][Coverage]
1010

1111
### Scalable and durable data imports for publishing and consuming APIs
@@ -527,6 +527,7 @@ Porter is published under the open source GNU Lesser General Public License v3.0
527527
[Build]: http://travis-ci.com/ScriptFUSION/Porter
528528
[Build image]: https://travis-ci.com/ScriptFUSION/Porter.svg?branch=master "Build status"
529529
[MSI image]: https://badge.stryker-mutator.io/github.com/ScriptFUSION/Porter/master
530+
[MSI report]: https://dashboard.stryker-mutator.io/github.com/ScriptFUSION/Porter/master
530531
[Coverage]: https://codecov.io/gh/ScriptFUSION/Porter
531532
[Coverage image]: https://codecov.io/gh/ScriptFUSION/Porter/branch/master/graphs/badge.svg "Test coverage"
532533

composer.json

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,20 @@
99
],
1010
"license": "LGPL-3.0",
1111
"require": {
12-
"php": "^7.3|^8",
13-
"amphp/amp": "^2",
14-
"async/throttle": "^3",
12+
"php": "^8.1",
13+
"amphp/amp": "^3-beta.9",
14+
"async/throttle": "^4",
1515
"psr/cache": "^1",
1616
"psr/container": "^1",
17-
"scriptfusion/retry": "^2.1|^3",
17+
"revolt/event-loop": "^0.2",
18+
"scriptfusion/retry": "^4",
1819
"scriptfusion/retry-exception-handlers": "^1.2",
1920
"scriptfusion/static-class": "^1"
2021
},
2122
"require-dev": {
22-
"amphp/phpunit-util": "^1.1",
23-
"infection/infection": ">=0.18,<0.26",
24-
"justinrainbow/json-schema": "^5.2.10",
23+
"infection/infection": ">=0.26,<0.27",
2524
"mockery/mockery": "^1.4.2",
26-
"phpunit/php-code-coverage": "^9.2.5",
27-
"phpunit/phpunit": "^9.5.13",
28-
"thecodingmachine/safe": "^1.3.3"
25+
"phpunit/phpunit": "^9.5.23"
2926
},
3027
"suggest" : {
3128
"connectors/http": "Provides an HTTP connector for Porter providers.",

src/Collection/AsyncFilteredRecords.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33

44
namespace ScriptFUSION\Porter\Collection;
55

6-
use Amp\Iterator;
7-
86
class AsyncFilteredRecords extends AsyncRecordCollection
97
{
108
private $filter;
119

12-
public function __construct(Iterator $records, AsyncRecordCollection $previousCollection, callable $filter)
10+
public function __construct(\Iterator $records, AsyncRecordCollection $previousCollection, callable $filter)
1311
{
1412
parent::__construct($records, $previousCollection);
1513

src/Collection/AsyncPorterRecords.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33

44
namespace ScriptFUSION\Porter\Collection;
55

6-
use Amp\Iterator;
76
use ScriptFUSION\Porter\Specification\AsyncImportSpecification;
87

98
class AsyncPorterRecords extends AsyncRecordCollection
109
{
11-
private $specification;
10+
private AsyncImportSpecification $specification;
1211

13-
public function __construct(Iterator $records, AsyncImportSpecification $specification)
12+
public function __construct(AsyncRecordCollection $records, AsyncImportSpecification $specification)
1413
{
1514
parent::__construct($records, $records);
1615

src/Collection/AsyncProviderRecords.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@
33

44
namespace ScriptFUSION\Porter\Collection;
55

6-
use Amp\Iterator;
76
use ScriptFUSION\Porter\Provider\Resource\AsyncResource;
87

98
class AsyncProviderRecords extends AsyncRecordCollection
109
{
11-
private $resource;
12-
13-
public function __construct(Iterator $records, AsyncResource $resource)
10+
public function __construct(\Iterator $records, private readonly AsyncResource $resource)
1411
{
1512
parent::__construct($records);
16-
17-
$this->resource = $resource;
1813
}
1914

2015
public function getResource(): AsyncResource

src/Collection/AsyncRecordCollection.php

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,7 @@
33

44
namespace ScriptFUSION\Porter\Collection;
55

6-
use Amp\Iterator;
7-
use Amp\Promise;
8-
9-
abstract class AsyncRecordCollection implements Iterator
6+
abstract class AsyncRecordCollection extends RecordCollection
107
{
11-
private $records;
12-
13-
private $previousCollection;
14-
15-
public function __construct(Iterator $records, self $previousCollection = null)
16-
{
17-
$this->records = $records;
18-
$this->previousCollection = $previousCollection;
19-
}
20-
21-
public function advance(): Promise
22-
{
23-
return $this->records->advance();
24-
}
25-
26-
public function getCurrent(): array
27-
{
28-
return $this->records->getCurrent();
29-
}
30-
31-
public function getPreviousCollection(): ?self
32-
{
33-
return $this->previousCollection;
34-
}
35-
36-
public function findFirstCollection(): ?self
37-
{
38-
do {
39-
$previous = $nextPrevious ?? $this->getPreviousCollection();
40-
} while ($previous && $nextPrevious = $previous->getPreviousCollection());
41-
42-
return $previous ?: $this;
43-
}
8+
// Intentionally empty. TODO: Remove in next version.
449
}

src/Collection/CountableAsyncProviderRecords.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33

44
namespace ScriptFUSION\Porter\Collection;
55

6-
use Amp\Iterator;
76
use ScriptFUSION\Porter\Provider\Resource\AsyncResource;
87

98
class CountableAsyncProviderRecords extends AsyncProviderRecords implements \Countable
109
{
1110
use CountableRecordsTrait;
1211

13-
public function __construct(Iterator $records, int $count, AsyncResource $resource)
12+
public function __construct(\Iterator $records, int $count, AsyncResource $resource)
1413
{
1514
parent::__construct($records, $resource);
1615

src/Collection/CountableRecordsTrait.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
trait CountableRecordsTrait
77
{
8-
/** @var int */
9-
private $count;
8+
private int $count;
109

1110
public function count(): int
1211
{

src/Collection/PorterRecords.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class PorterRecords extends RecordCollection
99
{
10-
private $specification;
10+
private ImportSpecification $specification;
1111

1212
public function __construct(RecordCollection $records, ImportSpecification $specification)
1313
{

0 commit comments

Comments
 (0)