Issues (2963)

database/factories/LocationFactory.php (1 issue)

1
<?php
2
3
namespace Database\Factories;
4
5
use App\Models\Location;
6
use Illuminate\Database\Eloquent\Factories\Factory;
7
8
/** @extends Factory<Location> */
9
class LocationFactory extends Factory
10
{
11
    /**
12
     * The name of the factory's corresponding model.
13
     *
14
     * @var string
15
     */
16
    protected $model = Location::class;
17
18
    /**
19
     * Define the model's default state.
20
     *
21
     * @return array
22
     */
23
    public function definition()
24
    {
25
        return [
26
            'location' => $this->faker->randomElement([
0 ignored issues
show
The call to Faker\Generator::randomElement() has too few arguments starting with 'b'. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
            'location' => $this->faker->/** @scrutinizer ignore-call */ randomElement([

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.

Loading history...
27
                $this->faker->sentence($this->faker->numberBetween(1, 10)),
28
                str_replace("\n", ' ', $this->faker->address),
29
            ]),
30
        ];
31
    }
32
33
    /**
34
     * Indicate add lat,lng
35
     *
36
     * @return \Illuminate\Database\Eloquent\Factories\Factory
37
     */
38
    public function withCoordinates()
39
    {
40
        return $this->state(function (array $attributes) {
41
            return [
42
                'lat' => $this->faker->latitude,
43
                'lng' => $this->faker->longitude,
44
            ];
45
        });
46
    }
47
}
48