The trait Idable provides a method equalsId that in turn relies on the
method getId(). If this method does not exist on a class mixing in this
trait, the method will fail.
Adding the getId() as an abstract method to the trait will make sure it
is available.
Loading history...
48
}
49
50
return $this->template;
51
}
52
53
/**
54
* Set the TemplateInterface to use for formatting match results.
55
*
56
* @param TemplateInterface $template
57
* @return $this
58
*/
59
public function setTemplate(TemplateInterface $template)
60
{
61
$this->template = $template;
62
63
return $this;
64
}
65
66
/**
67
* Set the Assertion bound to the matcher. Useful for checking
68
* flags from within a matcher.
69
*
70
* @param Assertion $assertion
71
* @return mixed
72
*/
73
public function setAssertion(Assertion $assertion)
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.