Issues (26)

src/Checks/Mixin/ConstraintCheck.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
4
namespace Pitchart\Phlunit\Checks\Mixin;
5
6
use PHPUnit\Framework\Assert;
7
use PHPUnit\Framework\Constraint\Constraint;
8
use PHPUnit\Framework\Constraint\LogicalNot;
9
10
trait ConstraintCheck
11
{
12 1
    public function has(Constraint $constraint): self
13
    {
14 1
        Assert::assertThat($this->value, $constraint);
15 1
        $this->resetMessage();
0 ignored issues
show
It seems like resetMessage() 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 ignore-call  annotation

15
        $this->/** @scrutinizer ignore-call */ 
16
               resetMessage();
Loading history...
16 1
        return $this;
17
    }
18
19 1
    public function is(Constraint $constraint): self
20
    {
21 1
        return $this->has($constraint);
22
    }
23
24 1
    public function hasNot(Constraint $constraint): self
25
    {
26 1
        Assert::assertThat($this->value, new LogicalNot($constraint));
27 1
        $this->resetMessage();
28 1
        return $this;
29
    }
30
31 1
    public function isNot(Constraint $constraint): self
32
    {
33 1
        return $this->hasNot($constraint);
34
    }
35
}
36