GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (11)

src/GenerateCommand.php (3 issues)

1
<?php declare(strict_types=1);
2
3
namespace ProcyonWeb\TranslationGenerator;
4
5
use Illuminate\Console\Command;
6
7
class GenerateCommand extends Command
8
{
9
    protected $signature = 'translation:generate {lang=en} {--upload}';
10
11
    protected $description = 'Generate missing translation strings in php and Vue files';
12
13
    /** @var PhraseClient */
14
    private $client;
15
16
    public function __construct(PhraseClient $client)
17
    {
18
        parent::__construct();
19
        $this->client = $client;
20
    }
21
22
    public function handle(): void
23
    {
24
        $translatables = (new SearchService())->getTranslatableStrings(config('translation.generator.patterns'));
0 ignored issues
show
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

24
        $translatables = (new SearchService())->getTranslatableStrings(/** @scrutinizer ignore-call */ config('translation.generator.patterns'));
Loading history...
25
        $this->client->downloadFiles();
26
27
        $lang = $this->argument('lang');
28
        $fileName = 'resources/lang/' . $lang . '.json';
0 ignored issues
show
Are you sure $lang of type null|string|string[] can be used in concatenation? ( Ignorable by Annotation )

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

28
        $fileName = 'resources/lang/' . /** @scrutinizer ignore-type */ $lang . '.json';
Loading history...
29
        $jsonFile = file_get_contents($fileName);
30
        $translations = json_decode($jsonFile, true);
31
32
        foreach ($translatables as $translatable) {
33
            $translatable = str_replace('\\', '', $translatable);
34
            if (!array_key_exists($translatable, $translations)) {
35
                $translations[$translatable] = $translatable;
36
            }
37
        }
38
39
        $content = json_encode($translations, JSON_PRETTY_PRINT + JSON_UNESCAPED_UNICODE + JSON_UNESCAPED_SLASHES);
40
        file_put_contents($fileName, $content);
41
42
        $isUpload = $this->option('upload');
43
        if ($isUpload && $this->client->isReady()) {
44
            $this->client->uploadFile($content, $fileName, $lang);
0 ignored issues
show
It seems like $lang can also be of type null and string[]; however, parameter $langIso of ProcyonWeb\TranslationGe...aseClient::uploadFile() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

44
            $this->client->uploadFile($content, $fileName, /** @scrutinizer ignore-type */ $lang);
Loading history...
45
        }
46
    }
47
}