Skip to content

Commit

Permalink
fix: phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
FurkanGM committed Mar 26, 2023
1 parent a3273e8 commit fc96727
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
Empty file removed phpstan-baseline.neon
Empty file.
6 changes: 1 addition & 5 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
includes:
- phpstan-baseline.neon

parameters:
level: 4
level: 5
paths:
- src
- config
Expand All @@ -11,4 +8,3 @@ parameters:
checkOctaneCompatibility: true
checkModelProperties: true
checkMissingIterableValueType: false

8 changes: 5 additions & 3 deletions src/Console/Commands/CreatePageTemplateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CreatePageTemplateCommand extends GeneratorCommand

protected $type = 'Page Template';

public function handle()
public function handle(): ?bool
{
$name = $this->argument('name') ?? $this->ask('What is page template name?');

Expand All @@ -29,15 +29,15 @@ public function handle()
if ($this->isReservedName($className)) {
$this->error('The name "'.$className.'" is reserved by PHP.');

return;
return false;
}

$path = $this->getPath($className);

if ($this->files->exists($path)) {
$this->error(basename($className).' already exists!');

return;
return false;
}

$this->makeDirectory($path);
Expand All @@ -53,6 +53,8 @@ public function handle()
}

$this->info($this->type.' created successfully.');

return true;
}

protected function getDefaultNamespace($rootNamespace): string
Expand Down
2 changes: 1 addition & 1 deletion src/FilamentPageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function setResource(string $resource): void
}

/**
* @return class-string<Page>
* @return class-string<PageResource>
*/
public function getResource()
{
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/PageResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public static function form(Form $form): Form
$additionalOutsideFields = [];

if ($livewire instanceof (Pages\EditPage::class) || filled($get('template'))) {
$additionalMainFields = $record?->getTemplate()->mainFields() ?? FilamentPageManager::getPageTemplate($get('template'))->mainFields();
$additionalOutsideFields = $record?->getTemplate()->outsideFields() ?? FilamentPageManager::getPageTemplate($get('template'))->outsideFields();
$additionalMainFields = $record->getTemplate()->mainFields() ?? FilamentPageManager::getPageTemplate($get('template'))->mainFields();
$additionalOutsideFields = $record->getTemplate()->outsideFields() ?? FilamentPageManager::getPageTemplate($get('template'))->outsideFields();
}

return array_merge([
Expand Down Expand Up @@ -71,10 +71,10 @@ public static function form(Form $form): Form
->schema([
Forms\Components\Placeholder::make('created_at')
->label(__('filament-page-manager::fields.creation_date'))
->content(fn (?Page $record): string => $record?->created_at->diffForHumans() ?? '-'),
->content(fn (?Page $record): string => $record?->created_at->diffForHumans() ?? '-'), /* @phpstan-ignore-line */
Forms\Components\Placeholder::make('updated_at')
->label(__('filament-page-manager::fields.updated_date'))
->content(fn (?Page $record): string => $record?->updated_at->diffForHumans() ?? '-'),
->content(fn (?Page $record): string => $record?->updated_at->diffForHumans() ?? '-'), /* @phpstan-ignore-line */
]),
], $additionalFields);
}),
Expand Down

0 comments on commit fc96727

Please sign in to comment.