[8.x] feature: upgrade to Laravel 13 (#2204)

* upgrade to laravel 13

* phpstan

* rollback to symfony 7.4

* fix: ModuleService merge

* refactor: new rector rules
This commit is contained in:
Arthur Parienté 2026-05-06 18:27:21 +02:00 committed by GitHub
parent e9c67b491c
commit 992b6d343a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
829 changed files with 4924 additions and 5354 deletions

View File

@ -15,6 +15,7 @@ class LoadConfiguration extends \Illuminate\Foundation\Bootstrap\LoadConfigurati
*
* @throws Exception
*/
#[\Override]
protected function loadConfigurationFiles(Application $app, RepositoryContract $repository)
{
parent::loadConfigurationFiles($app, $repository);

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Casts;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
@ -16,11 +18,11 @@ class CommaDelimitedCast implements CastsAttributes
*/
public function get($model, string $key, $value, array $attributes)
{
if (empty($value) || in_array(trim($value), ['', '0'], true)) {
if (empty($value) || in_array(trim((string) $value), ['', '0'], true)) {
return [];
}
return explode(',', $value);
return explode(',', (string) $value);
}
/**
@ -36,6 +38,6 @@ class CommaDelimitedCast implements CastsAttributes
return implode(',', $value);
}
return trim($value);
return trim((string) $value);
}
}

View File

@ -25,8 +25,8 @@ class DistanceCast implements CastsAttributes
try {
return new Distance($value, config('phpvms.internal_units.distance'));
} catch (NonNumericValue $e) {
} catch (NonStringUnitName $e) {
} catch (NonNumericValue) {
} catch (NonStringUnitName) {
return $value;
}

View File

@ -25,8 +25,8 @@ class FuelCast implements CastsAttributes
try {
return Fuel::make($value, config('phpvms.internal_units.fuel'));
} catch (NonNumericValue $e) {
} catch (NonStringUnitName $e) {
} catch (NonNumericValue) {
} catch (NonStringUnitName) {
return $value;
}

View File

@ -25,8 +25,8 @@ class MassCast implements CastsAttributes
try {
return Mass::make($value, config('phpvms.internal_units.mass'));
} catch (NonNumericValue $e) {
} catch (NonStringUnitName $e) {
} catch (NonNumericValue) {
} catch (NonStringUnitName) {
return $value;
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Casts;
use App\Support\Money;

View File

@ -1,250 +0,0 @@
<?php
namespace App\Console\Commands;
use App\Contracts\Command;
use App\Models\Flight;
use App\Support\Units\Time;
use GuzzleHttp\Client;
use Illuminate\Support\Collection;
use RuntimeException;
use stdClass;
class AcarsReplay extends Command
{
protected $signature = 'phpvms:replay {files} {--manual} {--write-all} {--no-submit}';
protected $description = 'Replay an ACARS file';
/**
* API Key to post as
*/
protected string $apiKey = 'testadminapikey';
/**
* For automatic updates, how many seconds to sleep between updates
*/
protected int $sleepTime = 10;
/**
* @var array key == update[callsign]
* value == PIREP ID
*/
protected array $pirepList = [];
protected Client $httpClient;
/**
* Return an instance of an HTTP client all ready to post
*/
public function __construct()
{
parent::__construct();
$this->httpClient = new Client([
'base_uri' => config('app.url'),
'headers' => [
'Authorization' => $this->apiKey,
],
]);
}
/**
* Make a request to start a PIREP
*
* @param stdClass $flight
*
* @throws RuntimeException
*/
protected function startPirep($flight): string
{
// convert the planned flight time to be completely in minutes
$pft = Time::hoursToMinutes(
$flight->planned_hrsenroute,
$flight->planned_minenroute
);
$flight_number = substr($flight->callsign, 3);
$response = $this->httpClient->post('/api/pireps/prefile', [
'json' => [
'airline_id' => 1,
'flight_number' => $flight_number,
'aircraft_id' => 1,
'dpt_airport_id' => $flight->planned_depairport,
'arr_airport_id' => $flight->planned_destairport,
'level' => $flight->planned_altitude,
'planned_flight_time' => $pft,
'route' => $flight->planned_route,
],
]);
$body = \json_decode($response->getBody()->getContents());
return $body->id;
}
/**
* Mark the PIREP as filed
*
*
* @return mixed
*
* @throws RuntimeException
*/
protected function filePirep($pirep_id)
{
$response = $this->httpClient->post('/api/pireps/'.$pirep_id.'/file', [
'json' => [],
]);
$body = \json_decode($response->getBody()->getContents());
return $body;
}
/**
* @return array
*
* @throws RuntimeException
*/
protected function postUpdate($pirep_id, $data)
{
$uri = '/api/pireps/'.$pirep_id.'/acars/position';
$position = [
'log' => '',
'lat' => $data->latitude,
'lon' => $data->longitude,
'heading' => $data->heading,
'altitude' => $data->altitude,
'altitude_agl' => $data->altitude,
'altitude_msl' => $data->altitude,
'gs' => $data->groundspeed,
'transponder' => $data->transponder,
];
$upd = [
'positions' => [
$position,
],
];
$this->info(
"Update: $data->callsign, $position[lat] x $position[lon] \t\t"
."hdg: $position[heading]\t\talt: $position[altitude]\t\tgs: $position[gs]"
);
$response = $this->httpClient->post($uri, [
'json' => $upd,
]);
$body = \json_decode($response->getBody()->getContents());
return [
$data->callsign,
$position['lat'],
$position['lon'],
$position['heading'],
$position['altitude'],
$position['altitude_agl'],
$position['altitude_msl'],
$position['gs'],
];
}
/**
* Parse this file and run the updates
*
*
* @throws RuntimeException
*/
protected function updatesFromFile(array $files)
{
$flights = collect($files)->transform(function ($f) {
$file = $f;
if (file_exists($file)) {
$this->info('Loading '.$file);
$contents = file_get_contents($file);
$contents = \json_decode($contents);
return collect($contents->updates);
}
$this->error($file.' not found, skipping');
return false;
})
// remove any of errored file entries
->filter(function ($value, $key) {
return $value !== false;
});
$this->info('Starting playback');
/*
* File the initial pirep to get a "preflight" status
*/
$flights->each(function (Collection $updates, $idx) {
$update = $updates->first();
$pirep_id = $this->startPirep($update);
$this->pirepList[$update->callsign] = $pirep_id;
$this->info('Prefiled '.$update->callsign.', ID: '.$pirep_id);
});
/*
* Iterate through all of the flights, retrieving the updates
* from each individual flight. Remove the update. Continue through
* until there are no updates left, at which point we remove the flight
* and updates.
*
* Continue until we have no more flights and updates left
*/
while ($flights->count() > 0) {
$flights = $flights->each(function (Collection $updates, $idx) {
/** @var Flight $update */
$update = $updates->shift();
$pirep_id = $this->pirepList[$update->callsign];
$this->postUpdate($pirep_id, $update);
// we're done and don't put the "no-submit" option
if ($updates->count() === 0 && !$this->option('no-submit')) {
$this->filePirep($pirep_id);
}
})->filter(function ($updates, $idx) {
return $updates->count() > 0;
});
if (!$this->option('write-all')) {
if (!$this->option('manual')) {
sleep($this->sleepTime);
} else {
$this->confirm('Send next batch of updates?', true);
}
}
}
}
/**
* Execute the console command.
*
* @throws RuntimeException
*/
public function handle(): void
{
$files = $this->argument('files');
$manual_mode = $this->option('manual');
if ($this->option('write-all')) {
$this->info('In "dump-all" mode, just writing it all in');
} elseif (!$manual_mode) {
/* @noinspection NestedPositiveIfStatementsInspection */
$this->info('Going to send updates every 10s');
} else {
$this->info('In "manual advance" mode');
}
$this->updatesFromFile(explode(',', $files));
$this->info('Done!');
}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Contracts\Command;
@ -14,12 +16,12 @@ class ClearCaches extends Command
/**
* {@inheritdoc}
*/
public function handle()
public function handle(): void
{
self::clearCaches();
}
public static function clearCaches()
public static function clearCaches(): void
{
// self::clearBootstrapCache();
self::clearModuleCache();
@ -33,7 +35,7 @@ class ClearCaches extends Command
/**
* Rescan for new modules
*/
private static function clearModuleCache()
private static function clearModuleCache(): void
{
Module::scan();
}

View File

@ -15,15 +15,12 @@ class ComposerCommand extends Command
/**
* Run composer update related commands
*/
public function handle()
public function handle(): void
{
switch (trim($this->argument('cmd'))) {
case 'post-update':
$this->postUpdate();
break;
default:
$this->error('Command exists');
}
match (trim($this->argument('cmd'))) {
'post-update' => $this->postUpdate(),
default => $this->error('Command exists'),
};
}
/**

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Contracts\Command;
@ -28,7 +30,7 @@ class CreateConfigs extends Command
*
* @throws FileException
*/
public function handle()
public function handle(): void
{
$this->writeConfigs();

View File

@ -29,17 +29,14 @@ class CreateDatabase extends Command
/**
* Create the mysql database
*
*
* @return bool
*/
protected function create_mysql_or_mariadb($dbkey)
protected function create_mysql_or_mariadb(string $dbkey): bool
{
$host = config($dbkey.'host');
$port = config($dbkey.'port');
$name = config($dbkey.'database');
$user = config($dbkey.'username');
$pass = config($dbkey.'password');
config($dbkey.'username');
config($dbkey.'password');
$dbSvc = new Database();
$dsn = $dbSvc->createDsn($host, $port);
@ -47,14 +44,14 @@ class CreateDatabase extends Command
try {
$conn = DB::connection(config('database.default'))->getPdo();
} catch (PDOException $e) {
Log::error($e);
} catch (PDOException $pdoException) {
Log::error($pdoException);
return false;
}
if ($this->option('reset') === true) {
$sql = "DROP DATABASE IF EXISTS `$name`";
$sql = sprintf('DROP DATABASE IF EXISTS `%s`', $name);
try {
Log::info('Dropping database: '.$sql);
@ -64,13 +61,13 @@ class CreateDatabase extends Command
}
}
$sql = "CREATE DATABASE IF NOT EXISTS `$name` CHARACTER SET UTF8MB4 COLLATE utf8mb4_unicode_ci";
$sql = sprintf('CREATE DATABASE IF NOT EXISTS `%s` CHARACTER SET UTF8MB4 COLLATE utf8mb4_unicode_ci', $name);
try {
Log::info('Creating database: '.$sql);
$conn->exec($sql);
} catch (PDOException $e) {
Log::error($e);
} catch (PDOException $pdoException) {
Log::error($pdoException);
return false;
}
@ -81,7 +78,7 @@ class CreateDatabase extends Command
/**
* Create the sqlite database
*/
protected function create_sqlite($dbkey)
protected function create_sqlite(string $dbkey)
{
$dbPath = config($dbkey.'database');
@ -117,10 +114,8 @@ class CreateDatabase extends Command
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
/*if ($this->option('reset')) {
if(!$this->confirm('The "reset" option will destroy the database, are you sure?')) {

View File

@ -28,22 +28,18 @@ class DevCommands extends Command
protected $description = 'Developer commands';
protected DatabaseService $dbSvc;
/**
* DevCommands constructor.
*/
public function __construct(DatabaseService $dbSvc)
public function __construct(protected DatabaseService $dbSvc)
{
parent::__construct();
$this->dbSvc = $dbSvc;
}
/**
* Run dev related commands
*/
public function handle()
public function handle(): void
{
$command = trim($this->argument('cmd'));
@ -86,7 +82,7 @@ class DevCommands extends Command
$headers = ['Award Name', 'Class'];
$formatted_awards = [];
foreach ($awards as $award) {
$formatted_awards[] = [$award->name, \get_class($award)];
$formatted_awards[] = [$award->name, $award::class];
}
$this->table($headers, $formatted_awards);
@ -217,7 +213,7 @@ class DevCommands extends Command
$this->info('Reading '.$file);
if (!file_exists($file)) {
$this->error('File '.$file.' doesn\'t exist');
$this->error('File '.$file." doesn't exist");
exit;
}
@ -253,7 +249,7 @@ class DevCommands extends Command
protected function resetInstall(): void
{
$confirm = $this->ask('This will erase your entire install and database, are you sure? y/n ');
if (strtolower($confirm) !== 'y') {
if (strtolower((string) $confirm) !== 'y') {
exit(0);
}
@ -270,22 +266,22 @@ class DevCommands extends Command
foreach ($tables as $table) {
Schema::dropIfExists($table);
}
} catch (QueryException $e) {
$this->error('DB error: '.$e->getMessage());
} catch (QueryException $queryException) {
$this->error('DB error: '.$queryException->getMessage());
}
$this->info('Deleting config file');
try {
unlink('config.php');
} catch (Exception $e) {
} catch (Exception) {
}
$this->info('Deleting env file');
try {
unlink('env.php');
} catch (Exception $e) {
} catch (Exception) {
}
$this->info('Clearing caches');
@ -309,6 +305,6 @@ class DevCommands extends Command
public function liveFlights(): void
{
$flights = Pirep::activeFlights(setting('acars.live_time'))->get()->toArray();
Pirep::activeFlights(setting('acars.live_time'))->get()->toArray();
}
}

View File

@ -21,7 +21,7 @@ class DevInstall extends Command
*
* @throws FileException
*/
public function handle()
public function handle(): void
{
if ($this->option('reset-configs')) {
$this->rewriteConfigs();

View File

@ -19,7 +19,7 @@ class EmailTest extends Command
*
* @throws FileException
*/
public function handle()
public function handle(): void
{
/** @var NotificationEventsHandler $eventHandler */
$eventHandler = app(NotificationEventsHandler::class);

View File

@ -12,24 +12,18 @@ class ImportCsv extends Command
protected $description = 'Import from a CSV file';
private ImportService $importer;
/**
* Import constructor.
*/
public function __construct(ImportService $importer)
public function __construct(private readonly ImportService $importer)
{
parent::__construct();
$this->importer = $importer;
}
/**
* @return mixed|void
*
* @throws ValidationException
*/
public function handle()
public function handle(): void
{
$type = $this->argument('type');
$file = $this->argument('file');

View File

@ -16,7 +16,7 @@ class ImportFromClassicCommand extends Command
/**
* Run dev related commands
*/
public function handle()
public function handle(): void
{
$creds = [
'host' => $this->argument('db_host'),
@ -29,6 +29,7 @@ class ImportFromClassicCommand extends Command
$importerSvc = new LegacyImporterService();
$importerSvc->saveCredentials($creds);
$manifest = $importerSvc->generateImportManifest();
foreach ($manifest as $record) {

View File

@ -34,17 +34,17 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
private string $panelStub = 'resources/stubs/modules/admin-panel-provider.stub';
public function handle()
public function handle(): void
{
$moduleName = $this->argument('module');
$this->module = app('modules')->find($moduleName);
if (!$this->module instanceof Module) {
$this->fail("Module {$moduleName} not found, are you sure it's installed and enabled?");
$this->fail(sprintf("Module %s not found, are you sure it's installed and enabled?", $moduleName));
}
// The provider file path
$path = str($this->module->getExtraPath("{$this->basePath}/{$this->className}"))
$path = str($this->module->getExtraPath(sprintf('%s/%s', $this->basePath, $this->className)))
->replace('\\', '/')
->append('.php')->toString();
@ -59,11 +59,11 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
'MODULE_NAMESPACE' => $this->laravel['modules']->config('namespace'),
]);
$this->info("The {$this->className} has been created at {$path}");
$this->info(sprintf('The %s has been created at %s', $this->className, $path));
$this->info("Adding {$this->className} to module.json and composer.json");
$this->info(sprintf('Adding %s to module.json and composer.json', $this->className));
$provider = "{$namespace}\\{$this->className}";
$provider = sprintf('%s\%s', $namespace, $this->className);
$moduleJson = json_decode($this->readFile(module_path($this->module->getName(), 'module.json')), true);
$providers = collect($moduleJson['providers']);
@ -81,7 +81,7 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
$this->writeFile(module_path($this->module->getName(), 'composer.json'), json_encode($composerJson, JSON_PRETTY_PRINT));
}
$this->info("Module {$this->module->getName()} is now ready for Filament!");
$this->info(sprintf('Module %s is now ready for Filament!', $this->module->getName()));
}
protected function copyPanelStubToApp(string $targetPath, ?array $replacements = []): void
@ -91,13 +91,13 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
$panelStubPath = base_path($this->panelStub);
if (!$this->fileExists($panelStubPath)) {
$this->fail("The panel stub file does not exist at {$panelStubPath}");
$this->fail('The panel stub file does not exist at '.$panelStubPath);
}
$stub = str($filesystem->get($panelStubPath));
foreach ($replacements as $key => $replacement) {
$stub = $stub->replace("{{ {$key} }}", $replacement);
$stub = $stub->replace(sprintf('{{ %s }}', $key), $replacement);
$stub = $stub->replace('$'.$key.'$', $replacement);
}
@ -118,7 +118,7 @@ class ModuleSetupFilament extends Command implements \Illuminate\Contracts\Conso
$filesystem = app(Filesystem::class);
if (!$this->fileExists($path)) {
$this->fail("The file does not exist at {$path}");
$this->fail('The file does not exist at '.$path);
}
return $filesystem->get($path);

View File

@ -14,11 +14,9 @@ class NavdataImport extends Command
protected $description = '';
/**
* @return void
*
* @throws InvalidArgumentException
*/
public function handle()
public function handle(): void
{
$this->info('Emptying the current navdata...');
Navdata::query()->truncate();
@ -78,39 +76,24 @@ class NavdataImport extends Command
foreach ($generator as $line) {
$navaid = [
'id' => trim(substr($line, 24, 4)), // ident column
'name' => trim(substr($line, 0, 24)),
'type' => trim(substr($line, 29, 4)),
'lat' => trim(substr($line, 33, 9)),
'lon' => trim(substr($line, 43, 11)),
'freq' => trim(substr($line, 54, 6)),
'class' => trim($line[60]),
'id' => trim(substr((string) $line, 24, 4)), // ident column
'name' => trim(substr((string) $line, 0, 24)),
'type' => trim(substr((string) $line, 29, 4)),
'lat' => trim(substr((string) $line, 33, 9)),
'lon' => trim(substr((string) $line, 43, 11)),
'freq' => trim(substr((string) $line, 54, 6)),
'class' => trim((string) $line[60]),
];
// Map to the Navaid enum
switch ($navaid['type']) {
case 'ILS':
$navaid['type'] = NavaidType::LOC;
break;
case 'ILSDME':
$navaid['type'] = NavaidType::LOC_DME;
break;
case 'NDB':
case 'NDBM':
case 'NDBO':
case 'MARI':
$navaid['type'] = NavaidType::NDB;
break;
case 'VOR':
$navaid['type'] = NavaidType::VOR;
break;
case 'VORD':
$navaid['type'] = NavaidType::VOR_DME;
break;
default:
$navaid['type'] = NavaidType::UNKNOWN;
break;
}
$navaid['type'] = match ($navaid['type']) {
'ILS' => NavaidType::LOC,
'ILSDME' => NavaidType::LOC_DME,
'NDB', 'NDBM', 'NDBO', 'MARI' => NavaidType::NDB,
'VOR' => NavaidType::VOR,
'VORD' => NavaidType::VOR_DME,
default => NavaidType::UNKNOWN,
};
/*if($navaid['id'] === 'LCH' || $navaid['id'] === 'RSG') {
print_r($navaid);
@ -163,11 +146,11 @@ class NavdataImport extends Command
$imported = 0;
foreach ($generator as $line) {
$navfix = [
'id' => trim(substr($line, 0, 4)), // ident column
'name' => trim(substr($line, 24, 6)),
'id' => trim(substr((string) $line, 0, 4)), // ident column
'name' => trim(substr((string) $line, 24, 6)),
'type' => NavaidType::FIX,
'lat' => trim(substr($line, 30, 10)),
'lon' => trim(substr($line, 40, 11)),
'lat' => trim(substr((string) $line, 30, 10)),
'lon' => trim(substr((string) $line, 40, 11)),
];
Navdata::updateOrCreate([

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Contracts\Command;
@ -15,7 +17,7 @@ class PirepExport extends Command
/**
* Run dev related commands
*/
public function handle()
public function handle(): void
{
$pirep_id = $this->argument('id');
if (empty($pirep_id)) {

View File

@ -16,7 +16,7 @@ class ProcessQueue extends Command
/**
* Run the queue tasks
*/
public function handle()
public function handle(): void
{
Artisan::call('queue:work', [
// '--sansdaemon' => null,

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Contracts\Command;
@ -17,7 +19,7 @@ class RewriteConfigs extends Command
/**
* Run dev related commands
*/
public function handle()
public function handle(): void
{
/** @var ConfigService $configSvc */
$configSvc = app(ConfigService::class);

View File

@ -14,7 +14,7 @@ class TestApi extends Command
/**
* Run dev related commands
*/
public function handle()
public function handle(): void
{
$this->httpClient = new Client([
'headers' => [

View File

@ -13,13 +13,9 @@ class Version extends Command
{
protected $signature = 'phpvms:version {--write} {--base-only} {--write-full-version} {version?}';
private VersionService $versionSvc;
public function __construct(VersionService $versionSvc)
public function __construct(private readonly VersionService $versionSvc)
{
parent::__construct();
$this->versionSvc = $versionSvc;
}
/**
@ -27,7 +23,7 @@ class Version extends Command
*
* @throws ParseException
*/
public function handle()
public function handle(): void
{
if ($this->option('write')) {
// Write the updated build number out to the file

View File

@ -18,7 +18,7 @@ class YamlExport extends Command
/**
* Run dev related commands
*/
public function handle()
public function handle(): void
{
$tables = $this->argument('tables');
if (empty($tables)) {

View File

@ -15,16 +15,12 @@ class YamlImport extends Command
protected $description = 'Developer commands';
protected DatabaseService $dbSvc;
/**
* YamlImport constructor.
*/
public function __construct(DatabaseService $dbSvc)
public function __construct(protected DatabaseService $dbSvc)
{
parent::__construct();
$this->dbSvc = $dbSvc;
}
/**
@ -32,7 +28,7 @@ class YamlImport extends Command
*
* @throws Exception
*/
public function handle()
public function handle(): void
{
$files = $this->argument('files');
if (empty($files)) {
@ -44,7 +40,7 @@ class YamlImport extends Command
foreach ($files as $file) {
if (!file_exists($file)) {
$this->error('File '.$file.' doesn\'t exist');
$this->error('File '.$file." doesn't exist");
exit;
}

View File

@ -24,13 +24,10 @@ use Illuminate\Console\Scheduling\Schedule;
class Cron
{
/** @var Schedule */
private $scheduler;
/**
* @var string[] The cron tasks which get called/run
*/
private $cronTasks = [
private array $cronTasks = [
JobQueue::class,
FiveMinute::class,
FifteenMinute::class,
@ -50,9 +47,8 @@ class Cron
*/
private $cronRunners = [];
public function __construct(Schedule $scheduler)
public function __construct(private readonly Schedule $scheduler)
{
$this->scheduler = $scheduler;
foreach ($this->cronTasks as $task) {
/** @var Command $cronTask */
$cronTask = app($task);
@ -83,7 +79,7 @@ class Cron
/** @var Event $event */
foreach ($events as $event) {
foreach ($this->cronRunners as $signature => $task) {
if (!str_contains($event->command, $signature)) {
if (!str_contains((string) $event->command, (string) $signature)) {
continue;
}

View File

@ -21,7 +21,7 @@ class FifteenMinute extends CronCommand
$this->callEvent();
}
public function callEvent()
public function callEvent(): void
{
event(new CronFifteenMinute());
}

View File

@ -24,7 +24,7 @@ class FiveMinute extends CronCommand
$this->callEvent();
}
public function callEvent()
public function callEvent(): void
{
event(new CronFiveMinute());
}

View File

@ -22,7 +22,7 @@ class Hourly extends CronCommand
$this->callEvent();
}
public function callEvent()
public function callEvent(): void
{
event(new CronHourly());
}

View File

@ -27,7 +27,7 @@ class JobQueue extends CronCommand
}
}
public function callEvent()
public function callEvent(): void
{
Artisan::call('queue:cron');
}

View File

@ -24,7 +24,7 @@ class Monthly extends CronCommand
$this->callEvent();
}
public function callEvent()
public function callEvent(): void
{
event(new CronMonthly());
}

View File

@ -24,7 +24,7 @@ class Nightly extends CronCommand
$this->callEvent();
}
public function callEvent()
public function callEvent(): void
{
event(new CronNightly());
}

View File

@ -21,7 +21,7 @@ class ThirtyMinute extends CronCommand
$this->callEvent();
}
public function callEvent()
public function callEvent(): void
{
event(new CronThirtyMinute());
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Console\Cron;
use App\Contracts\CronCommand;
@ -24,7 +26,7 @@ class Weekly extends CronCommand
$this->callEvent();
}
public function callEvent()
public function callEvent(): void
{
event(new CronWeekly());
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Console;
use App\Console\Cron\ActivityLogClean;
@ -27,6 +29,7 @@ class Kernel extends ConsoleKernel
* Then the CronServiceProvider has the list of cronjobs which then run according to the events
* and then calls those at the proper times.
*/
#[\Override]
protected function schedule(Schedule $schedule): void
{
// If not using the queue worker then run those via cron
@ -70,6 +73,7 @@ class Kernel extends ConsoleKernel
/**
* Register the Closure based commands for the application.
*/
#[\Override]
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Console;
use Exception;
@ -10,13 +12,13 @@ use Monolog\Handler\StreamHandler;
*/
class Logger
{
public function __invoke(array $config)
public function __invoke(array $config): \Monolog\Logger
{
$logger = new \Monolog\Logger('console');
try {
$logger->pushHandler(new StreamHandler('php://stdout'));
} catch (Exception $e) {
} catch (Exception) {
}
return $logger;

View File

@ -12,14 +12,11 @@ class Database
{
/**
* Create the base connection DSN, optionally include the DB name
*
* @param null $name
* @return string
*/
public function createDsn($host, $port, $name = null)
public function createDsn($host, $port, $name = null): string
{
$conn = config('database.default');
$dsn = "$conn:host=$host;port=$port";
$dsn = sprintf('%s:host=%s;port=%s', $conn, $host, $port);
if (filled($name)) {
$dsn .= ';dbname='.$name;
}
@ -28,18 +25,12 @@ class Database
}
/**
* @return PDO
*
* @throws PDOException
*/
public function createPDO($dsn, $user, $pass)
public function createPDO($dsn, $user, $pass): PDO
{
try {
$conn = new PDO($dsn, $user, $pass);
$conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
} catch (PDOException $e) {
throw $e;
}
$conn = new PDO($dsn, $user, $pass);
$conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
return $conn;
}

View File

@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
use App\Models\Airport;
use VaCentral\Models\Airport;
abstract class AirportLookup
{
@ -19,8 +21,8 @@ abstract class AirportLookup
*
* @example App\Services\AirportLookup\VaCentralLookup
*
* @param string $icao
* @return Airport|null
* @param string $icao
* @return Airport|array
*/
abstract public function getAirport($icao);
}

View File

@ -31,19 +31,7 @@ abstract class Award
*/
abstract public function check($parameter = null): bool;
/*
* You don't really need to mess with anything below here
*/
protected ?AwardModel $award;
protected ?User $user;
public function __construct(?AwardModel $award = null, ?User $user = null)
{
$this->award = $award;
$this->user = $user;
}
public function __construct(protected ?AwardModel $award = null, protected ?User $user = null) {}
/**
* Run the main handler for this award class to determine if
@ -83,10 +71,10 @@ abstract class Award
try {
$award->save();
} catch (Exception $e) {
} catch (Exception $exception) {
Log::error(
'Error saving award: '.$e->getMessage(),
$e->getTrace()
'Error saving award: '.$exception->getMessage(),
$exception->getTrace()
);
return false;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
use Illuminate\View\View;

View File

@ -44,7 +44,7 @@ abstract class Controller extends \Illuminate\Routing\Controller
{
// See if a list of values is passed in, or if a validation list is passed in
$is_validation = false;
if (array_filter(array_keys($attrs_or_validations), '\is_string') !== []) {
if (array_filter(array_keys($attrs_or_validations), \is_string(...)) !== []) {
$is_validation = true;
}
@ -64,7 +64,7 @@ abstract class Controller extends \Illuminate\Routing\Controller
}
if ($addtl_fields !== null && $addtl_fields !== []) {
$fields = array_merge($fields, $addtl_fields);
return array_merge($fields, $addtl_fields);
}
return $fields;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
use Illuminate\Support\Facades\Log;

View File

@ -17,15 +17,10 @@ abstract class Enum
protected static array $labels = [];
protected int $value;
/**
* Create an instance of this Enum
*/
final public function __construct($val)
{
$this->value = $val;
}
final public function __construct(protected int $value) {}
/**
* Return the value that's been set if this is an instance
@ -42,7 +37,7 @@ abstract class Enum
{
if (isset(static::$labels[$value])) {
$val = static::$labels[$value];
if (strpos($val, '.') !== false) {
if (str_contains($val, '.')) {
return trans($val);
}
@ -131,21 +126,19 @@ abstract class Enum
final public function equals(self $enum): bool
{
return $this->getValue() === $enum->getValue() && static::class === \get_class($enum);
return $this->getValue() === $enum->getValue() && static::class === $enum::class;
}
/**
* Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a
* class constant
*
* @param string $name
* @param array $arguments
* @return static
*
* @throws BadMethodCallException
* @throws ReflectionException
*/
public static function __callStatic($name, $arguments)
public static function __callStatic(string $name, array $arguments)
{
$array = static::toArray();
if (isset($array[$name])) {
@ -153,7 +146,7 @@ abstract class Enum
}
throw new BadMethodCallException(
"No static method or enum constant '$name' in class ".static::class
sprintf("No static method or enum constant '%s' in class ", $name).static::class
);
}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
use Illuminate\Foundation\Events\Dispatchable;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
use Illuminate\Database\Eloquent\Factories\Factory as EloquentFactory;

View File

@ -21,11 +21,8 @@ class FormRequest extends \Illuminate\Foundation\Http\FormRequest
/**
* Set a given column as being unique
*
*
* @return array
*/
public function unique($table)
public function unique($table): array
{
return [
Rule::unique($table)->ignore($this->id, 'id'),

View File

@ -49,11 +49,9 @@ class ImportExport
*/
public function getAirline($code): Airline
{
$airline = Airline::firstOrCreate([
return Airline::firstOrCreate([
'icao' => $code,
], ['name' => $code]);
return $airline;
}
/**
@ -114,7 +112,7 @@ class ImportExport
*/
protected function kvpToArray($kvp_str, array &$arr)
{
$item = explode('=', $kvp_str);
$item = explode('=', (string) $kvp_str);
if (\count($item) === 1) { // just a list?
$arr[] = trim($item[0]);
} else { // actually a key-value pair
@ -131,14 +129,11 @@ class ImportExport
* gate=B32;cost index=100
*
* Converted into a multi-dimensional array
*
*
* @return array|string
*/
public function parseMultiColumnValues($field)
public function parseMultiColumnValues($field): array
{
$ret = [];
$split_values = explode(';', $field);
$split_values = explode(';', (string) $field);
// No multiple values in here, just a straight value
if (\count($split_values) === 1) {
@ -146,7 +141,7 @@ class ImportExport
return [];
}
if (strpos($split_values[0], '?') !== false) {
if (str_contains($split_values[0], '?')) {
// This contains the query string, which turns it into a multi-level array
$query_str = explode('?', $split_values[0]);
$parent = trim($query_str[0]);
@ -154,7 +149,11 @@ class ImportExport
$children = [];
$kvp = explode('&', trim($query_str[1]));
foreach ($kvp as $items) {
if ($items === '' || $items === '0') {
if ($items === '') {
continue;
}
if ($items === '0') {
continue;
}
@ -178,7 +177,7 @@ class ImportExport
// This isn't in the query string format, so it's
// just a straight key-value pair set
if (strpos($value, '?') === false) {
if (!str_contains($value, '?')) {
$this->kvpToArray($value, $ret);
continue;
@ -193,7 +192,11 @@ class ImportExport
$children = [];
$kvp = explode('&', trim($query_str[1]));
foreach ($kvp as $items) {
if ($items === '' || $items === '0') {
if ($items === '') {
continue;
}
if ($items === '0') {
continue;
}
@ -223,19 +226,19 @@ class ImportExport
continue;
}
$key = trim($key);
$key = trim((string) $key);
if (!\is_array($val)) {
$val = trim($val);
$ret_list[] = "{$key}={$val}";
$val = trim((string) $val);
$ret_list[] = sprintf('%s=%s', $key, $val);
} else {
$q = [];
foreach ($val as $subkey => $subval) {
$q[] = is_numeric($subkey) ? $subval : "{$subkey}={$subval}";
$q[] = is_numeric($subkey) ? $subval : sprintf('%s=%s', $subkey, $subval);
}
$q = implode('&', $q);
$ret_list[] = $q === '' || $q === '0' ? $key : "{$key}?{$q}";
$ret_list[] = $q === '' || $q === '0' ? $key : sprintf('%s?%s', $key, $q);
}
}

View File

@ -27,7 +27,7 @@ abstract class Metar
/**
* Download the METAR, wrap in caching
*/
public function metar($icao): string
public function metar(string $icao): string
{
$cache = config('cache.keys.METAR_WEATHER_LOOKUP');
$key = $cache['key'].$icao;
@ -41,8 +41,8 @@ abstract class Metar
try {
$raw_metar = $this->get_metar($icao);
} catch (Exception $e) {
Log::error('Error getting METAR: '.$e->getMessage(), $e->getTrace());
} catch (Exception $exception) {
Log::error('Error getting METAR: '.$exception->getMessage(), $exception->getTrace());
return '';
}
@ -57,7 +57,7 @@ abstract class Metar
/**
* Download the TAF, wrap in caching
*/
public function taf($icao): string
public function taf(string $icao): string
{
$cache = config('cache.keys.TAF_WEATHER_LOOKUP');
$key = $cache['key'].$icao;
@ -71,8 +71,8 @@ abstract class Metar
try {
$taf = $this->get_taf($icao);
} catch (Exception $e) {
Log::error('Error getting TAF: '.$e->getMessage(), $e->getTrace());
} catch (Exception $exception) {
Log::error('Error getting TAF: '.$exception->getMessage(), $exception->getTrace());
return '';
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
use Closure;

View File

@ -32,21 +32,21 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
*
* @param string $file Full path to yml file to seed
*/
public function seedFile($file): void
public function seedFile(string $file): void
{
try {
$path = base_path($file);
Database::seed_from_yaml_file($path, false);
} catch (Exception $e) {
} catch (Exception $exception) {
Log::error('Unable to load '.$file.' file');
Log::error($e);
Log::error($exception);
}
}
/**
* Add rows to a table
*/
public function addData($table, $rows)
public function addData($table, $rows): void
{
foreach ($rows as $row) {
try {
@ -67,7 +67,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
*
* @throws ValidationException
*/
public function addAward(array $award)
public function addAward(array $award): void
{
$validator = Validator::make($award, Award::$rules);
if ($validator->fails()) {

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
use Illuminate\Database\Eloquent\Builder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts\Modules;
/**
@ -36,6 +38,7 @@ abstract class ServiceProvider extends \Illuminate\Support\ServiceProvider
* Deferred providers:
* https://laravel.com/docs/7.x/providers#deferred-providers
*/
#[\Override]
public function provides(): array
{
return [];

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
use Illuminate\Bus\Queueable;

View File

@ -23,7 +23,7 @@ class Resource extends JsonResource
* Iterate through the list of $fields and check if they're a "Unit"
* If they are, then add the response
*/
public function checkUnitFields(&$response, array $fields): void
public function checkUnitFields(array &$response, array $fields): void
{
foreach ($fields as $f) {
$response[$f] = $this->{$f} instanceof Unit ? $this->{$f}->getResponseUnits() : $this->{$f};
@ -37,6 +37,7 @@ class Resource extends JsonResource
* @param Request $request
* @return JsonResponse
*/
#[\Override]
public function toResponse($request)
{
return $this->resource instanceof AbstractPaginator
@ -44,9 +45,10 @@ class Resource extends JsonResource
: parent::toResponse($request);
}
#[\Override]
public static function collection($resource)
{
return tap(new CustomAnonymousResourceCollection($resource, static::class), function ($collection) {
return tap(new CustomAnonymousResourceCollection($resource, static::class), function ($collection): void {
if (property_exists(static::class, 'preserveKeys')) {
// TODO: figure out what is this preserveKeys thing and whether we still need this
// @phpstan-ignore-next-line

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
/**

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
/**

View File

@ -8,7 +8,7 @@ use Exception;
/**
* Abstract unit wrapper
*/
abstract class Unit implements ArrayAccess
abstract class Unit implements \Stringable, ArrayAccess
{
/**
* The localized unit the user wants it displayed in
@ -137,10 +137,7 @@ abstract class Unit implements ArrayAccess
// $this->units[$offset] = null;
}
/**
* @return mixed
*/
public function __toString()
public function __toString(): string
{
return (string) $this->offsetGet($this->localUnit);
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Contracts;
use Arrilot\Widgets\AbstractWidget;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Cron\Hourly;
use App\Contracts\Listener;
@ -12,12 +14,7 @@ use Illuminate\Support\Facades\Log;
*/
class ClearExpiredSimbrief extends Listener
{
private SimBriefService $simbriefSvc;
public function __construct(SimBriefService $simbriefSvc)
{
$this->simbriefSvc = $simbriefSvc;
}
public function __construct(private readonly SimBriefService $simbriefSvc) {}
public function handle(CronHourly $event): void
{

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Cron\Monthly;
use App\Contracts\Listener;
@ -15,15 +17,10 @@ use UnexpectedValueException;
*/
class ApplyExpenses extends Listener
{
private RecurringFinanceService $financeSvc;
/**
* ApplyExpenses constructor.
*/
public function __construct(RecurringFinanceService $financeSvc)
{
$this->financeSvc = $financeSvc;
}
public function __construct(private readonly RecurringFinanceService $financeSvc) {}
/**
* Apply all of the expenses for a month

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Cron\Nightly;
use App\Contracts\Listener;
@ -15,15 +17,10 @@ use UnexpectedValueException;
*/
class ApplyExpenses extends Listener
{
private RecurringFinanceService $financeSvc;
/**
* ApplyExpenses constructor.
*/
public function __construct(RecurringFinanceService $financeSvc)
{
$this->financeSvc = $financeSvc;
}
public function __construct(private readonly RecurringFinanceService $financeSvc) {}
/**
* Apply all of the expenses for a day

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Cron\Nightly;
use App\Contracts\Listener;
@ -9,12 +11,7 @@ use Illuminate\Support\Facades\Log;
class NewVersionCheck extends Listener
{
private VersionService $versionSvc;
public function __construct(VersionService $versionSvc)
{
$this->versionSvc = $versionSvc;
}
public function __construct(private readonly VersionService $versionSvc) {}
/**
* Set any users to being on leave after X days

View File

@ -14,15 +14,10 @@ use UnexpectedValueException;
*/
class PilotLeave extends Listener
{
private UserService $userSvc;
/**
* PilotLeave constructor.
*/
public function __construct(UserService $userSvc)
{
$this->userSvc = $userSvc;
}
public function __construct(private readonly UserService $userSvc) {}
/**
* Set any users to being on leave after X days

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Cron\Nightly;
use App\Contracts\Listener;
@ -15,15 +17,7 @@ use UnexpectedValueException;
*/
class RecalculateStats extends Listener
{
private AircraftService $aircraftSvc;
private UserService $userSvc;
public function __construct(AircraftService $aircraftSvc, UserService $userSvc)
{
$this->aircraftSvc = $aircraftSvc;
$this->userSvc = $userSvc;
}
public function __construct(private readonly AircraftService $aircraftSvc, private readonly UserService $userSvc) {}
/**
* Recalculate the stats for active users

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Cron\Nightly;
use App\Contracts\Listener;

View File

@ -40,6 +40,7 @@ class SetActiveFlights extends Listener
if (!$flight->active) {
continue;
}
// Set visible default
$flight->visible = true;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Cron\Weekly;
use App\Contracts\Listener;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -8,13 +10,5 @@ use App\Models\Pirep;
class AcarsUpdate extends Event
{
public Pirep $pirep;
public Acars $acars;
public function __construct(Pirep $pirep, Acars $acars)
{
$this->pirep = $pirep;
$this->acars = $acars;
}
public function __construct(public Pirep $pirep, public Acars $acars) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\UserAward;
class AwardAwarded extends Event
{
public UserAward $userAward;
public function __construct(UserAward $userAward)
{
$this->userAward = $userAward;
}
public function __construct(public UserAward $userAward) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -8,7 +10,4 @@ use App\Contracts\Event;
* This event is dispatched when the weekly cron is run
* It happens after all of the default nightly tasks
*/
class CronWeekly extends Event
{
public function __construct() {}
}
class CronWeekly extends Event {}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -28,10 +30,5 @@ use App\Models\Pirep;
*/
class Expenses extends Event
{
public ?Pirep $pirep;
public function __construct(?Pirep $pirep = null)
{
$this->pirep = $pirep;
}
public function __construct(public ?Pirep $pirep = null) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -27,10 +29,5 @@ use App\Models\Pirep;
*/
class Fares extends Event
{
public ?Pirep $pirep;
public function __construct(?Pirep $pirep = null)
{
$this->pirep = $pirep;
}
public function __construct(public ?Pirep $pirep = null) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\News;
class NewsAdded extends Event
{
public News $news;
public function __construct(News $news)
{
$this->news = $news;
}
public function __construct(public News $news) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\Pirep;
class PirepAccepted extends Event
{
public Pirep $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
public function __construct(public Pirep $pirep) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\Pirep;
class PirepCancelled extends Event
{
public Pirep $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
public function __construct(public Pirep $pirep) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\Pirep;
class PirepDiverted extends Event
{
public Pirep $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
public function __construct(public Pirep $pirep) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\Pirep;
class PirepFiled extends Event
{
public Pirep $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
public function __construct(public Pirep $pirep) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\Pirep;
class PirepPrefiled extends Event
{
public Pirep $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
public function __construct(public Pirep $pirep) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\Pirep;
class PirepRejected extends Event
{
public Pirep $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
public function __construct(public Pirep $pirep) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\Pirep;
class PirepStateChange extends Event
{
public Pirep $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
public function __construct(public Pirep $pirep) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -10,10 +12,5 @@ use App\Models\Pirep;
*/
class PirepStatusChange extends Event
{
public Pirep $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
public function __construct(public Pirep $pirep) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\Pirep;
class PirepUpdated extends Event
{
public Pirep $pirep;
public function __construct(Pirep $pirep)
{
$this->pirep = $pirep;
}
public function __construct(public Pirep $pirep) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -10,10 +12,5 @@ use App\Models\User;
*/
class ProcessAward extends Event
{
public User $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function __construct(public User $user) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Models\User;
@ -13,8 +15,14 @@ class ProfileUpdated
use InteractsWithSockets;
use SerializesModels;
/**
* @var User
*/
public $user;
/**
* @var bool
*/
public $avatarUpdated;
/**

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\User;
class TestEvent extends Event
{
public User $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function __construct(public User $user) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,10 +9,5 @@ use App\Models\User;
class UserAccepted extends Event
{
public User $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function __construct(public User $user) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -10,13 +12,5 @@ use App\Models\User;
*/
class UserStateChanged extends Event
{
public User $user;
public $old_state;
public function __construct(User $user, $old_state)
{
$this->user = $user;
$this->old_state = $old_state;
}
public function __construct(public User $user, public $old_state) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Events;
use App\Contracts\Event;
@ -7,22 +9,11 @@ use App\Models\User;
class UserStatsChanged extends Event
{
public User $user;
public $stat_name;
public $old_value;
/*
* When a user's stats change. Stats changed match the field name:
* airport
* flights
* rank
*/
public function __construct(User $user, $stat_name, $old_value)
{
$this->user = $user;
$this->stat_name = $stat_name;
$this->old_value = $old_value;
}
public function __construct(public User $user, public $stat_name, public $old_value) {}
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Exceptions;
use Illuminate\Http\JsonResponse;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Exceptions;
class AirportNotFound extends AbstractHttpException

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Exceptions;
use Exception;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Exceptions;
use App\Models\Aircraft;

Some files were not shown because too many files have changed in this diff Show More