1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Zenstruck\Callback\Tests; |
6
|
|
|
|
7
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
8
|
|
|
use Zenstruck\Callback; |
9
|
|
|
use Zenstruck\Callback\Parameter; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @author Kevin Bond <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
final class StrictCallbackTest extends TestCase |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @test |
18
|
|
|
*/ |
19
|
|
|
public function invoke_with_non_parameters(): void |
20
|
|
|
{ |
21
|
|
|
$callback = Callback::createFor( |
22
|
|
|
function(string $string, float $float, ?int $int = null) { return [$string, $float, $int]; } |
23
|
|
|
); |
24
|
|
|
|
25
|
|
|
$this->assertSame(['6.2', 3.0, null], $callback->invoke(6.2, '3')); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @test |
30
|
|
|
*/ |
31
|
|
|
public function invoke_with_parameter(): void |
32
|
|
|
{ |
33
|
|
|
$ret = Callback::createFor( |
34
|
|
|
function(string $string, float $float, ?int $int = null) { return [$string, $float, $int]; } |
35
|
|
|
)->invoke( |
36
|
|
|
Parameter::typed('string', 6.2), |
37
|
|
|
Parameter::union( |
38
|
|
|
Parameter::typed('float', 3), |
39
|
|
|
Parameter::typed('string', '6.2') |
40
|
|
|
) |
41
|
|
|
); |
42
|
|
|
|
43
|
|
|
$this->assertSame(['6.2', 3.0, null], $ret); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @test |
48
|
|
|
*/ |
49
|
|
|
public function invoke_all(): void |
50
|
|
|
{ |
51
|
|
|
$ret = Callback::createFor( |
52
|
|
|
function(string $string, float $float, int $int = 16) { return [$string, $float, $int]; } |
53
|
|
|
)->invokeAll( |
54
|
|
|
Parameter::union( |
55
|
|
|
Parameter::typed('float', 3), |
56
|
|
|
Parameter::typed('string', '6.2') |
57
|
|
|
) |
58
|
|
|
); |
59
|
|
|
|
60
|
|
|
$this->assertSame(['6.2', 3.0, 16], $ret); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
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