mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 18:13:11 +00:00
[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:
co-authored by
Barry vd. Heuvel
parent
a96add6981
commit
764bc02b84
@@ -23,16 +23,11 @@ jobs:
|
|||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: composer update --prefer-dist --no-progress
|
||||||
composer remove phpro/grumphp vimeo/psalm --no-update --dev
|
|
||||||
composer update --prefer-dist --no-progress
|
|
||||||
|
|
||||||
- run: composer fix-style
|
- run: composer fix-style
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
# Revert manual modifications so they don't get commited 💥
|
|
||||||
- run: git checkout -- composer.json
|
|
||||||
|
|
||||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
with:
|
with:
|
||||||
commit_message: composer fix-style
|
commit_message: composer fix-style
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
|
|
||||||
/.idea
|
/.idea
|
||||||
|
/.php_cs
|
||||||
|
/.php_cs.cache
|
||||||
|
/.php_cs.tests.cache
|
||||||
/composer.lock
|
/composer.lock
|
||||||
/vendor
|
/vendor
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// Share common rules between non-test and test files
|
||||||
|
return [
|
||||||
|
// PSR12 from https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4943
|
||||||
|
'@PSR2' => true,
|
||||||
|
'blank_line_after_opening_tag' => true,
|
||||||
|
'braces' => [
|
||||||
|
// Not-yet-implemented
|
||||||
|
// 'allow_single_line_anonymous_class_with_empty_body' => true,
|
||||||
|
],
|
||||||
|
'compact_nullable_typehint' => true,
|
||||||
|
'declare_equal_normalize' => true,
|
||||||
|
'lowercase_cast' => true,
|
||||||
|
'lowercase_static_reference' => true,
|
||||||
|
'new_with_braces' => true,
|
||||||
|
'no_blank_lines_after_class_opening' => true,
|
||||||
|
'no_leading_import_slash' => true,
|
||||||
|
'no_whitespace_in_blank_line' => true,
|
||||||
|
'ordered_class_elements' => [
|
||||||
|
'order' => [
|
||||||
|
'use_trait',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'ordered_imports' => [
|
||||||
|
'imports_order' => [
|
||||||
|
'class',
|
||||||
|
'function',
|
||||||
|
'const',
|
||||||
|
],
|
||||||
|
'sort_algorithm' => 'alpha',
|
||||||
|
],
|
||||||
|
'return_type_declaration' => true,
|
||||||
|
'short_scalar_cast' => true,
|
||||||
|
'single_blank_line_before_namespace' => true,
|
||||||
|
'single_trait_insert_per_statement' => true,
|
||||||
|
'ternary_operator_spaces' => true,
|
||||||
|
'visibility_required' => [
|
||||||
|
'elements' => [
|
||||||
|
'const',
|
||||||
|
'method',
|
||||||
|
'property',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
// Further quality-of-life improvements
|
||||||
|
'array_syntax' => [
|
||||||
|
'syntax' => 'short',
|
||||||
|
],
|
||||||
|
'concat_space' => [
|
||||||
|
'spacing' => 'one',
|
||||||
|
],
|
||||||
|
'fully_qualified_strict_types' => true,
|
||||||
|
'native_function_invocation' => [
|
||||||
|
'include' => [],
|
||||||
|
'strict' => true,
|
||||||
|
],
|
||||||
|
'no_unused_imports' => true,
|
||||||
|
'single_quote' => true,
|
||||||
|
'space_after_semicolon' => true,
|
||||||
|
'trailing_comma_in_multiline_array' => true,
|
||||||
|
'trim_array_spaces' => true,
|
||||||
|
'unary_operator_spaces' => true,
|
||||||
|
'whitespace_after_comma_in_array' => true,
|
||||||
|
];
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
$finder = PhpCsFixer\Finder::create()
|
||||||
|
->in(__DIR__)
|
||||||
|
->exclude('tests');
|
||||||
|
|
||||||
|
$config = require __DIR__ . '/.php_cs.common.php';
|
||||||
|
|
||||||
|
return PhpCsFixer\Config::create()
|
||||||
|
->setFinder($finder)
|
||||||
|
->setRules($config)
|
||||||
|
->setRiskyAllowed(true)
|
||||||
|
->setCacheFile(__DIR__ . '/.php_cs.cache');
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
$finder = PhpCsFixer\Finder::create()
|
||||||
|
->in(__DIR__ . '/tests')
|
||||||
|
->exclude('__snapshots__');
|
||||||
|
|
||||||
|
$config = require __DIR__ . '/.php_cs.common.php';
|
||||||
|
|
||||||
|
// Additional rules for tests
|
||||||
|
$config = array_merge(
|
||||||
|
$config,
|
||||||
|
[
|
||||||
|
'declare_strict_types' => true,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return PhpCsFixer\Config::create()
|
||||||
|
->setFinder($finder)
|
||||||
|
->setRules($config)
|
||||||
|
->setRiskyAllowed(true)
|
||||||
|
->setCacheFile(__DIR__ . '/.php_cs.tests.cache');
|
||||||
+9
-3
@@ -31,13 +31,13 @@
|
|||||||
"phpdocumentor/type-resolver": "^1.1.0"
|
"phpdocumentor/type-resolver": "^1.1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "^2",
|
||||||
"illuminate/config": "^6 || ^7 || ^8",
|
"illuminate/config": "^6 || ^7 || ^8",
|
||||||
"illuminate/view": "^6 || ^7 || ^8",
|
"illuminate/view": "^6 || ^7 || ^8",
|
||||||
"mockery/mockery": "^1.3",
|
"mockery/mockery": "^1.3",
|
||||||
"orchestra/testbench": "^4 || ^5 || ^6",
|
"orchestra/testbench": "^4 || ^5 || ^6",
|
||||||
"phpro/grumphp": "^0.19.0",
|
"phpro/grumphp": "^0.19.0",
|
||||||
"spatie/phpunit-snapshot-assertions": "^1.4 || ^2.2 || ^3",
|
"spatie/phpunit-snapshot-assertions": "^1.4 || ^2.2 || ^3",
|
||||||
"squizlabs/php_codesniffer": "^3.5",
|
|
||||||
"vimeo/psalm": "^3.12"
|
"vimeo/psalm": "^3.12"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
@@ -67,8 +67,14 @@
|
|||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"analyze": "psalm",
|
"analyze": "psalm",
|
||||||
"check-style": "phpcs -p --standard=PSR12 config/ resources/ src/ tests/ '--ignore=*__snapshots_*'",
|
"check-style": [
|
||||||
"fix-style": "phpcbf -p --standard=PSR12 config/ resources/ src/ tests/ '--ignore=*__snapshots_*'",
|
"php-cs-fixer fix --diff --diff-format=udiff --dry-run",
|
||||||
|
"php-cs-fixer fix --diff --diff-format=udiff --dry-run --config=.php_cs.tests.php"
|
||||||
|
],
|
||||||
|
"fix-style": [
|
||||||
|
"php-cs-fixer fix",
|
||||||
|
"php-cs-fixer fix --config=.php_cs.tests.php"
|
||||||
|
],
|
||||||
"test": "phpunit",
|
"test": "phpunit",
|
||||||
"test-regenerate": "phpunit -d --update-snapshots"
|
"test-regenerate": "phpunit -d --update-snapshots"
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-20
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -98,9 +98,9 @@ return array(
|
|||||||
|
|
||||||
'include_helpers' => false,
|
'include_helpers' => false,
|
||||||
|
|
||||||
'helper_files' => array(
|
'helper_files' => [
|
||||||
base_path() . '/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
|
base_path() . '/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
|
||||||
),
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -115,9 +115,9 @@ return array(
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'model_locations' => array(
|
'model_locations' => [
|
||||||
'app',
|
'app',
|
||||||
),
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -128,9 +128,9 @@ return array(
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'ignored_models' => array(
|
'ignored_models' => [
|
||||||
|
|
||||||
),
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -141,12 +141,12 @@ return array(
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'extra' => array(
|
'extra' => [
|
||||||
'Eloquent' => array('Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'),
|
'Eloquent' => ['Illuminate\Database\Eloquent\Builder', 'Illuminate\Database\Query\Builder'],
|
||||||
'Session' => array('Illuminate\Session\Store'),
|
'Session' => ['Illuminate\Session\Store'],
|
||||||
),
|
],
|
||||||
|
|
||||||
'magic' => array(),
|
'magic' => [],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -158,9 +158,9 @@ return array(
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'interfaces' => array(
|
'interfaces' => [
|
||||||
|
|
||||||
),
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -188,9 +188,9 @@ return array(
|
|||||||
| ),
|
| ),
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'custom_db_types' => array(
|
'custom_db_types' => [
|
||||||
|
|
||||||
),
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -226,10 +226,10 @@ return array(
|
|||||||
| Cast the given "real type" to the given "type".
|
| Cast the given "real type" to the given "type".
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'type_overrides' => array(
|
'type_overrides' => [
|
||||||
'integer' => 'int',
|
'integer' => 'int',
|
||||||
'boolean' => 'bool',
|
'boolean' => 'bool',
|
||||||
),
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -253,5 +253,4 @@ return array(
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'force_fqn' => false,
|
'force_fqn' => false,
|
||||||
|
];
|
||||||
);
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ grumphp:
|
|||||||
triggered_by: [php]
|
triggered_by: [php]
|
||||||
metadata:
|
metadata:
|
||||||
task: composer_script
|
task: composer_script
|
||||||
phpcs:
|
phpcsfixer:
|
||||||
script: check-style
|
script: check-style
|
||||||
triggered_by: [php]
|
triggered_by: [php]
|
||||||
metadata:
|
metadata:
|
||||||
|
|||||||
+13
-13
@@ -11,13 +11,13 @@
|
|||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper;
|
namespace Barryvdh\LaravelIdeHelper;
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use ReflectionClass;
|
|
||||||
use Barryvdh\Reflection\DocBlock;
|
use Barryvdh\Reflection\DocBlock;
|
||||||
use Barryvdh\Reflection\DocBlock\Context;
|
use Barryvdh\Reflection\DocBlock\Context;
|
||||||
use Barryvdh\Reflection\DocBlock\Tag\MethodTag;
|
|
||||||
use Illuminate\Config\Repository as ConfigRepository;
|
|
||||||
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
|
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
|
||||||
|
use Barryvdh\Reflection\DocBlock\Tag\MethodTag;
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Config\Repository as ConfigRepository;
|
||||||
|
use ReflectionClass;
|
||||||
|
|
||||||
class Alias
|
class Alias
|
||||||
{
|
{
|
||||||
@@ -31,12 +31,12 @@ class Alias
|
|||||||
protected $short;
|
protected $short;
|
||||||
protected $namespace = '__root';
|
protected $namespace = '__root';
|
||||||
protected $root = null;
|
protected $root = null;
|
||||||
protected $classes = array();
|
protected $classes = [];
|
||||||
protected $methods = array();
|
protected $methods = [];
|
||||||
protected $usedMethods = array();
|
protected $usedMethods = [];
|
||||||
protected $valid = false;
|
protected $valid = false;
|
||||||
protected $magicMethods = array();
|
protected $magicMethods = [];
|
||||||
protected $interfaces = array();
|
protected $interfaces = [];
|
||||||
protected $phpdoc = null;
|
protected $phpdoc = null;
|
||||||
|
|
||||||
/** @var ConfigRepository */
|
/** @var ConfigRepository */
|
||||||
@@ -50,7 +50,7 @@ class Alias
|
|||||||
* @param array $magicMethods
|
* @param array $magicMethods
|
||||||
* @param array $interfaces
|
* @param array $interfaces
|
||||||
*/
|
*/
|
||||||
public function __construct($config, $alias, $facade, $magicMethods = array(), $interfaces = array())
|
public function __construct($config, $alias, $facade, $magicMethods = [], $interfaces = [])
|
||||||
{
|
{
|
||||||
$this->alias = $alias;
|
$this->alias = $alias;
|
||||||
$this->magicMethods = $magicMethods;
|
$this->magicMethods = $magicMethods;
|
||||||
@@ -82,7 +82,7 @@ class Alias
|
|||||||
|
|
||||||
|
|
||||||
if ($facade === '\Illuminate\Database\Eloquent\Model') {
|
if ($facade === '\Illuminate\Database\Eloquent\Model') {
|
||||||
$this->usedMethods = array('decrement', 'increment');
|
$this->usedMethods = ['decrement', 'increment'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,12 +289,12 @@ class Alias
|
|||||||
//When the database connection is not set, some classes will be skipped
|
//When the database connection is not set, some classes will be skipped
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
$this->error(
|
$this->error(
|
||||||
"PDOException: " . $e->getMessage() .
|
'PDOException: ' . $e->getMessage() .
|
||||||
"\nPlease configure your database connection correctly, or use the sqlite memory driver (-M)." .
|
"\nPlease configure your database connection correctly, or use the sqlite memory driver (-M)." .
|
||||||
" Skipping $facade."
|
" Skipping $facade."
|
||||||
);
|
);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error("Exception: " . $e->getMessage() . "\nSkipping $facade.");
|
$this->error('Exception: ' . $e->getMessage() . "\nSkipping $facade.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ use Barryvdh\LaravelIdeHelper\Eloquent;
|
|||||||
use Barryvdh\LaravelIdeHelper\Generator;
|
use Barryvdh\LaravelIdeHelper\Generator;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A command to generate autocomplete information for your IDE
|
* A command to generate autocomplete information for your IDE
|
||||||
@@ -25,7 +25,6 @@ use Symfony\Component\Console\Input\InputArgument;
|
|||||||
*/
|
*/
|
||||||
class GeneratorCommand extends Command
|
class GeneratorCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command name.
|
* The console command name.
|
||||||
*
|
*
|
||||||
@@ -59,7 +58,8 @@ class GeneratorCommand extends Command
|
|||||||
* @param \Illuminate\View\Factory $view
|
* @param \Illuminate\View\Factory $view
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
/*ConfigRepository */ $config,
|
/*ConfigRepository */
|
||||||
|
$config,
|
||||||
Filesystem $files,
|
Filesystem $files,
|
||||||
/* Illuminate\View\Factory */
|
/* Illuminate\View\Factory */
|
||||||
$view
|
$view
|
||||||
@@ -105,9 +105,9 @@ class GeneratorCommand extends Command
|
|||||||
|
|
||||||
$helpers = '';
|
$helpers = '';
|
||||||
if ($this->option('helpers') || ($this->config->get('ide-helper.include_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)) {
|
if (file_exists($helper)) {
|
||||||
$helpers .= str_replace(array('<?php', '?>'), '', $this->files->get($helper));
|
$helpers .= str_replace(['<?php', '?>'], '', $this->files->get($helper));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -134,10 +134,10 @@ class GeneratorCommand extends Command
|
|||||||
//Use a sqlite database in memory, to avoid connection errors on Database facades
|
//Use a sqlite database in memory, to avoid connection errors on Database facades
|
||||||
$this->config->set(
|
$this->config->set(
|
||||||
'database.connections.sqlite',
|
'database.connections.sqlite',
|
||||||
array(
|
[
|
||||||
'driver' => 'sqlite',
|
'driver' => 'sqlite',
|
||||||
'database' => ':memory:',
|
'database' => ':memory:',
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
$this->config->set('database.default', 'sqlite');
|
$this->config->set('database.default', 'sqlite');
|
||||||
}
|
}
|
||||||
@@ -151,11 +151,11 @@ class GeneratorCommand extends Command
|
|||||||
{
|
{
|
||||||
$filename = $this->config->get('ide-helper.filename');
|
$filename = $this->config->get('ide-helper.filename');
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
array(
|
[
|
||||||
'filename', InputArgument::OPTIONAL, 'The path to the helper file', $filename
|
'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');
|
$format = $this->config->get('ide-helper.format');
|
||||||
$writeMixins = $this->config->get('ide-helper.write_eloquent_model_mixins');
|
$writeMixins = $this->config->get('ide-helper.write_eloquent_model_mixins');
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
array('format', "F", InputOption::VALUE_OPTIONAL, 'The format for the IDE Helper', $format),
|
['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),
|
['write_mixins', 'W', InputOption::VALUE_OPTIONAL, 'Write mixins to Laravel Model?', $writeMixins],
|
||||||
array('helpers', "H", InputOption::VALUE_NONE, 'Include the helper files'),
|
['helpers', 'H', InputOption::VALUE_NONE, 'Include the helper files'],
|
||||||
array('memory', "M", InputOption::VALUE_NONE, 'Use sqlite memory driver'),
|
['memory', 'M', InputOption::VALUE_NONE, 'Use sqlite memory driver'],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
*/
|
*/
|
||||||
class MetaCommand extends Command
|
class MetaCommand extends Command
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command name.
|
* The console command name.
|
||||||
*
|
*
|
||||||
@@ -87,7 +86,7 @@ class MetaCommand extends Command
|
|||||||
|
|
||||||
$this->registerClassAutoloadExceptions();
|
$this->registerClassAutoloadExceptions();
|
||||||
|
|
||||||
$bindings = array();
|
$bindings = [];
|
||||||
foreach ($this->getAbstracts() as $abstract) {
|
foreach ($this->getAbstracts() as $abstract) {
|
||||||
// Validator and seeder cause problems
|
// Validator and seeder cause problems
|
||||||
if (in_array($abstract, ['validator', 'seeder'])) {
|
if (in_array($abstract, ['validator', 'seeder'])) {
|
||||||
@@ -161,9 +160,9 @@ class MetaCommand extends Command
|
|||||||
{
|
{
|
||||||
$filename = $this->config->get('ide-helper.meta_filename');
|
$filename = $this->config->get('ide-helper.meta_filename');
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the meta file', $filename),
|
['filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the meta file', $filename],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
protected $write_model_magic_where;
|
protected $write_model_magic_where;
|
||||||
protected $write_model_relation_count_properties;
|
protected $write_model_relation_count_properties;
|
||||||
protected $properties = array();
|
protected $properties = [];
|
||||||
protected $methods = array();
|
protected $methods = [];
|
||||||
protected $write = false;
|
protected $write = false;
|
||||||
protected $dirs = array();
|
protected $dirs = [];
|
||||||
protected $reset;
|
protected $reset;
|
||||||
protected $keep_text;
|
protected $keep_text;
|
||||||
protected $phpstorm_noinspections;
|
protected $phpstorm_noinspections;
|
||||||
@@ -146,9 +146,9 @@ class ModelsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function getArguments()
|
protected function getArguments()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
array('model', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Which models to include', array()),
|
['model', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Which models to include', []],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,20 +158,20 @@ class ModelsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
return array(
|
return [
|
||||||
array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file', $this->filename),
|
['filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file', $this->filename],
|
||||||
array('dir', 'D', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
|
['dir', 'D', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
|
||||||
'The model dir, supports glob patterns', array()),
|
'The model dir, supports glob patterns', [], ],
|
||||||
array('write', 'W', InputOption::VALUE_NONE, 'Write to Model file'),
|
['write', 'W', InputOption::VALUE_NONE, 'Write to Model file'],
|
||||||
array('nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'),
|
['nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'],
|
||||||
array('reset', 'R', InputOption::VALUE_NONE, 'Remove the original phpdocs instead of appending'),
|
['reset', 'R', InputOption::VALUE_NONE, 'Remove the original phpdocs instead of appending'],
|
||||||
array('smart-reset', 'r', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'),
|
['smart-reset', 'r', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'],
|
||||||
array('phpstorm-noinspections', 'p', InputOption::VALUE_NONE,
|
['phpstorm-noinspections', 'p', InputOption::VALUE_NONE,
|
||||||
'Add PhpFullyQualifiedNameUsageInspection and PhpUnnecessaryFullyQualifiedNameInspection PHPStorm ' .
|
'Add PhpFullyQualifiedNameUsageInspection and PhpUnnecessaryFullyQualifiedNameInspection PHPStorm ' .
|
||||||
'noinspection tags'
|
'noinspection tags',
|
||||||
),
|
],
|
||||||
array('ignore', 'I', InputOption::VALUE_OPTIONAL, 'Which models to ignore', ''),
|
['ignore', 'I', InputOption::VALUE_OPTIONAL, 'Which models to ignore', ''],
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generateDocs($loadModels, $ignore = '')
|
protected function generateDocs($loadModels, $ignore = '')
|
||||||
@@ -195,7 +195,7 @@ class ModelsCommand extends Command
|
|||||||
if (empty($loadModels)) {
|
if (empty($loadModels)) {
|
||||||
$models = $this->loadModels();
|
$models = $this->loadModels();
|
||||||
} else {
|
} else {
|
||||||
$models = array();
|
$models = [];
|
||||||
foreach ($loadModels as $model) {
|
foreach ($loadModels as $model) {
|
||||||
$models = array_merge($models, explode(',', $model));
|
$models = array_merge($models, explode(',', $model));
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
$ignore = array_merge(
|
$ignore = array_merge(
|
||||||
explode(',', $ignore),
|
explode(',', $ignore),
|
||||||
$this->laravel['config']->get('ide-helper.ignored_models', array())
|
$this->laravel['config']->get('ide-helper.ignored_models', [])
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($models as $name) {
|
foreach ($models as $name) {
|
||||||
@@ -213,8 +213,8 @@ class ModelsCommand extends Command
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$this->properties = array();
|
$this->properties = [];
|
||||||
$this->methods = array();
|
$this->methods = [];
|
||||||
if (class_exists($name)) {
|
if (class_exists($name)) {
|
||||||
try {
|
try {
|
||||||
// handle abstract classes, interfaces, ...
|
// handle abstract classes, interfaces, ...
|
||||||
@@ -248,7 +248,7 @@ class ModelsCommand extends Command
|
|||||||
$ignore[] = $name;
|
$ignore[] = $name;
|
||||||
$this->nullableColumns = [];
|
$this->nullableColumns = [];
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->error("Exception: " . $e->getMessage() .
|
$this->error('Exception: ' . $e->getMessage() .
|
||||||
"\nCould not analyze class $name.\n\nTrace:\n" .
|
"\nCould not analyze class $name.\n\nTrace:\n" .
|
||||||
$e->getTraceAsString());
|
$e->getTraceAsString());
|
||||||
}
|
}
|
||||||
@@ -268,7 +268,7 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
protected function loadModels()
|
protected function loadModels()
|
||||||
{
|
{
|
||||||
$models = array();
|
$models = [];
|
||||||
foreach ($this->dirs as $dir) {
|
foreach ($this->dirs as $dir) {
|
||||||
if (is_dir(base_path($dir))) {
|
if (is_dir(base_path($dir))) {
|
||||||
$dir = base_path($dir);
|
$dir = base_path($dir);
|
||||||
@@ -364,7 +364,7 @@ class ModelsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function getTypeOverride($type)
|
protected function getTypeOverride($type)
|
||||||
{
|
{
|
||||||
$typeOverrides = $this->laravel['config']->get('ide-helper.type_overrides', array());
|
$typeOverrides = $this->laravel['config']->get('ide-helper.type_overrides', []);
|
||||||
|
|
||||||
return $typeOverrides[$type] ?? $type;
|
return $typeOverrides[$type] ?? $type;
|
||||||
}
|
}
|
||||||
@@ -382,7 +382,7 @@ class ModelsCommand extends Command
|
|||||||
$databasePlatform->registerDoctrineTypeMapping('enum', 'string');
|
$databasePlatform->registerDoctrineTypeMapping('enum', 'string');
|
||||||
|
|
||||||
$platformName = $databasePlatform->getName();
|
$platformName = $databasePlatform->getName();
|
||||||
$customTypes = $this->laravel['config']->get("ide-helper.custom_db_types.{$platformName}", array());
|
$customTypes = $this->laravel['config']->get("ide-helper.custom_db_types.{$platformName}", []);
|
||||||
foreach ($customTypes as $yourTypeName => $doctrineTypeName) {
|
foreach ($customTypes as $yourTypeName => $doctrineTypeName) {
|
||||||
$databasePlatform->registerDoctrineTypeMapping($yourTypeName, $doctrineTypeName);
|
$databasePlatform->registerDoctrineTypeMapping($yourTypeName, $doctrineTypeName);
|
||||||
}
|
}
|
||||||
@@ -454,11 +454,11 @@ class ModelsCommand extends Command
|
|||||||
);
|
);
|
||||||
if ($this->write_model_magic_where) {
|
if ($this->write_model_magic_where) {
|
||||||
$this->setMethod(
|
$this->setMethod(
|
||||||
Str::camel("where_" . $name),
|
Str::camel('where_' . $name),
|
||||||
$this->getClassNameInDestinationFile($model, \Illuminate\Database\Eloquent\Builder::class)
|
$this->getClassNameInDestinationFile($model, \Illuminate\Database\Eloquent\Builder::class)
|
||||||
. '|'
|
. '|'
|
||||||
. $this->getClassNameInDestinationFile($model, get_class($model)),
|
. $this->getClassNameInDestinationFile($model, get_class($model)),
|
||||||
array('$value')
|
['$value']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -521,7 +521,7 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
$this->setMethod(
|
$this->setMethod(
|
||||||
$method,
|
$method,
|
||||||
$builder . "|" . $this->getClassNameInDestinationFile($model, get_class($model))
|
$builder . '|' . $this->getClassNameInDestinationFile($model, get_class($model))
|
||||||
);
|
);
|
||||||
} elseif (
|
} elseif (
|
||||||
!method_exists('Illuminate\Database\Eloquent\Model', $method)
|
!method_exists('Illuminate\Database\Eloquent\Model', $method)
|
||||||
@@ -552,7 +552,7 @@ class ModelsCommand extends Command
|
|||||||
$code = substr($code, $begin, strrpos($code, '}') - $begin + 1);
|
$code = substr($code, $begin, strrpos($code, '}') - $begin + 1);
|
||||||
|
|
||||||
foreach (
|
foreach (
|
||||||
array(
|
[
|
||||||
'hasMany' => '\Illuminate\Database\Eloquent\Relations\HasMany',
|
'hasMany' => '\Illuminate\Database\Eloquent\Relations\HasMany',
|
||||||
'hasManyThrough' => '\Illuminate\Database\Eloquent\Relations\HasManyThrough',
|
'hasManyThrough' => '\Illuminate\Database\Eloquent\Relations\HasManyThrough',
|
||||||
'hasOneThrough' => '\Illuminate\Database\Eloquent\Relations\HasOneThrough',
|
'hasOneThrough' => '\Illuminate\Database\Eloquent\Relations\HasOneThrough',
|
||||||
@@ -563,8 +563,8 @@ class ModelsCommand extends Command
|
|||||||
'morphTo' => '\Illuminate\Database\Eloquent\Relations\MorphTo',
|
'morphTo' => '\Illuminate\Database\Eloquent\Relations\MorphTo',
|
||||||
'morphMany' => '\Illuminate\Database\Eloquent\Relations\MorphMany',
|
'morphMany' => '\Illuminate\Database\Eloquent\Relations\MorphMany',
|
||||||
'morphToMany' => '\Illuminate\Database\Eloquent\Relations\MorphToMany',
|
'morphToMany' => '\Illuminate\Database\Eloquent\Relations\MorphToMany',
|
||||||
'morphedByMany' => '\Illuminate\Database\Eloquent\Relations\MorphToMany'
|
'morphedByMany' => '\Illuminate\Database\Eloquent\Relations\MorphToMany',
|
||||||
) as $relation => $impl
|
] as $relation => $impl
|
||||||
) {
|
) {
|
||||||
$search = '$this->' . $relation . '(';
|
$search = '$this->' . $relation . '(';
|
||||||
if (stripos($code, $search) || ltrim($impl, '\\') === ltrim((string)$type, '\\')) {
|
if (stripos($code, $search) || ltrim($impl, '\\') === ltrim((string)$type, '\\')) {
|
||||||
@@ -621,7 +621,7 @@ class ModelsCommand extends Command
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} elseif ($relation === "morphTo") {
|
} elseif ($relation === 'morphTo') {
|
||||||
// Model isn't specified because relation is polymorphic
|
// Model isn't specified because relation is polymorphic
|
||||||
$this->setProperty(
|
$this->setProperty(
|
||||||
$method,
|
$method,
|
||||||
@@ -688,7 +688,7 @@ class ModelsCommand extends Command
|
|||||||
protected function setProperty($name, $type = null, $read = null, $write = null, $comment = '', $nullable = false)
|
protected function setProperty($name, $type = null, $read = null, $write = null, $comment = '', $nullable = false)
|
||||||
{
|
{
|
||||||
if (!isset($this->properties[$name])) {
|
if (!isset($this->properties[$name])) {
|
||||||
$this->properties[$name] = array();
|
$this->properties[$name] = [];
|
||||||
$this->properties[$name]['type'] = 'mixed';
|
$this->properties[$name]['type'] = 'mixed';
|
||||||
$this->properties[$name]['read'] = false;
|
$this->properties[$name]['read'] = false;
|
||||||
$this->properties[$name]['write'] = false;
|
$this->properties[$name]['write'] = false;
|
||||||
@@ -709,12 +709,12 @@ class ModelsCommand extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setMethod($name, $type = '', $arguments = array())
|
protected function setMethod($name, $type = '', $arguments = [])
|
||||||
{
|
{
|
||||||
$methods = array_change_key_case($this->methods, CASE_LOWER);
|
$methods = array_change_key_case($this->methods, CASE_LOWER);
|
||||||
|
|
||||||
if (!isset($methods[strtolower($name)])) {
|
if (!isset($methods[strtolower($name)])) {
|
||||||
$this->methods[$name] = array();
|
$this->methods[$name] = [];
|
||||||
$this->methods[$name]['type'] = $type;
|
$this->methods[$name]['type'] = $type;
|
||||||
$this->methods[$name]['arguments'] = $arguments;
|
$this->methods[$name]['arguments'] = $arguments;
|
||||||
}
|
}
|
||||||
@@ -752,13 +752,13 @@ class ModelsCommand extends Command
|
|||||||
$phpdoc->setText($class);
|
$phpdoc->setText($class);
|
||||||
}
|
}
|
||||||
|
|
||||||
$properties = array();
|
$properties = [];
|
||||||
$methods = array();
|
$methods = [];
|
||||||
foreach ($phpdoc->getTags() as $tag) {
|
foreach ($phpdoc->getTags() as $tag) {
|
||||||
$name = $tag->getName();
|
$name = $tag->getName();
|
||||||
if ($name == "property" || $name == "property-read" || $name == "property-write") {
|
if ($name == 'property' || $name == 'property-read' || $name == 'property-write') {
|
||||||
$properties[] = $tag->getVariableName();
|
$properties[] = $tag->getVariableName();
|
||||||
} elseif ($name == "method") {
|
} elseif ($name == 'method') {
|
||||||
$methods[] = $tag->getMethodName();
|
$methods[] = $tag->getMethodName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -797,22 +797,22 @@ class ModelsCommand extends Command
|
|||||||
$phpdoc->appendTag($tag);
|
$phpdoc->appendTag($tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->write && ! $phpdoc->getTagsByName('mixin')) {
|
if ($this->write && !$phpdoc->getTagsByName('mixin')) {
|
||||||
$eloquentClassNameInModel = $this->getClassNameInDestinationFile($reflection, 'Eloquent');
|
$eloquentClassNameInModel = $this->getClassNameInDestinationFile($reflection, 'Eloquent');
|
||||||
$phpdoc->appendTag(Tag::createInstance("@mixin " . $eloquentClassNameInModel, $phpdoc));
|
$phpdoc->appendTag(Tag::createInstance('@mixin ' . $eloquentClassNameInModel, $phpdoc));
|
||||||
}
|
}
|
||||||
if ($this->phpstorm_noinspections) {
|
if ($this->phpstorm_noinspections) {
|
||||||
/**
|
/**
|
||||||
* Facades, Eloquent API
|
* Facades, Eloquent API
|
||||||
* @see https://www.jetbrains.com/help/phpstorm/php-fully-qualified-name-usage.html
|
* @see https://www.jetbrains.com/help/phpstorm/php-fully-qualified-name-usage.html
|
||||||
*/
|
*/
|
||||||
$phpdoc->appendTag(Tag::createInstance("@noinspection PhpFullyQualifiedNameUsageInspection", $phpdoc));
|
$phpdoc->appendTag(Tag::createInstance('@noinspection PhpFullyQualifiedNameUsageInspection', $phpdoc));
|
||||||
/**
|
/**
|
||||||
* Relations, other models in the same namespace
|
* Relations, other models in the same namespace
|
||||||
* @see https://www.jetbrains.com/help/phpstorm/php-unnecessary-fully-qualified-name.html
|
* @see https://www.jetbrains.com/help/phpstorm/php-unnecessary-fully-qualified-name.html
|
||||||
*/
|
*/
|
||||||
$phpdoc->appendTag(
|
$phpdoc->appendTag(
|
||||||
Tag::createInstance("@noinspection PhpUnnecessaryFullyQualifiedNameInspection", $phpdoc)
|
Tag::createInstance('@noinspection PhpUnnecessaryFullyQualifiedNameInspection', $phpdoc)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -857,7 +857,7 @@ class ModelsCommand extends Command
|
|||||||
public function getParameters($method)
|
public function getParameters($method)
|
||||||
{
|
{
|
||||||
//Loop through the default values for parameters, and make the correct output string
|
//Loop through the default values for parameters, and make the correct output string
|
||||||
$paramsWithDefault = array();
|
$paramsWithDefault = [];
|
||||||
/** @var \ReflectionParameter $param */
|
/** @var \ReflectionParameter $param */
|
||||||
foreach ($method->getParameters() as $param) {
|
foreach ($method->getParameters() as $param) {
|
||||||
$paramClass = $param->getClass();
|
$paramClass = $param->getClass();
|
||||||
|
|||||||
+2
-2
@@ -8,12 +8,12 @@
|
|||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper;
|
namespace Barryvdh\LaravelIdeHelper;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Barryvdh\Reflection\DocBlock;
|
use Barryvdh\Reflection\DocBlock;
|
||||||
use Barryvdh\Reflection\DocBlock\Context;
|
use Barryvdh\Reflection\DocBlock\Context;
|
||||||
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
|
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
|
||||||
use Barryvdh\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Filesystem\Filesystem;
|
||||||
|
|
||||||
class Eloquent
|
class Eloquent
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use ReflectionClass;
|
|||||||
|
|
||||||
class Factories
|
class Factories
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function all()
|
public static function all()
|
||||||
{
|
{
|
||||||
$factories = [];
|
$factories = [];
|
||||||
|
|||||||
+22
-22
@@ -11,10 +11,8 @@
|
|||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper;
|
namespace Barryvdh\LaravelIdeHelper;
|
||||||
|
|
||||||
use Illuminate\Foundation\Application;
|
|
||||||
use Illuminate\Foundation\AliasLoader;
|
use Illuminate\Foundation\AliasLoader;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use ReflectionClass;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class Generator
|
class Generator
|
||||||
@@ -28,9 +26,9 @@ class Generator
|
|||||||
/** @var \Symfony\Component\Console\Output\OutputInterface */
|
/** @var \Symfony\Component\Console\Output\OutputInterface */
|
||||||
protected $output;
|
protected $output;
|
||||||
|
|
||||||
protected $extra = array();
|
protected $extra = [];
|
||||||
protected $magic = array();
|
protected $magic = [];
|
||||||
protected $interfaces = array();
|
protected $interfaces = [];
|
||||||
protected $helpers;
|
protected $helpers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,8 +38,10 @@ class Generator
|
|||||||
* @param string $helpers
|
* @param string $helpers
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
/*ConfigRepository */ $config,
|
/*ConfigRepository */
|
||||||
/* Illuminate\View\Factory */ $view,
|
$config,
|
||||||
|
/* Illuminate\View\Factory */
|
||||||
|
$view,
|
||||||
OutputInterface $output = null,
|
OutputInterface $output = null,
|
||||||
$helpers = ''
|
$helpers = ''
|
||||||
) {
|
) {
|
||||||
@@ -93,16 +93,16 @@ class Generator
|
|||||||
|
|
||||||
public function generateJsonHelper()
|
public function generateJsonHelper()
|
||||||
{
|
{
|
||||||
$classes = array();
|
$classes = [];
|
||||||
foreach ($this->getValidAliases() as $aliases) {
|
foreach ($this->getValidAliases() as $aliases) {
|
||||||
foreach ($aliases as $alias) {
|
foreach ($aliases as $alias) {
|
||||||
$functions = array();
|
$functions = [];
|
||||||
foreach ($alias->getMethods() as $method) {
|
foreach ($alias->getMethods() as $method) {
|
||||||
$functions[$method->getName()] = '(' . $method->getParamsWithDefault() . ')';
|
$functions[$method->getName()] = '(' . $method->getParamsWithDefault() . ')';
|
||||||
}
|
}
|
||||||
$classes[$alias->getAlias()] = array(
|
$classes[$alias->getAlias()] = [
|
||||||
'functions' => $functions,
|
'functions' => $functions,
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,11 +111,11 @@ class Generator
|
|||||||
$flags |= JSON_PRETTY_PRINT;
|
$flags |= JSON_PRETTY_PRINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return json_encode(array(
|
return json_encode([
|
||||||
'php' => array(
|
'php' => [
|
||||||
'classes' => $classes,
|
'classes' => $classes,
|
||||||
),
|
],
|
||||||
), $flags);
|
], $flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function detectDrivers()
|
protected function detectDrivers()
|
||||||
@@ -129,7 +129,7 @@ class Generator
|
|||||||
&& app()->bound('auth')
|
&& app()->bound('auth')
|
||||||
) {
|
) {
|
||||||
$class = get_class(\Auth::guard());
|
$class = get_class(\Auth::guard());
|
||||||
$this->extra['Auth'] = array($class);
|
$this->extra['Auth'] = [$class];
|
||||||
$this->interfaces['\Illuminate\Auth\UserProviderInterface'] = $class;
|
$this->interfaces['\Illuminate\Auth\UserProviderInterface'] = $class;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -138,7 +138,7 @@ class Generator
|
|||||||
try {
|
try {
|
||||||
if (class_exists('DB') && is_a('DB', '\Illuminate\Support\Facades\DB', true)) {
|
if (class_exists('DB') && is_a('DB', '\Illuminate\Support\Facades\DB', true)) {
|
||||||
$class = get_class(\DB::connection());
|
$class = get_class(\DB::connection());
|
||||||
$this->extra['DB'] = array($class);
|
$this->extra['DB'] = [$class];
|
||||||
$this->interfaces['\Illuminate\Database\ConnectionInterface'] = $class;
|
$this->interfaces['\Illuminate\Database\ConnectionInterface'] = $class;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -148,7 +148,7 @@ class Generator
|
|||||||
if (class_exists('Cache') && is_a('Cache', '\Illuminate\Support\Facades\Cache', true)) {
|
if (class_exists('Cache') && is_a('Cache', '\Illuminate\Support\Facades\Cache', true)) {
|
||||||
$driver = get_class(\Cache::driver());
|
$driver = get_class(\Cache::driver());
|
||||||
$store = get_class(\Cache::getStore());
|
$store = get_class(\Cache::getStore());
|
||||||
$this->extra['Cache'] = array($driver, $store);
|
$this->extra['Cache'] = [$driver, $store];
|
||||||
$this->interfaces['\Illuminate\Cache\StoreInterface'] = $store;
|
$this->interfaces['\Illuminate\Cache\StoreInterface'] = $store;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -157,7 +157,7 @@ class Generator
|
|||||||
try {
|
try {
|
||||||
if (class_exists('Queue') && is_a('Queue', '\Illuminate\Support\Facades\Queue', true)) {
|
if (class_exists('Queue') && is_a('Queue', '\Illuminate\Support\Facades\Queue', true)) {
|
||||||
$class = get_class(\Queue::connection());
|
$class = get_class(\Queue::connection());
|
||||||
$this->extra['Queue'] = array($class);
|
$this->extra['Queue'] = [$class];
|
||||||
$this->interfaces['\Illuminate\Queue\QueueInterface'] = $class;
|
$this->interfaces['\Illuminate\Queue\QueueInterface'] = $class;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -166,7 +166,7 @@ class Generator
|
|||||||
try {
|
try {
|
||||||
if (class_exists('SSH') && is_a('SSH', '\Illuminate\Support\Facades\SSH', true)) {
|
if (class_exists('SSH') && is_a('SSH', '\Illuminate\Support\Facades\SSH', true)) {
|
||||||
$class = get_class(\SSH::connection());
|
$class = get_class(\SSH::connection());
|
||||||
$this->extra['SSH'] = array($class);
|
$this->extra['SSH'] = [$class];
|
||||||
$this->interfaces['\Illuminate\Remote\ConnectionInterface'] = $class;
|
$this->interfaces['\Illuminate\Remote\ConnectionInterface'] = $class;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -175,7 +175,7 @@ class Generator
|
|||||||
try {
|
try {
|
||||||
if (class_exists('Storage') && is_a('Storage', '\Illuminate\Support\Facades\Storage', true)) {
|
if (class_exists('Storage') && is_a('Storage', '\Illuminate\Support\Facades\Storage', true)) {
|
||||||
$class = get_class(\Storage::disk());
|
$class = get_class(\Storage::disk());
|
||||||
$this->extra['Storage'] = array($class);
|
$this->extra['Storage'] = [$class];
|
||||||
$this->interfaces['\Illuminate\Contracts\Filesystem\Filesystem'] = $class;
|
$this->interfaces['\Illuminate\Contracts\Filesystem\Filesystem'] = $class;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -198,7 +198,7 @@ class Generator
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$magicMethods = array_key_exists($name, $this->magic) ? $this->magic[$name] : array();
|
$magicMethods = array_key_exists($name, $this->magic) ? $this->magic[$name] : [];
|
||||||
$alias = new Alias($this->config, $name, $facade, $magicMethods, $this->interfaces);
|
$alias = new Alias($this->config, $name, $facade, $magicMethods, $this->interfaces);
|
||||||
if ($alias->isValid()) {
|
if ($alias->isValid()) {
|
||||||
//Add extra methods, from other classes (magic static calls)
|
//Add extra methods, from other classes (magic static calls)
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ use Illuminate\View\FileViewFinder;
|
|||||||
|
|
||||||
class IdeHelperServiceProvider extends ServiceProvider
|
class IdeHelperServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if loading of the provider is deferred.
|
* Indicates if loading of the provider is deferred.
|
||||||
*
|
*
|
||||||
@@ -107,7 +106,7 @@ class IdeHelperServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function provides()
|
public function provides()
|
||||||
{
|
{
|
||||||
return array('command.ide-helper.generate', 'command.ide-helper.models');
|
return ['command.ide-helper.generate', 'command.ide-helper.models'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ class Macro extends Method
|
|||||||
$alias,
|
$alias,
|
||||||
$class,
|
$class,
|
||||||
$methodName = null,
|
$methodName = null,
|
||||||
$interfaces = array()
|
$interfaces = []
|
||||||
) {
|
) {
|
||||||
parent::__construct($method, $alias, $class, $methodName, $interfaces);
|
parent::__construct($method, $alias, $class, $methodName, $interfaces);
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -13,10 +13,10 @@ namespace Barryvdh\LaravelIdeHelper;
|
|||||||
|
|
||||||
use Barryvdh\Reflection\DocBlock;
|
use Barryvdh\Reflection\DocBlock;
|
||||||
use Barryvdh\Reflection\DocBlock\Context;
|
use Barryvdh\Reflection\DocBlock\Context;
|
||||||
use Barryvdh\Reflection\DocBlock\Tag;
|
|
||||||
use Barryvdh\Reflection\DocBlock\Tag\ReturnTag;
|
|
||||||
use Barryvdh\Reflection\DocBlock\Tag\ParamTag;
|
|
||||||
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
|
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
|
||||||
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
use Barryvdh\Reflection\DocBlock\Tag\ParamTag;
|
||||||
|
use Barryvdh\Reflection\DocBlock\Tag\ReturnTag;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
@@ -32,9 +32,9 @@ class Method
|
|||||||
protected $declaringClassName;
|
protected $declaringClassName;
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $namespace;
|
protected $namespace;
|
||||||
protected $params = array();
|
protected $params = [];
|
||||||
protected $params_with_default = array();
|
protected $params_with_default = [];
|
||||||
protected $interfaces = array();
|
protected $interfaces = [];
|
||||||
protected $real_name;
|
protected $real_name;
|
||||||
protected $return = null;
|
protected $return = null;
|
||||||
protected $root;
|
protected $root;
|
||||||
@@ -46,7 +46,7 @@ class Method
|
|||||||
* @param string|null $methodName
|
* @param string|null $methodName
|
||||||
* @param array $interfaces
|
* @param array $interfaces
|
||||||
*/
|
*/
|
||||||
public function __construct($method, $alias, $class, $methodName = null, $interfaces = array())
|
public function __construct($method, $alias, $class, $methodName = null, $interfaces = [])
|
||||||
{
|
{
|
||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->interfaces = $interfaces;
|
$this->interfaces = $interfaces;
|
||||||
@@ -119,7 +119,7 @@ class Method
|
|||||||
*/
|
*/
|
||||||
public function isInstanceCall()
|
public function isInstanceCall()
|
||||||
{
|
{
|
||||||
return ! ($this->method->isClosure() || $this->method->isStatic());
|
return !($this->method->isClosure() || $this->method->isStatic());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -302,7 +302,7 @@ class Method
|
|||||||
*/
|
*/
|
||||||
public function shouldReturn()
|
public function shouldReturn()
|
||||||
{
|
{
|
||||||
if ($this->return !== "void" && $this->method->name !== "__construct") {
|
if ($this->return !== 'void' && $this->method->name !== '__construct') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,8 +318,8 @@ class Method
|
|||||||
public function getParameters($method)
|
public function getParameters($method)
|
||||||
{
|
{
|
||||||
//Loop through the default values for parameters, and make the correct output string
|
//Loop through the default values for parameters, and make the correct output string
|
||||||
$params = array();
|
$params = [];
|
||||||
$paramsWithDefault = array();
|
$paramsWithDefault = [];
|
||||||
foreach ($method->getParameters() as $param) {
|
foreach ($method->getParameters() as $param) {
|
||||||
$paramStr = $param->isVariadic() ? '...$' . $param->getName() : '$' . $param->getName();
|
$paramStr = $param->isVariadic() ? '...$' . $param->getName() : '$' . $param->getName();
|
||||||
$params[] = $paramStr;
|
$params[] = $paramStr;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console;
|
||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\EloquentCommand;
|
use Barryvdh\LaravelIdeHelper\Console\EloquentCommand;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Collections;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Collections;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
|
||||||
class SimpleCollection extends Collection
|
class SimpleCollection extends Collection
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Collections\SimpleCollection;
|
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,10 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomDate;
|
|||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Carbon\CarbonImmutable;
|
use Carbon\CarbonImmutable;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Facades\Date;
|
use Illuminate\Support\Facades\Date;
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,5 +8,4 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class Account extends Model
|
class Account extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GenerateBasicPhp
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,5 +6,4 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
|||||||
|
|
||||||
final class CastType
|
final class CastType
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,11 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqn\Casts\CastType;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqn\Casts\CastType;
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\{
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
Builder as EloquentBuilder,
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
Collection,
|
|
||||||
SoftDeletes
|
|
||||||
};
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
@@ -20,6 +18,18 @@ class Post extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special hack to avoid code style fixer removing unused imports
|
||||||
|
* which play a role when generating the snapshot
|
||||||
|
*/
|
||||||
|
private $hack = [
|
||||||
|
Carbon::class,
|
||||||
|
Collection::class,
|
||||||
|
Eloquent::class,
|
||||||
|
EloquentBuilder::class,
|
||||||
|
QueryBuilder::class,
|
||||||
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'char_not_nullable' => CastType::class,
|
'char_not_nullable' => CastType::class,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -6,12 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqn\Models\Post;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,13 +6,11 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqn\Casts\CastType;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqn\Casts\CastType;
|
||||||
use Eloquent;
|
use Eloquent;
|
||||||
use Illuminate\Database\Eloquent\{
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
Builder as EloquentBuilder,
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
Collection,
|
|
||||||
SoftDeletes
|
|
||||||
};
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
@@ -180,6 +178,18 @@ class Post extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special hack to avoid code style fixer removing unused imports
|
||||||
|
* which play a role when generating the snapshot
|
||||||
|
*/
|
||||||
|
private $hack = [
|
||||||
|
Carbon::class,
|
||||||
|
Collection::class,
|
||||||
|
Eloquent::class,
|
||||||
|
EloquentBuilder::class,
|
||||||
|
QueryBuilder::class,
|
||||||
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'char_not_nullable' => CastType::class,
|
'char_not_nullable' => CastType::class,
|
||||||
];
|
];
|
||||||
|
|||||||
-1
@@ -8,5 +8,4 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
|
|
||||||
class EMaterialQueryBuilder extends Builder
|
class EMaterialQueryBuilder extends Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqn\Models\Post;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Getter;
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models;
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Ignored extends Model
|
class Ignored extends Model
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored;
|
|||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models\Ignored;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Ignored\Models\Ignored;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
@@ -17,7 +15,7 @@ class Test extends AbstractModelsCommand
|
|||||||
parent::getEnvironmentSetUp($app);
|
parent::getEnvironmentSetUp($app);
|
||||||
|
|
||||||
$app['config']->set('ide-helper.ignored_models', [
|
$app['config']->set('ide-helper.ignored_models', [
|
||||||
Ignored::class
|
Ignored::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Interfaces;
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
final class Test extends AbstractModelsCommand
|
final class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
class CastedProperty
|
class CastedProperty
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|||||||
+2
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|||||||
+2
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|||||||
+2
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|||||||
+2
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|||||||
@@ -6,13 +6,10 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCas
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\MagicWhere;
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\PHPStormNoInspec
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
use function file_get_contents;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\RelationCountPro
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\CustomCollection\Models\Simple;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations;
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ResetAndSmartRes
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\SoftDeletes;
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
|
||||||
use Mockery;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests;
|
namespace Barryvdh\LaravelIdeHelper\Tests;
|
||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Method;
|
use Barryvdh\LaravelIdeHelper\Method;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests;
|
namespace Barryvdh\LaravelIdeHelper\Tests;
|
||||||
|
|
||||||
use PHPUnit\Framework\Assert;
|
use PHPUnit\Framework\Assert;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Barryvdh\LaravelIdeHelper\Tests;
|
namespace Barryvdh\LaravelIdeHelper\Tests;
|
||||||
|
|
||||||
use PHPUnit\Framework\Assert;
|
use PHPUnit\Framework\Assert;
|
||||||
|
|||||||
Reference in New Issue
Block a user