1 | <?php |
||
20 | abstract class Eloquent implements IEloquent |
||
21 | { |
||
22 | use Containerable, Timestampable, Eventable; |
||
23 | |||
24 | protected $exists = false; |
||
25 | protected $timestamps = false; |
||
26 | |||
27 | /** @MustBeOverridden */ |
||
28 | const COLLECTION = null; |
||
29 | |||
30 | const PRIMARY_KEY = 'id'; |
||
31 | const CREATED_AT = 'created_at'; |
||
32 | const UPDATED_AT = 'updated_at'; |
||
33 | |||
34 | abstract protected static function di(): Container; |
||
35 | |||
36 | public function __construct(array $attributes = []) |
||
40 | |||
41 | public function getPrimaryKey(): string |
||
45 | |||
46 | public function setPrimaryKey(string $key) |
||
50 | |||
51 | final public static function getCollection(): string |
||
52 | { |
||
53 | if (static::COLLECTION == null) { |
||
54 | throw new IllegalCollectionException(); |
||
55 | } |
||
56 | return static::COLLECTION; |
||
57 | } |
||
58 | |||
59 | public function exists(bool $value = null): bool |
||
66 | |||
67 | public static function all(IQueryBuilder $query, callable $callback = null): ICollection |
||
80 | |||
81 | public static function find($id, array $columns = []): IEloquent |
||
89 | |||
90 | public static function findOrFail($id, array $columns = []): IEloquent |
||
98 | |||
99 | public static function create(array $attributes): IEloquent |
||
105 | |||
106 | public static function destroy($id) |
||
110 | |||
111 | public function save(array $columns = []) |
||
130 | |||
131 | public function delete() |
||
142 | } |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: