These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /** |
||
6 | * This file is part of phpDocumentor. |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | * |
||
11 | * @link http://phpdoc.org |
||
12 | */ |
||
13 | |||
14 | namespace Flyfinder\Specification; |
||
15 | |||
16 | use Mockery as m; |
||
17 | use PHPUnit\Framework\TestCase; |
||
18 | |||
19 | /** |
||
20 | * Test case for AndSpecification |
||
21 | * |
||
22 | * @coversDefaultClass \Flyfinder\Specification\AndSpecification |
||
23 | */ |
||
24 | class AndSpecificationTest extends TestCase |
||
25 | { |
||
26 | /** @var m\MockInterface|HasExtension */ |
||
27 | private $hasExtension; |
||
28 | |||
29 | /** @var m\MockInterface|IsHidden */ |
||
30 | private $isHidden; |
||
31 | |||
32 | /** @var AndSpecification */ |
||
33 | private $fixture; |
||
34 | |||
35 | /** |
||
36 | * Initializes the fixture for this test. |
||
37 | */ |
||
38 | public function setUp() : void |
||
39 | { |
||
40 | $this->hasExtension = m::mock(HasExtension::class); |
||
41 | $this->isHidden = m::mock(IsHidden::class); |
||
42 | $this->fixture = new AndSpecification($this->hasExtension, $this->isHidden); |
||
0 ignored issues
–
show
$this->isHidden is of type object<Mockery\LegacyMockInterface> , but the function expects a object<Flyfinder\Specifi...SpecificationInterface> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
43 | } |
||
44 | |||
45 | public function tearDown() : void |
||
46 | { |
||
47 | m::close(); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @covers ::__construct |
||
52 | * @covers ::isSatisfiedBy |
||
53 | */ |
||
54 | public function testIfSpecificationIsSatisfied() : void |
||
55 | { |
||
56 | $this->hasExtension->shouldReceive('isSatisfiedBy')->once()->andReturn(true); |
||
57 | $this->isHidden->shouldReceive('isSatisfiedBy')->once()->andReturn(true); |
||
58 | |||
59 | $this->assertTrue($this->fixture->isSatisfiedBy(['test'])); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @covers ::__construct |
||
64 | * @covers ::isSatisfiedBy |
||
65 | */ |
||
66 | public function testIfSpecificationIsNotSatisfied() : void |
||
67 | { |
||
68 | $this->hasExtension->shouldReceive('isSatisfiedBy')->once()->andReturn(true); |
||
69 | $this->isHidden->shouldReceive('isSatisfiedBy')->once()->andReturn(false); |
||
70 | |||
71 | $this->assertFalse($this->fixture->isSatisfiedBy(['test'])); |
||
72 | } |
||
73 | } |
||
74 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: