Conditions | 1 |
Paths | 1 |
Total Lines | 9 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public function testAuthorUserModelBinding() |
||
36 | { |
||
37 | $crudApi = new CrudApi(['namespace' => 'Test\\Models\\', 'model' => 'Post']); |
||
38 | $related_field = $crudApi->getRelatedField('author_id'); |
||
39 | $this->assertEquals('author', $related_field); |
||
40 | $relation = $crudApi->getRelatedModel($related_field); |
||
41 | $class = get_class($relation); |
||
42 | $this->assertEquals('Test\\Models\\User', $class); |
||
43 | } |
||
44 | } |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: