| 1 | <?php |
||
| 32 | trait UnionTrait |
||
| 33 | { |
||
| 34 | /** |
||
| 35 | * {@inheritDoc} |
||
| 36 | */ |
||
| 37 | public function union()/*# : BuilderInterace */ |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritDoc} |
||
| 46 | */ |
||
| 47 | public function unionAll()/*# : BuilderInterace */ |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Build UNION/UNION ALL |
||
| 56 | * |
||
| 57 | * @param string $prefix |
||
| 58 | * @param array $settings |
||
| 59 | * @return string |
||
| 60 | * @access protected |
||
| 61 | */ |
||
| 62 | protected function buildUnion( |
||
| 73 | |||
| 74 | abstract public function setPrevious(StatementInterface $previous = null); |
||
| 75 | /** |
||
| 76 | * Return the builder |
||
| 77 | * |
||
| 78 | * @return BuilderInterface |
||
| 79 | * @access public |
||
| 80 | */ |
||
| 81 | abstract public function getBuilder()/*# : BuilderInterface */; |
||
| 82 | } |
||
| 83 |
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.