Skip to content

Commit

Permalink
updated styles and cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
dcblogdev committed Jul 27, 2022
1 parent 6eb80e2 commit 0340bc4
Show file tree
Hide file tree
Showing 58 changed files with 122 additions and 103 deletions.
37 changes: 22 additions & 15 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude([
'vendor',
'tests/Commands/__snapshots__',
])
;
use PhpCsFixer\Config;
use PhpCsFixer\Finder;

return PhpCsFixer\Config::create()
->setFinder($finder)
->setRules([
'@PSR2' => true,
$rules = [
'@PSR12' => true,
// Concatenation should be used with at least one whitespace around.
'concat_space' => ['spacing' => 'one'],
// Unused use statements must be removed.
'ordered_imports' => true,
// Removes extra empty lines.
'no_extra_consecutive_blank_lines' => true,
'no_extra_blank_lines' => true,
// An empty line feed should precede a return statement.
'blank_line_before_return' => true,
'blank_line_before_statement' => true,
// Unused use statements must be removed.
'no_unused_imports' => true,
// Remove trailing whitespace at the end of blank lines.
Expand All @@ -35,12 +28,26 @@
// Remove duplicated semicolons.
'no_empty_statement' => true,
// PHP multi-line arrays should have a trailing comma.
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => true,
// There should be no empty lines after class opening brace.
'no_blank_lines_after_class_opening' => true,
// There should not be blank lines between docblock and the documented element.
'no_blank_lines_after_phpdoc' => true,
// Phpdocs should start and end with content, excluding the very first and last line of the docblocks.
'phpdoc_trim' => true,
];

$finder = Finder::create()
->in(__DIR__)
->exclude([
'vendor',
'tests/Commands/__snapshots__',
])
;
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new Config())
->setFinder($finder)
->setRules($rules)
->setRiskyAllowed(true)
->setUsingCache(true);
2 changes: 1 addition & 1 deletion src/Commands/CommandMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CommandMakeCommand extends GeneratorCommand
*/
protected $description = 'Generate new Artisan command for the specified module.';

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
4 changes: 2 additions & 2 deletions src/Commands/ComponentClassMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ComponentClassMakeCommand extends GeneratorCommand
*/
protected $description = 'Create a new component-class for the specified module.';

public function handle() : int
public function handle(): int
{
if (parent::handle() === E_ERROR) {
return E_ERROR;
Expand All @@ -52,7 +52,7 @@ protected function writeComponentViewTemplate()
$this->call('module:make-component-view', ['name' => $this->argument('name') , 'module' => $this->argument('module')]);
}

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private function getControllerNameWithoutNamespace()
return class_basename($this->getControllerName());
}

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/DisableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DisableCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
/**
* check if user entred an argument
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/DumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DumpCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
$this->info('Generating optimized autoload modules.');

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/EnableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class EnableCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
/**
* check if user entred an argument
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/EventMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function getFileName()
return Str::studly($this->argument('name'));
}

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
4 changes: 2 additions & 2 deletions src/Commands/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract protected function getDestinationFilePath();
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
$path = str_replace('\\', '/', $this->getDestinationFilePath());

Expand Down Expand Up @@ -71,7 +71,7 @@ public function getClass()
*
* @return string
*/
public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
return '';
}
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct()
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
if (is_null($this->argument('name'))) {
return $this->installFromFile();
Expand All @@ -54,7 +54,7 @@ public function handle() : int
/**
* Install modules from modules.json file.
*/
protected function installFromFile() : int
protected function installFromFile(): int
{
if (!file_exists($path = base_path('modules.json'))) {
$this->error("File 'modules.json' does not exist in your project root.");
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/JobMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class JobMakeCommand extends GeneratorCommand

protected $argumentName = 'name';

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/LaravelModulesV6Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LaravelModulesV6Migrator extends Command
protected $name = 'module:v6:migrate';
protected $description = 'Migrate laravel-modules v5 modules statuses to v6.';

public function handle() : int
public function handle(): int
{
$moduleStatuses = [];
/** @var RepositoryInterface $modules */
Expand Down
6 changes: 5 additions & 1 deletion src/Commands/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ListCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
$this->table(['Name', 'Status', 'Priority', 'Path'], $this->getRows());

Expand Down Expand Up @@ -59,18 +59,22 @@ public function getModules()
switch ($this->option('only')) {
case 'enabled':
return $this->laravel['modules']->getByStatus(1);

break;

case 'disabled':
return $this->laravel['modules']->getByStatus(0);

break;

case 'priority':
return $this->laravel['modules']->getPriority($this->option('direction'));

break;

default:
return $this->laravel['modules']->all();

break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ListenerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function getTemplateContents()
]))->render();
}

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/MailMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MailMakeCommand extends GeneratorCommand

protected $argumentName = 'name';

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/MiddlewareMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class MiddlewareMakeCommand extends GeneratorCommand
*/
protected $description = 'Create a new middleware class for the specified module.';

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/MigrateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MigrateCommand extends Command
*
* @return mixed
*/
public function handle() : int
public function handle(): int
{
$this->module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/MigrateFreshCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MigrateFreshCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
$module = $this->argument('module');

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/MigrateRefreshCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MigrateRefreshCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
$module = $this->argument('module');

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/MigrateResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MigrateResetCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
$this->module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/MigrateRollbackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MigrateRollbackCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
$this->module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/MigrateStatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MigrateStatusCommand extends Command
*
* @return mixed
*/
public function handle() : int
public function handle(): int
{
$this->module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/MigrationMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function getClass()
/**
* Run the command.
*/
public function handle() : int
public function handle(): int
{
if (parent::handle() === E_ERROR) {
return E_ERROR;
Expand Down
6 changes: 3 additions & 3 deletions src/Commands/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ModelMakeCommand extends GeneratorCommand
*/
protected $description = 'Create a new model for the specified module.';

public function handle() : int
public function handle(): int
{
if (parent::handle() === E_ERROR) {
return E_ERROR;
Expand Down Expand Up @@ -116,7 +116,7 @@ private function handleOptionalControllerOption()

$this->call('module:make-controller', array_filter([
'controller' => $controllerName,
'module' => $this->argument('module')
'module' => $this->argument('module'),
]));
}
}
Expand Down Expand Up @@ -181,7 +181,7 @@ private function getFillable()
*
* @return string
*/
public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ModuleDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ModuleDeleteCommand extends Command
protected $name = 'module:delete';
protected $description = 'Delete a module from the application';

public function handle() : int
public function handle(): int
{
$this->laravel['modules']->delete($this->argument('module'));

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ModuleMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ModuleMakeCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
$names = $this->argument('name');
$success = true;
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/NotificationMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class NotificationMakeCommand extends GeneratorCommand
*/
protected $description = 'Create a new notification class for the specified module.';

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/PolicyMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PolicyMakeCommand extends GeneratorCommand
*/
protected $description = 'Create a new policy class for the specified module.';

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ProviderMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ProviderMakeCommand extends GeneratorCommand
*/
protected $description = 'Create a new service provider class for the specified module.';

public function getDefaultNamespace() : string
public function getDefaultNamespace(): string
{
$module = $this->laravel['modules'];

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/PublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PublishCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
if ($name = $this->argument('module')) {
$this->publish($name);
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/PublishConfigurationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PublishConfigurationCommand extends Command
/**
* Execute the console command.
*/
public function handle() : int
public function handle(): int
{
if ($module = $this->argument('module')) {
$this->publishConfiguration($module);
Expand Down
Loading

0 comments on commit 0340bc4

Please sign in to comment.