Skip to content

Commit c5040c0

Browse files
committed
refactor: Drop supporting old PHP versions; configure composer.json
1 parent def77da commit c5040c0

File tree

3 files changed

+23
-85
lines changed

3 files changed

+23
-85
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ jobs:
1515
- 8.3
1616
- 8.2
1717
- 8.1
18-
- 8.0
19-
- 7.4
20-
- 7.3
21-
- 7.2
22-
- 7.1
2318
steps:
2419
- uses: actions/checkout@v5
2520
- uses: shivammathur/setup-php@v2
@@ -43,10 +38,6 @@ jobs:
4338
- 8.3
4439
- 8.2
4540
- 8.1
46-
- 8.0
47-
- 7.4
48-
- 7.3
49-
- 7.2
5041
steps:
5142
- uses: actions/checkout@v5
5243
- uses: shivammathur/setup-php@v2

composer.json

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
2-
"name": "react/promise",
2+
"name": "internal/promise",
33
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
44
"license": "MIT",
5+
"keywords": [
6+
"promise",
7+
"promises"
8+
],
59
"authors": [
610
{
711
"name": "Jan Sorgalla",
@@ -25,7 +29,10 @@
2529
}
2630
],
2731
"require": {
28-
"php": ">=7.1.0"
32+
"php": ">=8.1.0"
33+
},
34+
"replace": {
35+
"react/promise": "^3.0"
2936
},
3037
"require-dev": {
3138
"phpstan/phpstan": "1.12.28 || 1.4.10",
@@ -50,8 +57,18 @@
5057
"tests/Fiber.php"
5158
]
5259
},
53-
"keywords": [
54-
"promise",
55-
"promises"
56-
]
60+
"config": {
61+
"audit": {
62+
"abandoned": "report"
63+
},
64+
"sort-packages": true
65+
},
66+
"scripts": {
67+
"stan": "stan",
68+
"test": "phpunit --color=always --testdox",
69+
"test:cc": [
70+
"@putenv XDEBUG_MODE=coverage",
71+
"phpunit --coverage-clover=runtime/phpunit/logs/clover.xml --color=always"
72+
]
73+
}
5774
}

tests/PromiseTest.php

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -139,76 +139,6 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfResolverThrowsExceptio
139139
$this->assertSame(0, gc_collect_cycles());
140140
}
141141

142-
/**
143-
* Test that checks number of garbage cycles after throwing from a canceller
144-
* that explicitly uses a reference to the promise. This is rather synthetic,
145-
* actual use cases often have implicit (hidden) references which ought not
146-
* to be stored in the stack trace.
147-
*
148-
* Reassigned arguments only show up in the stack trace in PHP 7, so we can't
149-
* avoid this on legacy PHP. As an alternative, consider explicitly unsetting
150-
* any references before throwing.
151-
*
152-
* @test
153-
* @requires PHP 7
154-
*/
155-
public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException(): void
156-
{
157-
gc_collect_cycles();
158-
/** @var Promise<never> $promise */
159-
$promise = new Promise(function () {}, function () use (&$promise) {
160-
assert($promise instanceof Promise);
161-
throw new \Exception('foo');
162-
});
163-
$promise->cancel();
164-
unset($promise);
165-
166-
$this->assertSame(0, gc_collect_cycles());
167-
}
168-
169-
/**
170-
* @test
171-
* @requires PHP 7
172-
* @see self::shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException
173-
*/
174-
public function shouldRejectWithoutCreatingGarbageCyclesIfResolverWithReferenceThrowsException(): void
175-
{
176-
gc_collect_cycles();
177-
/** @var Promise<never> $promise */
178-
$promise = new Promise(function () use (&$promise) {
179-
assert($promise instanceof Promise);
180-
throw new \Exception('foo');
181-
});
182-
183-
$promise->then(null, $this->expectCallableOnce()); // avoid reporting unhandled rejection
184-
185-
unset($promise);
186-
187-
$this->assertSame(0, gc_collect_cycles());
188-
}
189-
190-
/**
191-
* @test
192-
* @requires PHP 7
193-
* @see self::shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException
194-
*/
195-
public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerHoldsReferenceAndResolverThrowsException(): void
196-
{
197-
gc_collect_cycles();
198-
/** @var Promise<never> $promise */
199-
$promise = new Promise(function () {
200-
throw new \Exception('foo');
201-
}, function () use (&$promise) {
202-
assert($promise instanceof Promise);
203-
});
204-
205-
$promise->then(null, $this->expectCallableOnce()); // avoid reporting unhandled rejection
206-
207-
unset($promise);
208-
209-
$this->assertSame(0, gc_collect_cycles());
210-
}
211-
212142
/** @test */
213143
public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingPromise(): void
214144
{

0 commit comments

Comments
 (0)