Skip to content

Commit

Permalink
style(phpstan): add phpdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérémy ARGOUD committed Nov 28, 2024
1 parent daed6dd commit 0de99a0
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/Http/Controllers/Admin/Interfaces/ExportableCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ interface ExportableCrud
{
public function getExport(): ImportExport;

/**
* @return array<string, mixed>
*/
public function getExportParameters(): array;
}
3 changes: 3 additions & 0 deletions src/Http/Controllers/Admin/Interfaces/ImportableCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ interface ImportableCrud
{
public function getImport(): ImportExport;

/**
* @return array<string, mixed>
*/
public function getImportParameters(): array;
}
3 changes: 3 additions & 0 deletions src/Http/Controllers/Admin/Interfaces/MultiExportableCrud.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ interface MultiExportableCrud
public const QUERY_PARAM = 'export';
public const DEFAULT_EXPORT_NAME = 'default';

/**
* @return array<string, mixed>
*/
public function getAvailableExports(): array;
}
3 changes: 3 additions & 0 deletions src/Http/Requests/ImportRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class ImportRequest extends FormRequest
{
const PARAM_FILE = 'file';

/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
Expand Down
6 changes: 4 additions & 2 deletions src/Jobs/ExportJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ class ExportJob implements ShouldQueue
use SerializesModels;

private ImportExport $export;
private array $exportParameters;

public function __construct(ImportExport $export, array $exportParameters)
/**
* @param array<string, mixed> $exportParameters
*/
public function __construct(ImportExport $export, private array $exportParameters)
{
$this->export = $export;
$this->exportParameters = $exportParameters;
Expand Down
3 changes: 3 additions & 0 deletions src/Jobs/ImportJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class ImportJob implements ShouldQueue
use Queueable;
use SerializesModels;

/**
* @param array<string, mixed> $exportParameters
*/
public function __construct(
private ImportExport $export,
private array $exportParameters
Expand Down
7 changes: 5 additions & 2 deletions src/Models/ImportExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class ImportExport extends Model implements ImportExportInterface
self::COLUMN_STATUS => ImportExportStatus::class,
];

/**
* @var array|string[]
*/
protected array $dates = [
self::COLUMN_COMPLETED_AT,
];
Expand All @@ -68,7 +71,7 @@ public function user(): BelongsTo
return $this->belongsTo(config('backpack-async-import-export.user_model'));
}

protected static function boot()
protected static function boot(): void
{
parent::boot();
ImportExport::saving(function (ImportExport $export) {
Expand Down Expand Up @@ -128,7 +131,7 @@ public function getDownloadButton(): string
protected function isReady(): Attribute
{
return Attribute::make(
get: fn (): bool => ImportExportStatus::Successful === $this->{ImportExport::COLUMN_STATUS}
get: fn(): bool => ImportExportStatus::Successful === $this->{ImportExport::COLUMN_STATUS}
&& Storage::disk($this->disk)->exists($this->{self::COLUMN_FILENAME}),
);
}
Expand Down

0 comments on commit 0de99a0

Please sign in to comment.