diff --git a/phpstan.neon b/phpstan.neon index 42ea68c..473ba8d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: 1 + level: 9 paths: - src diff --git a/src/SpatieLaravelTranslatableContentDriver.php b/src/SpatieLaravelTranslatableContentDriver.php index 52e4e97..897a728 100644 --- a/src/SpatieLaravelTranslatableContentDriver.php +++ b/src/SpatieLaravelTranslatableContentDriver.php @@ -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')) { @@ -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')) { diff --git a/src/SpatieLaravelTranslatablePlugin.php b/src/SpatieLaravelTranslatablePlugin.php index 63252f5..585a099 100644 --- a/src/SpatieLaravelTranslatablePlugin.php +++ b/src/SpatieLaravelTranslatablePlugin.php @@ -7,10 +7,7 @@ class SpatieLaravelTranslatablePlugin implements Plugin { - /** - * @var array - */ - protected array $defaultLocales = []; + protected ?array $defaultLocales = []; protected ?Closure $getLocaleLabelUsing = null; @@ -38,17 +35,11 @@ public function boot(Panel $panel): void // } - /** - * @return array - */ - public function getDefaultLocales(): array + public function getDefaultLocales(): ?array { return $this->defaultLocales; } - /** - * @param array | null $defaultLocales - */ public function defaultLocales(?array $defaultLocales = null): static { $this->defaultLocales = $defaultLocales;