Updated compose dependencies

This commit is contained in:
Constantin Graf
2026-09-16 23:01:42 +02:00
committed by Constantin Graf
parent b33cf00788
commit 37579b1e5c
98 changed files with 2688 additions and 1819 deletions

View File

@@ -15,6 +15,7 @@ use App\Models\User;
use Exception;
use Illuminate\Support\Facades\Http;
use Log;
use Throwable;
class ApiService
{
@@ -42,7 +43,7 @@ class ApiService
return null;
}
} catch (\Throwable $e) {
} catch (Throwable $e) {
Log::warning('Failed to check for update', [
'message' => $e->getMessage(),
]);

View File

@@ -16,6 +16,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use RuntimeException;
class DashboardService
{
@@ -101,7 +102,7 @@ class DashboardService
$value1 = Carbon::createFromFormat('Y-m-d', $possibleDates->first(), $timeZone);
$value2 = Carbon::createFromFormat('Y-m-d', $possibleDates->last(), $timeZone);
if ($value2 === null || $value1 === null) {
throw new \RuntimeException('Provided date is not valid');
throw new RuntimeException('Provided date is not valid');
}
if ($value1->gt($value2)) {
$last = $value1;

View File

@@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use InvalidArgumentException;
class ReportPropertiesDto implements Castable
{
@@ -101,15 +102,15 @@ class ReportPropertiesDto implements Castable
public function get(Model $model, string $key, mixed $value, array $attributes): ReportPropertiesDto
{
if (! is_string($value)) {
throw new \InvalidArgumentException('The given value is not a string');
throw new InvalidArgumentException('The given value is not a string');
}
$data = json_decode($value, false);
if ($data === null) {
throw new \InvalidArgumentException('The given value is not a JSON string');
throw new InvalidArgumentException('The given value is not a JSON string');
}
foreach (self::REQUIRED_PROPERTIES as $property) {
if (! property_exists($data, $property)) {
throw new \InvalidArgumentException('The given JSON string does not contain the required property "'.$property.'"');
throw new InvalidArgumentException('The given JSON string does not contain the required property "'.$property.'"');
}
}
$dto = new ReportPropertiesDto;
@@ -145,7 +146,7 @@ class ReportPropertiesDto implements Castable
public function set(Model $model, string $key, mixed $value, array $attributes): string
{
if (! ($value instanceof ReportPropertiesDto)) {
throw new \InvalidArgumentException('The given value is not an instance of ReportPropertiesDto');
throw new InvalidArgumentException('The given value is not an instance of ReportPropertiesDto');
}
$data = (object) [
@@ -171,7 +172,7 @@ class ReportPropertiesDto implements Castable
$jsonString = json_encode($data);
if ($jsonString === false) {
throw new \InvalidArgumentException('Could not encode the given data to a JSON string');
throw new InvalidArgumentException('Could not encode the given data to a JSON string');
}
return $jsonString;
@@ -188,10 +189,10 @@ class ReportPropertiesDto implements Castable
$collection = new Collection;
foreach ($ids as $id) {
if (! is_string($id)) {
throw new \InvalidArgumentException('The given ID is not a string');
throw new InvalidArgumentException('The given ID is not a string');
}
if ($id !== TimeEntryFilter::NONE_VALUE && ! Str::isUuid($id)) {
throw new \InvalidArgumentException('The given ID is not a valid UUID');
throw new InvalidArgumentException('The given ID is not a valid UUID');
}
$collection->push($id);
}

View File

@@ -9,6 +9,7 @@ use Closure;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Validator;
use RuntimeException;
/**
* @template TModel of Model
@@ -133,7 +134,7 @@ class ImportDatabaseHelper
{
$jsonData = json_encode($data);
if ($jsonData === false) {
throw new \RuntimeException('Failed to encode data to JSON');
throw new RuntimeException('Failed to encode data to JSON');
}
return md5($jsonData);
@@ -164,7 +165,7 @@ class ImportDatabaseHelper
return $this->createEntity($identifierData, $createValues, $externalIdentifier);
} else {
throw new \RuntimeException('Not implemented');
throw new RuntimeException('Not implemented');
}
}

View File

@@ -9,13 +9,14 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use League\Csv\Exception as CsvException;
use League\Csv\Reader;
use Override;
class ClockifyProjectsImporter extends DefaultImporter
{
/**
* @throws ImportException
*/
#[\Override]
#[Override]
public function importData(string $data, string $timezone): void
{
try {
@@ -129,13 +130,13 @@ class ClockifyProjectsImporter extends DefaultImporter
return $billableRateKey;
}
#[\Override]
#[Override]
public function getName(): string
{
return __('importer.clockify_projects.name');
}
#[\Override]
#[Override]
public function getDescription(): string
{
return __('importer.clockify_projects.description');

View File

@@ -15,6 +15,7 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use League\Csv\Exception as CsvException;
use League\Csv\Reader;
use Override;
class ClockifyTimeEntriesImporter extends DefaultImporter
{
@@ -44,7 +45,7 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
/**
* @throws ImportException
*/
#[\Override]
#[Override]
public function importData(string $data, string $timezone): void
{
try {
@@ -262,13 +263,13 @@ class ClockifyTimeEntriesImporter extends DefaultImporter
return null;
}
#[\Override]
#[Override]
public function getName(): string
{
return __('importer.clockify_time_entries.name');
}
#[\Override]
#[Override]
public function getDescription(): string
{
return __('importer.clockify_time_entries.description');

View File

@@ -18,6 +18,7 @@ use App\Service\ColorService;
use App\Service\Import\ImportDatabaseHelper;
use App\Service\TimezoneService;
use Illuminate\Database\Eloquent\Builder;
use Override;
abstract class DefaultImporter implements ImporterContract
{
@@ -193,7 +194,7 @@ abstract class DefaultImporter implements ImporterContract
}
}
#[\Override]
#[Override]
public function getReport(): ReportDto
{
return new ReportDto(

View File

@@ -14,6 +14,7 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use League\Csv\Exception as CsvException;
use League\Csv\Reader;
use Override;
class GenericTimeEntriesImporter extends DefaultImporter
{
@@ -59,7 +60,7 @@ class GenericTimeEntriesImporter extends DefaultImporter
/**
* @throws ImportException
*/
#[\Override]
#[Override]
public function importData(string $data, string $timezone): void
{
try {
@@ -195,13 +196,13 @@ class GenericTimeEntriesImporter extends DefaultImporter
}
}
#[\Override]
#[Override]
public function getName(): string
{
return __('importer.generic_time_entries.name');
}
#[\Override]
#[Override]
public function getDescription(): string
{
return __('importer.generic_time_entries.description');

View File

@@ -7,6 +7,7 @@ namespace App\Service\Import\Importers;
use Exception;
use League\Csv\Exception as CsvException;
use League\Csv\Reader;
use Override;
class HarvestClientsImporter extends DefaultImporter
{
@@ -20,7 +21,7 @@ class HarvestClientsImporter extends DefaultImporter
/**
* @throws ImportException
*/
#[\Override]
#[Override]
public function importData(string $data, string $timezone): void
{
try {
@@ -62,13 +63,13 @@ class HarvestClientsImporter extends DefaultImporter
}
}
#[\Override]
#[Override]
public function getName(): string
{
return __('importer.harvest_clients.name');
}
#[\Override]
#[Override]
public function getDescription(): string
{
return __('importer.harvest_clients.description');

View File

@@ -8,6 +8,7 @@ use Exception;
use Illuminate\Support\Str;
use League\Csv\Exception as CsvException;
use League\Csv\Reader;
use Override;
class HarvestProjectsImporter extends DefaultImporter
{
@@ -24,7 +25,7 @@ class HarvestProjectsImporter extends DefaultImporter
/**
* @throws ImportException
*/
#[\Override]
#[Override]
public function importData(string $data, string $timezone): void
{
try {
@@ -93,13 +94,13 @@ class HarvestProjectsImporter extends DefaultImporter
}
}
#[\Override]
#[Override]
public function getName(): string
{
return __('importer.harvest_projects.name');
}
#[\Override]
#[Override]
public function getDescription(): string
{
return __('importer.harvest_projects.description');

View File

@@ -4,4 +4,6 @@ declare(strict_types=1);
namespace App\Service\Import\Importers;
class ImportException extends \Exception {}
use Exception;
class ImportException extends Exception {}

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace App\Service\Import\Importers;
use InvalidArgumentException;
class ImporterProvider
{
/**
@@ -49,7 +51,7 @@ class ImporterProvider
public function getImporter(string $type): ImporterContract
{
if (! array_key_exists($type, $this->importers)) {
throw new \InvalidArgumentException('Invalid importer type');
throw new InvalidArgumentException('Invalid importer type');
}
return new $this->importers[$type];

View File

@@ -14,6 +14,7 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use League\Csv\Exception as CsvException;
use League\Csv\Reader;
use Override;
class TogglTimeEntriesImporter extends DefaultImporter
{
@@ -43,7 +44,7 @@ class TogglTimeEntriesImporter extends DefaultImporter
/**
* @throws ImportException
*/
#[\Override]
#[Override]
public function importData(string $data, string $timezone): void
{
try {
@@ -193,13 +194,13 @@ class TogglTimeEntriesImporter extends DefaultImporter
}
}
#[\Override]
#[Override]
public function getName(): string
{
return __('importer.toggl_time_entries.name');
}
#[\Override]
#[Override]
public function getDescription(): string
{
return __('importer.toggl_time_entries.description');

View File

@@ -14,6 +14,7 @@ use League\Csv\CannotInsertRecord;
use League\Csv\Exception;
use League\Csv\UnavailableStream;
use League\Csv\Writer;
use LogicException;
use Spatie\TemporaryDirectory\TemporaryDirectory;
/**
@@ -116,7 +117,7 @@ abstract class CsvExport
private function validateRow(array $row): void
{
if (array_keys($row) !== static::HEADER) {
throw new \LogicException('Invalid row');
throw new LogicException('Invalid row');
}
}
}

View File

@@ -20,6 +20,7 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use InvalidArgumentException;
class TimeEntryAggregationService
{
@@ -526,7 +527,7 @@ class TimeEntryAggregationService
public function timeSlotsBetween(Carbon $start, Carbon $end, string $timezone, Weekday $startOfWeek, TimeEntryAggregationTypeInterval $interval, string $format): Collection
{
if ($start->gt($end)) {
throw new \InvalidArgumentException('Start date must be before end date');
throw new InvalidArgumentException('Start date must be before end date');
}
$slots = new Collection;
$current = $start->copy()->timezone($timezone);
@@ -539,7 +540,7 @@ class TimeEntryAggregationService
} elseif ($interval === TimeEntryAggregationTypeInterval::Year) {
$current->startOfYear();
} else {
throw new \InvalidArgumentException('Invalid interval');
throw new InvalidArgumentException('Invalid interval');
}
while ($current->lt($end)) {

View File

@@ -6,6 +6,7 @@ namespace App\Service;
use App\Models\User;
use Carbon\CarbonTimeZone;
use Exception;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log;
@@ -287,7 +288,7 @@ class TimezoneService
{
try {
return new CarbonTimeZone($user->timezone);
} catch (\Exception $e) {
} catch (Exception $e) {
Log::error('User has a invalid timezone', [
'user_id' => $user->getKey(),
'timezone' => $user->timezone,

View File

@@ -20,6 +20,7 @@ use App\Models\User;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
use InvalidArgumentException;
class UserService
{
@@ -148,7 +149,7 @@ class UserService
->whereBelongsTo($newOwner, 'user')
->first();
if ($userMembership === null) {
throw new \InvalidArgumentException('User is not a member of the organization');
throw new InvalidArgumentException('User is not a member of the organization');
}
$userMembership->role = Role::Owner->value;
$userMembership->save();