1 | <?php namespace Arcanedev\LaravelMetrics\Metrics; |
||
13 | abstract class NullablePartition extends Metric |
||
14 | { |
||
15 | /* ----------------------------------------------------------------- |
||
16 | | Traits |
||
17 | | ----------------------------------------------------------------- |
||
18 | */ |
||
19 | |||
20 | use HasExpressions; |
||
21 | |||
22 | /* ----------------------------------------------------------------- |
||
23 | | Getters |
||
24 | | ----------------------------------------------------------------- |
||
25 | */ |
||
26 | |||
27 | /** |
||
28 | * Get the metric's type. |
||
29 | * |
||
30 | * @return string |
||
31 | */ |
||
32 | 4 | public function type(): string |
|
36 | |||
37 | /* ----------------------------------------------------------------- |
||
38 | | Main Methods |
||
39 | | ----------------------------------------------------------------- |
||
40 | */ |
||
41 | |||
42 | /** |
||
43 | * Calculate the `count` of the metric. |
||
44 | * |
||
45 | * @param \Illuminate\Database\Eloquent\Builder|string $model |
||
46 | * @param string $groupBy |
||
47 | * @param string|null $column |
||
48 | * |
||
49 | * @return \Arcanedev\LaravelMetrics\Results\PartitionResult|mixed |
||
50 | */ |
||
51 | 4 | protected function count(string $model, string $groupBy, $column = null) |
|
55 | |||
56 | /* ----------------------------------------------------------------- |
||
57 | | Other Methods |
||
58 | | ----------------------------------------------------------------- |
||
59 | */ |
||
60 | |||
61 | /** |
||
62 | * Handle the aggregate calculation of the metric. |
||
63 | * |
||
64 | * @param string $method |
||
65 | * @param \Illuminate\Database\Eloquent\Builder|string $model |
||
66 | * @param string $column |
||
67 | * @param string $groupBy |
||
68 | * |
||
69 | * @return \Arcanedev\LaravelMetrics\Results\PartitionResult|mixed |
||
70 | */ |
||
71 | 4 | protected function aggregate(string $method, $model, ?string $column, string $groupBy) |
|
93 | |||
94 | /** |
||
95 | * Format the aggregate result for the partition. |
||
96 | * |
||
97 | * @param \Illuminate\Database\Eloquent\Model $result |
||
98 | * @param string $groupBy |
||
99 | * |
||
100 | * @return array |
||
101 | */ |
||
102 | 4 | protected function formatAggregateResult($result, $groupBy): array |
|
110 | |||
111 | /** |
||
112 | * Make a new result instance. |
||
113 | * |
||
114 | * @param mixed|null $value |
||
115 | * |
||
116 | * @return \Arcanedev\LaravelMetrics\Results\PartitionResult|mixed |
||
117 | */ |
||
118 | 4 | protected function result($value = null) |
|
122 | } |
||
123 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: