Skip to content

Commit

Permalink
Merge pull request #4 from lara-zeus/up-stan
Browse files Browse the repository at this point in the history
stan level 9
  • Loading branch information
atmonshi authored May 14, 2024
2 parents 8f4b4c4 + 04f2f0e commit 4003f76
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 1
level: 9
paths:
- src

Expand Down
2 changes: 2 additions & 0 deletions src/SpatieLaravelTranslatableContentDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function __construct(protected string $activeLocale)

public function isAttributeTranslatable(string $model, string $attribute): bool
{
/** @var Model $model */
$model = app($model);

if (! method_exists($model, 'isTranslatableAttribute')) {
Expand All @@ -42,6 +43,7 @@ public function makeRecord(string $model, array $data): Model
$record->getTranslatableAttributes() :
[];

/** @var Model $record */
$record->fill(Arr::except($data, $translatableAttributes));

if (method_exists($record, 'setTranslation')) {
Expand Down
13 changes: 2 additions & 11 deletions src/SpatieLaravelTranslatablePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

class SpatieLaravelTranslatablePlugin implements Plugin
{
/**
* @var array<string>
*/
protected array $defaultLocales = [];
protected ?array $defaultLocales = [];

protected ?Closure $getLocaleLabelUsing = null;

Expand Down Expand Up @@ -38,17 +35,11 @@ public function boot(Panel $panel): void
//
}

/**
* @return array<string>
*/
public function getDefaultLocales(): array
public function getDefaultLocales(): ?array
{
return $this->defaultLocales;
}

/**
* @param array<string> | null $defaultLocales
*/
public function defaultLocales(?array $defaultLocales = null): static
{
$this->defaultLocales = $defaultLocales;
Expand Down

0 comments on commit 4003f76

Please sign in to comment.