| Total Complexity | 2 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class OrderStatusFactory extends Factory |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * The name of the factory's corresponding model. |
||
| 13 | * |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | protected $model = ModelOrderStatus::class; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Define the model's default state. |
||
| 20 | * |
||
| 21 | * @return array |
||
| 22 | */ |
||
| 23 | public function definition() |
||
| 24 | { |
||
| 25 | return [ |
||
| 26 | 'status' => EnumOrderStatus::from($this->faker->randomElement(EnumOrderStatus::toValues())), |
||
|
|
|||
| 27 | 'note' => $this->faker->randomElement([null, $this->faker->text]), |
||
| 28 | ]; |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Indicate that the status is "draft". |
||
| 33 | * |
||
| 34 | * @return \Illuminate\Database\Eloquent\Factories\Factory |
||
| 35 | */ |
||
| 36 | public function draft() |
||
| 40 | ]); |
||
| 41 | } |
||
| 43 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.