Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Cleanup: PHPStan was failing #100

Merged
merged 2 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Commands/ModuleFilamentInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ class ModuleFilamentInstallCommand extends Command implements \Illuminate\Contra
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$this->moduleName = $this->argument('module');
if (! $this->option('cluster')) {
$this->cluster = confirm('Do you want to organize your code into filament clusters?', true);
}
$module = $this->getModule(true);
// Ensure the Filament directories exist
$this->ensureFilamentDirectoriesExist();
// Create Filament Plugin
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ModuleMakeFilamentPageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function handle(): int
(string) str($view)
->replace($module->getLowerName() . '::', '')
->replace('.', DIRECTORY_SEPARATOR)
->prepend('views'.DIRECTORY_SEPARATOR)
->prepend('views' . DIRECTORY_SEPARATOR)
->append('.blade.php'),
);

Expand Down
10 changes: 5 additions & 5 deletions src/Commands/ModuleMakeFilamentThemeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function handle(): int
'yarn' => 'yarn add',
default => "{$pm} install",
};
$cdCommand = 'cd '.$module->getPath();
$cdCommand = 'cd ' . $module->getPath();

exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev");

Expand All @@ -66,17 +66,17 @@ public function handle(): int
'viewPathPrefix' => $viewPathPrefix,
]);

$this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.');
$this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.');

$buildDirectory = 'build-'.$module->getLowerName();
$buildDirectory = 'build-' . $module->getLowerName();
$moduleStudlyName = $module->getStudlyName();

if (empty(glob($module->getExtraPath('vite.config.*s')))) {
$this->components->warn('Action is required to complete the theme setup:');
$this->components->bulletList([
"It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.",
"If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:",
'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify',
'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify',
"Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`",
]);

Expand All @@ -103,7 +103,7 @@ public function handle(): int

protected function getDefaultStubPath(): string
{
return __DIR__.'/stubs';
return __DIR__ . '/stubs';
}

private function getModule(): Module
Expand Down
8 changes: 4 additions & 4 deletions src/Concerns/ModuleFilamentPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public function register(Panel $panel): void
$module = $this->getModule();
$useClusters = config('filament-modules.clusters.enabled', false);
$panel->discoverPages(
in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'),
in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'),
for: $module->appNamespace('\\Filament\\Pages')
);
$panel->discoverResources(
in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'),
in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'),
for: $module->appNamespace('\\Filament\\Resources')
);
$panel->discoverWidgets(
in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'),
in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'),
for: $module->appNamespace('\\Filament\\Widgets')
);

Expand All @@ -37,7 +37,7 @@ public function register(Panel $panel): void
);

if ($useClusters) {
$path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters');
$path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters');
$namespace = $module->appNamespace('\\Filament\\Clusters');
$panel->discoverClusters(
in: $path,
Expand Down