| 1 | <?php |
||
| 20 | trait WhereNullProvider |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @param string $field |
||
| 24 | * @return Query|$this|self |
||
| 25 | */ |
||
| 26 | 1 | public function orWhereNull(string $field): self |
|
| 30 | |||
| 31 | /** |
||
| 32 | * @param string $field |
||
| 33 | * @return Query|$this|self |
||
| 34 | */ |
||
| 35 | 2 | public function whereNull(string $field): self |
|
| 39 | |||
| 40 | /** |
||
| 41 | * @param string $field |
||
| 42 | * @return Query|$this|self |
||
| 43 | */ |
||
| 44 | 1 | public function orWhereNotNull(string $field): self |
|
| 48 | |||
| 49 | /** |
||
| 50 | * @param string $field |
||
| 51 | * @return Query|$this|self |
||
| 52 | */ |
||
| 53 | 2 | public function whereNotNull(string $field): self |
|
| 57 | } |
||
| 58 |
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
Idableprovides a methodequalsIdthat 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.