Issues (364)

TestSetup/Database/Seeders/UsersSeeder.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Database\Seeders;
4
5
use Illuminate\Database\Seeder;
6
use LaravelFreelancerNL\Aranguent\Auth\User;
7
8
class UsersSeeder extends Seeder
9
{
10
    /**
11
     * Run the database Seeds.
12
     *
13
     * @return void
14
     */
15
    public function run()
16
    {
17
        $users = '[
18
           {
19
              "_key":"LyannaStark",
20
              "username":"Lyanna Stark",
21
              "email":"[email protected]"
22
           }
23
        ]';
24
25
        $users = json_decode($users, JSON_OBJECT_AS_ARRAY);
0 ignored issues
show
Database\Seeders\JSON_OBJECT_AS_ARRAY of type integer is incompatible with the type boolean|null expected by parameter $associative of json_decode(). ( Ignorable by Annotation )

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

25
        $users = json_decode($users, /** @scrutinizer ignore-type */ JSON_OBJECT_AS_ARRAY);
Loading history...
26
27
        foreach ($users as $user) {
28
            User::insertOrIgnore($user);
29
        }
30
    }
31
}
32