Issues (367)

app/Jobs/NotifyUserCompleteExport.php (2 issues)

Labels
1
<?php
2
3
namespace App\Jobs;
4
5
use App\Models\User;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Queue\SerializesModels;
8
use Illuminate\Queue\InteractsWithQueue;
9
use App\Exports\ExaminationStudentsExport;
10
use App\Mail\ExportReady;
11
use Illuminate\Contracts\Queue\ShouldQueue;
12
use Illuminate\Foundation\Bus\Dispatchable;
13
use App\Notifications\ExportReady as NotificationsExportReady;
14
15
class NotifyUserCompleteExport implements ShouldQueue
16
{
17
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
0 ignored issues
show
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Jobs\NotifyUserCompleteExport: $id, $relations, $class, $keyBy
Loading history...
18
19
    public $user;
20
    
21
    public function __construct(User $user)
22
    {
23
        $this->user = $user;
24
    }
25
26
    /**
27
     * Execute the job.
28
     *
29
     * @return void
30
     */
31
    public function handle()
32
    {
33
        try{
34
            ini_set('memory_limit', '-1');
35
            (new ExaminationStudentsExport)->queue('/examination/student_data_with_nsid.csv')->chain([
0 ignored issues
show
The call to App\Exports\ExaminationS...tsExport::__construct() has too few arguments starting with year. ( Ignorable by Annotation )

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

35
            (/** @scrutinizer ignore-call */ new ExaminationStudentsExport)->queue('/examination/student_data_with_nsid.csv')->chain([

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...
36
                (new ExportReady($this->user))
37
            ]);
38
            
39
        }catch(\Exception $e){
40
            $output = new \Symfony\Component\Console\Output\ConsoleOutput();
41
            $output->writeln($e->getMessage());
42
        }
43
    }
44
}
45