Skip to content

Commit f3c60cb

Browse files
committed
Apply fixes from StyleCI
1 parent 2edfc67 commit f3c60cb

File tree

182 files changed

+1857
-1621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+1857
-1621
lines changed

app/Console/Commands/GenerateHtaccess.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class GenerateHtaccess extends Command
2020
*
2121
* @var string
2222
*/
23-
protected $description = "Génère un fichier .htaccess au répertoire racine, "
23+
protected $description = 'Génère un fichier .htaccess au répertoire racine, '
2424
. "selon la configuration de l'application";
2525

2626
/**
@@ -33,7 +33,7 @@ public function handle(): int
3333
$template = file_get_contents(resource_path('templates/htaccess-template.txt'));
3434

3535
$directoryPath = config('app.directory_path');
36-
if(! empty($directoryPath)) {
36+
if (! empty($directoryPath)) {
3737
$directoryPath = '/' . $directoryPath;
3838
}
3939

app/Console/Commands/InitializeDatabase.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class InitializeDatabase extends Initializer
2020
*
2121
* @var string
2222
*/
23-
protected $description = "Initialise la base de données en créant le schéma de la base et les données";
23+
protected $description = 'Initialise la base de données en créant le schéma de la base et les données';
2424

2525
/**
2626
* Execute the console command.
@@ -30,22 +30,24 @@ class InitializeDatabase extends Initializer
3030
public function handle(): int
3131
{
3232
// Vérifier que les conditions d'exécution du script d'initialisation de la DB sont ok.
33-
if(! File::exists('.env')) {
33+
if (! File::exists('.env')) {
3434
$this->error("Vous devez initialiser l'environnement au préalable.");
35+
3536
return 1;
3637
}
3738

3839
// Eviter l'exécution en prod.
39-
if(app()->environment() === 'production') {
40-
$this->error("Vous ne pouvez pas initialiser la base de données dans un environnement "
41-
. "de production.");
40+
if (app()->environment() === 'production') {
41+
$this->error('Vous ne pouvez pas initialiser la base de données dans un environnement '
42+
. 'de production.');
43+
4244
return 1;
4345
}
4446

4547
// Exécuter effectivement la commande d'initialisation de la DB.
4648
$this->call('monde:update');
4749
$this->call('db:seed');
48-
$this->info("Base de données initialisée avec succès.");
50+
$this->info('Base de données initialisée avec succès.');
4951

5052
return 0;
5153
}

app/Console/Commands/InitializeEnvironment.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ class InitializeEnvironment extends Initializer
3131
public function handle(): int
3232
{
3333
// Vérifier que les conditions d'exécution du script d'initialisation sont ok.
34-
if(File::exists('.env')) {
34+
if (File::exists('.env')) {
3535
$this->error("Vous ne pouvez pas initialiser l'application car un fichier .env existe déjà.");
36+
3637
return 1;
3738
}
3839

@@ -63,7 +64,7 @@ private function generateKey(): void
6364

6465
private function generateLegacyHashKey(): void
6566
{
66-
$this->line("Génération de la clé de hachage (legacy) : LEGACY_SALT");
67+
$this->line('Génération de la clé de hachage (legacy) : LEGACY_SALT');
6768

6869
$path = base_path('.env');
6970
$salt = Str::random(32);

app/Console/Commands/Initializer.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ protected function initTestingEnv(): void
1414
{
1515
$this->line('Copie de .env --> .env.testing');
1616

17-
if(! File::exists(base_path('.env'))) {
18-
throw new FileNotFoundException("Fichier .env non existant.");
17+
if (! File::exists(base_path('.env'))) {
18+
throw new FileNotFoundException('Fichier .env non existant.');
1919
}
2020

2121
$testingPath = base_path('.env.testing');
@@ -31,20 +31,20 @@ protected function initTestingEnv(): void
3131
/**
3232
* Modifie la valeur d'une clé dans un fichier .env.
3333
*
34-
* @param string $path
35-
* @param string $key
36-
* @param string $newValue
37-
* @param string|null $oldValue
34+
* @param string $path
35+
* @param string $key
36+
* @param string $newValue
37+
* @param string|null $oldValue
3838
* @return bool Renvoie <code>true</code> en cas de succès lors de l'écriture de la nouvelle valeur,
3939
* <code>false</code> sinon.
4040
*/
4141
protected function saveEnvValueToFile(string $path, string $key, string $newValue, ?string $oldValue = null): bool
4242
{
43-
if($oldValue === null) {
43+
if ($oldValue === null) {
4444
$oldValue = '';
4545
}
4646

47-
if(!file_exists($path)) {
47+
if (! file_exists($path)) {
4848
return false;
4949
}
5050

@@ -54,6 +54,6 @@ protected function saveEnvValueToFile(string $path, string $key, string $newValu
5454
file_get_contents($path)
5555
));
5656

57-
return !($success === false);
57+
return ! ($success === false);
5858
}
5959
}

app/Console/Commands/OverrideVendorFiles.php

+8-5
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ class OverrideVendorFiles extends Command
2626

2727
/**
2828
* Indique l'emplacement source => destination des fichiers à override.
29+
*
2930
* @var string[]
3031
*/
3132
protected $fileCopies = [
32-
'app/Overrides/Searchable/SearchResult.php' => 'vendor/spatie/laravel-searchable/src/SearchResult.php'
33+
'app/Overrides/Searchable/SearchResult.php' => 'vendor/spatie/laravel-searchable/src/SearchResult.php',
3334
];
3435

3536
/**
@@ -40,6 +41,7 @@ class OverrideVendorFiles extends Command
4041
public function handle(): int
4142
{
4243
$this->copyFiles();
44+
4345
return 0;
4446
}
4547

@@ -51,12 +53,13 @@ private function copyFiles(): void
5153
$backupPath = storage_path('app/copy-backup/' . Str::random(6));
5254
mkdir($backupPath, 0777, true);
5355
} catch(\Exception $e) {
54-
$this->error("Impossible de créer le dossier.");
56+
$this->error('Impossible de créer le dossier.');
57+
5558
return;
5659
}
5760

5861
try {
59-
foreach($this->fileCopies as $origin => $destination) {
62+
foreach ($this->fileCopies as $origin => $destination) {
6063
$this->line("Copie de $origin ==> $destination");
6164

6265
$fileBackupPath = $backupPath . '/' . basename($destination);
@@ -65,9 +68,9 @@ private function copyFiles(): void
6568
copy($destinationPath, $fileBackupPath);
6669
copy($originPath, $destinationPath);
6770
}
68-
$this->info("Copies réalisées avec succès.");
71+
$this->info('Copies réalisées avec succès.');
6972
} catch(\Exception $e) {
70-
$this->error("Une des copies a échoué.");
73+
$this->error('Une des copies a échoué.');
7174
}
7275
}
7376
}

app/Console/Commands/RegenerateInfluences.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class RegenerateInfluences extends Command
2121
*
2222
* @var string
2323
*/
24-
protected $description = "Régénère les influences générées par les entités influençables.";
24+
protected $description = 'Régénère les influences générées par les entités influençables.';
2525

2626
/**
2727
* Execute the console command.
2828
*
29-
* @param RegenerateInfluenceService $regenerateInfluenceService
29+
* @param RegenerateInfluenceService $regenerateInfluenceService
3030
* @return int
3131
*/
3232
public function handle(RegenerateInfluenceService $regenerateInfluenceService): int
@@ -37,11 +37,12 @@ public function handle(RegenerateInfluenceService $regenerateInfluenceService):
3737
$regenerateInfluenceService->regenerate();
3838
$this->info('Influences regénérées avec succès ('
3939
. $regenerateInfluenceService->influenceCount() . ' influence(s) actuellement dans la base de données).');
40-
}
41-
catch (\Throwable $ex) {
40+
} catch (\Throwable $ex) {
4241
$this->error("Une erreur s'est produite : " . $ex->getMessage());
42+
4343
return 1;
4444
}
45+
4546
return 0;
4647
}
4748
}

app/Console/Commands/UpdateProject.php

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function handle(): int
3232
{
3333
$this->copyFiles();
3434
$this->migrateDatabase();
35+
3536
return 0;
3637
}
3738

app/Console/Kernel.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
1313
/**
1414
* Define the application's command schedule.
1515
*
16-
* @param Schedule $schedule
16+
* @param Schedule $schedule
1717
* @return void
1818
*/
1919
protected function schedule(Schedule $schedule): void
@@ -30,7 +30,7 @@ protected function schedule(Schedule $schedule): void
3030
*/
3131
protected function commands(): void
3232
{
33-
$this->load(__DIR__.'/Commands');
33+
$this->load(__DIR__ . '/Commands');
3434

3535
require base_path('routes/console.php');
3636
}

app/Events/Infrastructure/InfrastructureJudged.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class InfrastructureJudged implements InfluencableEvent
1919
/**
2020
* Create a new event instance.
2121
*
22-
* @param Infrastructure $infrastructure
22+
* @param Infrastructure $infrastructure
2323
*/
2424
public function __construct(Infrastructure $infrastructure)
2525
{

app/Events/Organisation/MembershipChanged.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MembershipChanged
1717
/**
1818
* Create a new event instance.
1919
*
20-
* @param Organisation $organisation
20+
* @param Organisation $organisation
2121
*/
2222
public function __construct(Organisation $organisation)
2323
{

app/Events/Organisation/TypeMigrated.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TypeMigrated
1717
/**
1818
* Create a new event instance.
1919
*
20-
* @param Organisation $organisation
20+
* @param Organisation $organisation
2121
*/
2222
public function __construct(Organisation $organisation)
2323
{

app/Events/Patrimoine/PatrimoineCategorized.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PatrimoineCategorized implements InfluencableEvent
1919
/**
2020
* Create a new event instance.
2121
*
22-
* @param Patrimoine $patrimoine
22+
* @param Patrimoine $patrimoine
2323
*/
2424
public function __construct(Patrimoine $patrimoine)
2525
{

app/Events/Pays/MapUpdated.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class MapUpdated implements InfluencableEvent
1919
/**
2020
* Create a new event instance.
2121
*
22-
* @param Pays $pays
22+
* @param Pays $pays
2323
*/
2424
public function __construct(Pays $pays)
2525
{

app/Http/Controllers/Api/AdminController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function __construct()
1818
/** @var Authenticatable&CustomUser|null $user */
1919
$user = $auth->user();
2020

21-
if(! $auth->check() || ! $user?->hasMinPermission('admin')) {
21+
if (! $auth->check() || ! $user?->hasMinPermission('admin')) {
2222
abort(403);
2323
}
2424
}

app/Http/Controllers/Api/ResourceController.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
class ResourceController extends Controller
1313
{
1414
/**
15-
* /resource
15+
* /resource.
1616
*
1717
* Ressources générées par les entités.
1818
*
19-
* @param Request $request
20-
* @param string $type
19+
* @param Request $request
20+
* @param string $type
2121
* @return ResourceCollection
2222
*
2323
* @urlParam type string required Type de l'entité générant des ressources. Prend les valeurs "ville", "pays",

app/Http/Controllers/Api/ResourceableController.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
class ResourceableController extends Controller
1616
{
1717
/**
18-
* /resourceable
18+
* /resourceable.
1919
*
2020
* Liste d'entités générant des ressources.
2121
*
22-
* @param Request $request
23-
* @param string $type
22+
* @param Request $request
23+
* @param string $type
2424
* @return ResourceCollection
2525
*
2626
* @urlParam type string required Type de l'entité générant des ressources. Prend les valeurs "ville", "pays",

app/Http/Controllers/BackOfficeController.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class BackOfficeController extends Controller
1515
{
1616
public function __construct()
1717
{
18-
$this->middleware(function(Request $request, \Closure $next): mixed {
19-
if(! auth()->user()?->hasMinPermission('ocgc')) {
18+
$this->middleware(function (Request $request, \Closure $next): mixed {
19+
if (! auth()->user()?->hasMinPermission('ocgc')) {
2020
abort(403);
2121
}
2222

@@ -25,8 +25,8 @@ public function __construct()
2525
}
2626

2727
/**
28-
* @param Manager $featureManager
29-
* @param RegenerateInfluenceService $regenerateInfluenceService
28+
* @param Manager $featureManager
29+
* @param RegenerateInfluenceService $regenerateInfluenceService
3030
* @return View
3131
*/
3232
public function advancedParameters(
@@ -58,7 +58,7 @@ public function purgeCache(): RedirectResponse
5858
}
5959

6060
/**
61-
* @param RegenerateInfluenceService $regenerateInfluenceService
61+
* @param RegenerateInfluenceService $regenerateInfluenceService
6262
* @return RedirectResponse
6363
*/
6464
public function regenerateInfluences(RegenerateInfluenceService $regenerateInfluenceService): RedirectResponse

0 commit comments

Comments
 (0)