| 1 | <?php |
||
| 5 | trait InfiniteTrait |
||
| 6 | { |
||
| 7 | /*** |
||
| 8 | * Turns the pipe into an infinite stream by auto rewinding once it reachs |
||
| 9 | * the end. |
||
| 10 | * |
||
| 11 | * WARNING: toArray() will lead to an infinite loop if there is no limit() |
||
| 12 | * or other flow interrupting operations *after* infinite() |
||
| 13 | * |
||
| 14 | * @return \Pipes\Pipe |
||
| 15 | */ |
||
| 16 | |||
| 17 | public function infinite() |
||
| 21 | } |
||
| 22 |
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.