[CODESTYLE] Replace phpcs with php-cs-fixer (#1030)

* composer require --dev friendsofphp/php-cs-fixer:^2

* php-cs-fixer: ignore cache and custom local config file

* php-cs-fixer: initial config

* php-cs-fixer: replace commands in composer

* php-cs-fixer: add PSR12 "as good as it currently gets"

* php-cs-fixer: apply PSR12 to codebase

* tests: add workaround to keep unused imports for snapshot testing

* php-cs-fixer: apply no_unused_imports

* php-cs-fixer: apply array_syntax short

* php-cs-fixer: apply single_quote

* php-cs-fixer: switch ordered_imports sort_algorithm to alpha

Let's be opinionated here for consistency

* php-cs-fixer: split between non-tests and tests and share config

* php-cs-fixer: apply declare_strict_types for tests

* php-cs-fixer: apply fully_qualified_strict_types

* php-cs-fixer: apply space_after_semicolon

* php-cs-fixer: apply trailing_comma_in_multiline_array

* php-cs-fixer: apply trim_array_spaces

* php-cs-fixer: apply unary_operator_spaces

* php-cs-fixer: apply whitespace_after_comma_in_array

* php-cs-fixer: apply native_function_invocation

* php-cs-fixer: apply concat_space

* grumphp: reflect we're using phpcsfixer now

* composer remove --dev squizlabs/php_codesniffer

* gha: simplify fix-style approach

Not really necessary to remove packages and then manually prevent
unrelated commits creeping in

Co-authored-by: Barry vd. Heuvel <[email protected]>
This commit is contained in:
Markus Podar
2020-09-01 11:32:31 +02:00
committed by GitHub
co-authored by Barry vd. Heuvel
parent a96add6981
commit 764bc02b84
55 changed files with 310 additions and 217 deletions
+18 -18
View File
@@ -15,8 +15,8 @@ use Barryvdh\LaravelIdeHelper\Eloquent;
use Barryvdh\LaravelIdeHelper\Generator;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
/**
* A command to generate autocomplete information for your IDE
@@ -25,7 +25,6 @@ use Symfony\Component\Console\Input\InputArgument;
*/
class GeneratorCommand extends Command
{
/**
* The console command name.
*
@@ -59,7 +58,8 @@ class GeneratorCommand extends Command
* @param \Illuminate\View\Factory $view
*/
public function __construct(
/*ConfigRepository */ $config,
/*ConfigRepository */
$config,
Filesystem $files,
/* Illuminate\View\Factory */
$view
@@ -105,9 +105,9 @@ class GeneratorCommand extends Command
$helpers = '';
if ($this->option('helpers') || ($this->config->get('ide-helper.include_helpers'))) {
foreach ($this->config->get('ide-helper.helper_files', array()) as $helper) {
foreach ($this->config->get('ide-helper.helper_files', []) as $helper) {
if (file_exists($helper)) {
$helpers .= str_replace(array('<?php', '?>'), '', $this->files->get($helper));
$helpers .= str_replace(['<?php', '?>'], '', $this->files->get($helper));
}
}
} else {
@@ -134,10 +134,10 @@ class GeneratorCommand extends Command
//Use a sqlite database in memory, to avoid connection errors on Database facades
$this->config->set(
'database.connections.sqlite',
array(
[
'driver' => 'sqlite',
'database' => ':memory:',
)
]
);
$this->config->set('database.default', 'sqlite');
}
@@ -151,11 +151,11 @@ class GeneratorCommand extends Command
{
$filename = $this->config->get('ide-helper.filename');
return array(
array(
'filename', InputArgument::OPTIONAL, 'The path to the helper file', $filename
),
);
return [
[
'filename', InputArgument::OPTIONAL, 'The path to the helper file', $filename,
],
];
}
/**
@@ -168,11 +168,11 @@ class GeneratorCommand extends Command
$format = $this->config->get('ide-helper.format');
$writeMixins = $this->config->get('ide-helper.write_eloquent_model_mixins');
return array(
array('format', "F", InputOption::VALUE_OPTIONAL, 'The format for the IDE Helper', $format),
array('write_mixins', "W", InputOption::VALUE_OPTIONAL, 'Write mixins to Laravel Model?', $writeMixins),
array('helpers', "H", InputOption::VALUE_NONE, 'Include the helper files'),
array('memory', "M", InputOption::VALUE_NONE, 'Use sqlite memory driver'),
);
return [
['format', 'F', InputOption::VALUE_OPTIONAL, 'The format for the IDE Helper', $format],
['write_mixins', 'W', InputOption::VALUE_OPTIONAL, 'Write mixins to Laravel Model?', $writeMixins],
['helpers', 'H', InputOption::VALUE_NONE, 'Include the helper files'],
['memory', 'M', InputOption::VALUE_NONE, 'Use sqlite memory driver'],
];
}
}