1 | <?php |
||
11 | trait RecordsTrait |
||
12 | { |
||
13 | protected static $sentDateField = 'date_sent'; |
||
14 | |||
15 | protected $daysToKeepData = 365; |
||
16 | |||
17 | /** |
||
18 | * @return \Nip\Database\Result |
||
19 | */ |
||
20 | 1 | public function reduceOldEmailsData() |
|
36 | |||
37 | /** |
||
38 | * @return string |
||
39 | */ |
||
40 | 2 | public static function getSentDateField(): string |
|
44 | |||
45 | /** |
||
46 | * @param string $sentDateField |
||
47 | */ |
||
48 | public static function setSentDateField(string $sentDateField) |
||
52 | |||
53 | /** |
||
54 | * @return float[]|int[] |
||
55 | */ |
||
56 | public static function reduceEmailsByType() |
||
62 | } |
||
63 |
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.