1 | <?php |
||||||
2 | |||||||
3 | namespace Butler\Graphql\Concerns; |
||||||
4 | |||||||
5 | use Amp\Loop; |
||||||
6 | use Closure; |
||||||
7 | use Exception; |
||||||
8 | |||||||
9 | use function Amp\call; |
||||||
10 | use function Amp\Promise\all; |
||||||
11 | |||||||
12 | trait AssertsPromises |
||||||
13 | { |
||||||
14 | /** |
||||||
15 | * @param \Amp\Promise|\React\Promise\PromiseInterface|mixed $promise |
||||||
0 ignored issues
–
show
|
|||||||
16 | * @param mixed|Closure $expectedValue |
||||||
17 | */ |
||||||
18 | 6 | public function assertPromiseFulfills($promise, $expectedValue = null): void |
|||||
19 | { |
||||||
20 | 6 | $this->addToAssertionCount(1); |
|||||
0 ignored issues
–
show
It seems like
addToAssertionCount() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
21 | |||||||
22 | 6 | if (is_array($promise)) { |
|||||
23 | 2 | $promise = all($promise); |
|||||
24 | } |
||||||
25 | |||||||
26 | try { |
||||||
27 | 6 | $result = null; |
|||||
28 | 6 | Loop::run(function () use (&$result, $promise) { |
|||||
29 | 5 | $result = yield call(function () use ($promise) { |
|||||
30 | 5 | return $promise; |
|||||
31 | }); |
||||||
32 | }); |
||||||
33 | 2 | } catch (Exception $e) { |
|||||
34 | 2 | $this->fail('Failed asserting that promise fulfills. Promise was rejected: ' . $e->getMessage()); |
|||||
0 ignored issues
–
show
It seems like
fail() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
35 | } |
||||||
36 | |||||||
37 | 4 | if ($expectedValue instanceof Closure) { |
|||||
38 | 1 | $this->assertTrue($expectedValue($result)); |
|||||
0 ignored issues
–
show
It seems like
assertTrue() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
39 | 1 | return; |
|||||
40 | } |
||||||
41 | |||||||
42 | 3 | if (! is_null($expectedValue)) { |
|||||
43 | 3 | $this->assertSame( |
|||||
0 ignored issues
–
show
It seems like
assertSame() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
44 | $expectedValue, |
||||||
45 | $result, |
||||||
46 | 'Failed asserting that promise fulfills with a specified value.' |
||||||
47 | ); |
||||||
48 | } |
||||||
49 | } |
||||||
50 | } |
||||||
51 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths