1 | <?php |
||
2 | |||
3 | namespace Database\Factories; |
||
4 | |||
5 | use App\Models\Syslog; |
||
6 | use Carbon\Carbon; |
||
7 | use Illuminate\Database\Eloquent\Factories\Factory; |
||
8 | |||
9 | /** @extends Factory<Syslog> */ |
||
10 | class SyslogFactory extends Factory |
||
11 | { |
||
12 | /** |
||
13 | * The name of the factory's corresponding model. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $model = Syslog::class; |
||
18 | |||
19 | /** |
||
20 | * Define the model's default state. |
||
21 | * |
||
22 | * @return array |
||
23 | */ |
||
24 | public function definition() |
||
25 | { |
||
26 | $facilities = ['kern', 'user', 'mail', 'daemon', 'auth', 'syslog', 'lpr', 'news', 'uucp', 'cron', 'authpriv', 'ftp', 'ntp', 'security', 'console', 'solaris-cron', 'local0', 'local1', 'local2', 'local3', 'local4', 'local5', 'local6', 'local7']; |
||
27 | $levels = ['emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', 'debug']; |
||
28 | |||
29 | return [ |
||
30 | 'facility' => $this->faker->randomElement($facilities), |
||
31 | 'priority' => $this->faker->randomElement($levels), |
||
32 | 'level' => $this->faker->randomElement($levels), |
||
33 | 'tag' => $this->faker->asciify(str_repeat('*', $this->faker->numberBetween(0, 10))), |
||
0 ignored issues
–
show
|
|||
34 | 'timestamp' => Carbon::now(), |
||
35 | 'program' => $this->faker->asciify(str_repeat('*', $this->faker->numberBetween(0, 32))), |
||
36 | 'msg' => $this->faker->text(), |
||
37 | ]; |
||
38 | } |
||
39 | } |
||
40 |
This check compares calls to functions or methods with their respective definitions. If the call has more 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.