1 | <?php |
||
12 | trait StaticMethodsTrait |
||
13 | { |
||
14 | /** |
||
15 | * @var self |
||
16 | */ |
||
17 | static protected $instance; |
||
18 | |||
19 | /** |
||
20 | * @param $entityManager |
||
21 | * @return RecordManager |
||
22 | */ |
||
23 | 6 | public static function get($entityManager) |
|
27 | |||
28 | /** |
||
29 | * @param string $alias |
||
30 | * @param RecordManager $entityManager |
||
31 | * @return void` |
||
32 | */ |
||
33 | 1 | public static function set($alias, $entityManager) |
|
37 | |||
38 | /** |
||
39 | * Singleton |
||
40 | * |
||
41 | * @return self |
||
42 | */ |
||
43 | 6 | public static function instance() |
|
50 | } |
||
51 |
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.