Compare commits

...
82 Commits
Author SHA1 Message Date
Barry vd. Heuvel 7db1843473 Remove Eloquent mixin thing 2018-09-06 20:41:09 +02:00
Barry vd. Heuvel 1989d0e794 Update .travis.yml 2018-09-04 16:19:48 +02:00
Barry vd. Heuvel 09db8c9a76 Update composer.json 2018-08-31 15:28:09 +02:00
Barry vd. Heuvel 4aa43fa613 Merge pull request #690 from kevinpijning/laravel-5.7-support
Laravel 5.7 support
2018-08-21 11:29:23 +02:00
kevin d55b48476e Laravel 5.7 support
Added Laravel 5.7 support
2018-08-15 09:57:53 +02:00
Barry vd. Heuvel 45e84b9070 Merge pull request #678 from BinotaLIU/add-fluent-change
add change modifier
2018-07-16 09:12:17 +02:00
BinotaLIU f472c26601 add change modifier 2018-07-05 19:31:23 +08:00
Barry vd. Heuvel 1deadced46 Merge pull request #675 from glamorous/bugfix/phpstan-error-formatter
bugfix - Space/Enter between starting php tag and comment for PHPStan
2018-06-21 14:14:18 +02:00
Jonas De Smet e1d1352ac5 bugfix - Space/Enter between starting php tag and comment for PHPStan 2018-06-19 14:59:59 +02:00
Barry vd. Heuvel 65e3278c86 Merge pull request #668 from falnyr/final-abstract-class
Added support for abstract/final models.
2018-06-13 10:16:26 +02:00
Barry vd. Heuvel efd7e51566 Merge pull request #671 from eidng8/patch-2
suppress formatter in meta file
2018-06-13 10:16:01 +02:00
Barry vd. Heuvel 2a5dda6a27 Merge pull request #672 from eidng8/patch-3
suppress formatter in helper file
2018-06-13 10:15:47 +02:00
Jackey Cheung 6577af8464 suppress formatter in helper file 2018-06-13 10:24:58 +08:00
Jackey Cheung 6c7bc371f9 suppress formatter in meta file 2018-06-13 10:21:51 +08:00
Jan Alfred Richter 217b8989c2 Added support for abstract/final models. 2018-05-31 15:39:22 +12:00
Barry vd. Heuvel c003eb40d7 Merge pull request #667 from BinotaLIU/master
nullable is actually support an argument
2018-05-29 17:29:40 +02:00
BinotaLIU 1a3d32f0d1 nullable actually support an argument 2018-05-29 22:28:49 +08:00
Barry vd. Heuvel bd733b7b7c Merge pull request #665 from JeppeKnockaert/fix-model-comments
Only skip non-models when generating docs
2018-05-24 14:10:51 +02:00
Jeppe Knockaert 93630fdf62 Only skip non-models when generating docs
The fix made in PR https://github.com/barryvdh/laravel-ide-helper/pull/614 for issue https://github.com/barryvdh/laravel-ide-helper/issues/253 was incorrect as it resulted in comments
no longer being generated for Models that are not Pivot Rlations.

This PR allow comments to be generated for both Pivot Models (as they are
a subclass of Eloquent\Model) and normal Models.
2018-05-24 11:43:03 +02:00
Barry vd. Heuvel f64ed52205 Merge pull request #664 from huydang284/master
ide-helper:models error when model's method has parameters and also has relation
2018-05-24 10:32:51 +02:00
Huy Dang ba28841870 fix case relation method has parameter 2018-05-22 13:26:27 +07:00
Barry vd. Heuvel b02a0bc6c9 Update phpunit.xml.dist 2018-05-07 13:03:54 +02:00
Barry vd. Heuvel a665961fb9 Update .travis.yml 2018-05-07 12:56:29 +02:00
Barry vd. Heuvel 83852e9de0 Update .travis.yml 2018-05-07 12:41:54 +02:00
Barry vd. Heuvel d2f29d997b Update .travis.yml 2018-05-07 11:56:03 +02:00
Barry vd. Heuvel cbacb28f19 Update .travis.yml 2018-05-07 11:55:44 +02:00
Barry vd. Heuvel 930e5bd301 Update composer.json 2018-05-07 11:49:06 +02:00
Barry vd. Heuvel 930d258cd4 Update composer.json 2018-05-07 11:48:47 +02:00
Barry vd. Heuvel 94248adae8 Merge pull request #600 from mike-grinspan/patch-1
Use Illuminate\Support\Carbon instead of Carbon\Carbon
2018-05-07 11:44:40 +02:00
Barry vd. Heuvel 50ecd8b815 Update CS, typo 2018-05-07 11:38:57 +02:00
Barry vd. Heuvel 1b70277203 Typo 2018-05-07 11:25:19 +02:00
Barry vd. Heuvel 87a03fd9c4 Merge pull request #576 from yuklia/docs-enhancment
Add notice about "Package Auto-Discovery" to docs
2018-05-07 11:23:21 +02:00
Barry vd. Heuvel b8a73bcab9 Merge pull request #581 from soltmar/master
Changed overwriting confirmation message
2018-05-07 11:23:06 +02:00
Barry vd. Heuvel 0556991c69 Merge pull request #583 from inxilpro/support-fakes
Support for ::fake() calls
2018-05-07 11:22:33 +02:00
Barry vd. Heuvel be78ac62cd Merge pull request #589 from mfn/patch-1
Keep "null"-ness of column even with model casts
2018-05-07 11:21:47 +02:00
Barry vd. Heuvel 265f00c322 Update LICENSE.md 2018-05-07 11:20:53 +02:00
Barry vd. Heuvel bbd96d3616 Merge pull request #609 from lx1036/patch
Sort keys for generating stable .phpstorm.meta.php
2018-05-07 11:17:33 +02:00
Barry vd. Heuvel 8d913089db Merge pull request #614 from WickedSik/master
Allow command to find and use pivot models
2018-05-07 11:17:07 +02:00
Barry vd. Heuvel 9a2588cb3a Merge pull request #612 from westphalen/master
Added Validator and Gate facades for Lumen
2018-05-07 11:16:47 +02:00
Barry vd. Heuvel e7fa36bdc3 Merge pull request #629 from bedezign/smart-reset
"smart-reset": Reset properties/methods, but keep the text
2018-05-07 11:15:59 +02:00
Barry vd. Heuvel b1e868c5fc Merge pull request #621 from Zae/feature/fix-callable-macros
Support php's array callable format for macro's.
2018-05-07 11:15:49 +02:00
Barry vd. Heuvel 203d60dc8c Merge branch 'master' into feature/fix-callable-macros 2018-05-07 11:15:43 +02:00
Barry vd. Heuvel f5275b700a Merge pull request #632 from JeppeKnockaert/feature/add-morphedByMany-relation
Add morphedByMany relationship
2018-05-07 11:13:27 +02:00
Barry vd. Heuvel 046a9bcc77 Merge pull request #647 from eidng8/eidng8-suppress-formatter
suppress PHPStorm formatter
2018-05-07 11:10:25 +02:00
Barry vd. Heuvel c6191830ab Merge pull request #660 from TomzxForks/fixes/659-use-composer-classmapgenerator
Replace Symfony ClassMapGenerator with Composer ClassMapGenerator
2018-05-07 11:09:58 +02:00
Barry vd. Heuvel cfff7721bc Merge pull request #661 from tzurbaev/patch-1
Remove `mixed` typehint from `Fluent::default` method
2018-05-07 11:09:27 +02:00
Timur Zurbaev 4691bc5fbd Remove mixed typehint from Fluent::default method 2018-05-05 10:09:30 +08:00
Tom Rochette b1b05b694b Remove dependecy to Symfony\Component\ClassLoader\ClassMapGenerator and replace it with Composer\Autoload\ClassMapGenerator. 2018-05-03 16:02:16 -04:00
Barry vd. Heuvel 98d6087a1e Merge pull request #568 from fisharebest/artisan-optimize
The 'artisan optimize' command is now deprecated.
2018-03-26 12:18:59 +02:00
Jackey Cheung c7b7ebf1b5 suppress PHPStorm formatter 2018-03-21 11:36:02 +08:00
Jeppe Knockaert 17982029f0 Move long one-line array to multiple lines 2018-02-14 12:15:38 +01:00
Jeppe Knockaert bda5120e9a Add morphedByMany relationship 2018-02-14 12:06:45 +01:00
Steve Guns d961482d22 Fixed PHPCS PSR2 issues 2018-02-14 08:59:19 +01:00
Steve Guns 8852b1ca9d Added "smart-reset": Reset properties/methods, but keep the docBlock text, if any 2018-02-11 19:09:33 +01:00
Barry vd. Heuvel b644e48801 Merge pull request #618 from glamorous/feature/docblocks-on-classes
Add DocBlocks for classes too
2018-02-10 14:47:48 +01:00
Barry vd. Heuvel 09610da602 Merge pull request #626 from barryvdh/revert-624-Fix/623
Revert "Fixes a bug where a missing DocBlock caused errors"
2018-02-08 17:01:01 +01:00
Barry vd. Heuvel 2d56afce8e Revert "Fixes a bug where a missing DocBlock caused errors" 2018-02-08 17:00:48 +01:00
Barry vd. Heuvel 5c304db44f Merge pull request #624 from iPaat/Fix/623
Fixes a bug where a missing DocBlock caused errors
2018-02-08 08:56:07 +01:00
Patrick 1fc4284af6 Fixes for Travis. 2018-02-07 13:24:36 +01:00
Patrick ea113e8c0b Fixes a bug where a missing DocBlock caused errors 2018-02-07 13:17:03 +01:00
Barry vd. Heuvel 387efb9b42 Allow L5.6 2018-02-07 09:31:35 +01:00
Ezra Pool 8ab907f219 Support php's array callable format for macro's.
This allows you to define methods like this as well: Str::macro('name', [$this, 'method']);
2018-02-03 21:10:48 +01:00
Jonas De Smet e29e035135 Add DocBlocks for classes too 2018-02-01 15:53:32 +01:00
Jurrien Dokter 7b2786ac2b Fixing issue #253 2018-01-27 13:01:07 +01:00
Sune Westphalen 76bd86dbaf Added Validator and Gate facades for Lumen. 2018-01-23 13:56:22 +07:00
Xiang Liu 7b067198a6 Sort keys for generating stable .phpstorm.meta.php 2018-01-15 12:44:44 +08:00
Mike b6f525b320 Use Illuminate\Support\Carbon instead of Carbon\Carbon in config/ide-helper.php 2017-12-27 17:26:16 -05:00
Mike d65f1cedcd Use Illuminate\Support\Carbon instead of Carbon\Carbon in readme.md 2017-12-27 17:25:44 -05:00
Mike df6b1b6f82 Use Illuminate\Support\Carbon instead of Carbon\Carbon 2017-12-27 17:17:00 -05:00
Markus Fischer 76a1952c41 Keep "null"-ness of column even with model casts
A cast in Laravel should only affect the type, but not the database intrinsics whether a column accepts `null` or not.

As an example, consider this table (Postgres syntax):
```sql
CREATE TABLE foo (
  some_column jsonb
);
```
This will be generated as: `@property string|null $some_column`

When providing a the following casts on the model:
```php
protected $casts = [
  'some_column' => 'array',
];
```
then the generated property changes to: `@property array $some_column`

However the DB still accepts `null`, but this can't be expressed via the casts.

This change will make the null "sticky" and generate: `@property array|null $some_column`
2017-10-28 18:01:18 +02:00
Chris Morrell d45b02efb1 Support for ::fake() calls 2017-10-13 11:41:30 -04:00
Mariusz b0abafb8c7 Changed overwriting confirmation message
When running php artisan ide-helper:models below message was presented:
"Do you want to overwrite the existing model files? Choose no to write to _ide_helper_models.php instead? (Yes/No):  (yes/no) [no]:"
This commit changes message to:
"Do you want to overwrite the existing model files? Choose no to write to _ide_helper_models.php instead? (yes/no) [no]:"
2017-10-11 11:43:16 +01:00
Yulia Kostrikova 6b0e9ec48d Add notice about "Package Auto-Discovery" to docs 2017-09-21 00:40:49 +03:00
M. Vugteveen 28f0ac3781 also show time in generated files (#574) 2017-09-13 14:18:03 +02:00
Greg Roach 721a7cd3f7 The 'artisan optimize' command is deprecated 2017-09-02 21:25:00 +01:00
Carl Evison ea6d6d0105 update to the latest code intel (#567) 2017-09-02 17:44:59 +02:00
Subodh Dahal 01320a48e3 Bugfix: Undefined property: Barryvdh\LaravelIdeHelper\Console\MetaCommand::$config (#562) 2017-08-28 15:16:15 +02:00
Charles Peterson fedcb57295 Add an eloquent command (#544)
* Add an eloquent command for adding the `@mixin \Eloquent` to the Illuminate\Database\Eloquent\Model

* spacing updates...

* multi-line function call syntax

* Write helper mixin to Eloquent/Model after helper created

* Cleanup into helper - similar to Generator

* syntax cleanup
2017-08-28 15:12:54 +02:00
Barry vd. Heuvel ce72ff4663 Remove exit for static code analysers 2017-08-28 13:39:24 +02:00
Zakaria Acharki cb6f52f4d6 Minor typo fix (#548) 2017-08-28 13:38:22 +02:00
Chris Morrell 55c9bfc33b Allow for configurable meta filename (#553) 2017-08-28 13:37:22 +02:00
Chris Morrell a9ea231679 Support higher order tap() (#554) 2017-08-28 13:35:56 +02:00
18 changed files with 382 additions and 85 deletions
+3 -7
View File
@@ -1,10 +1,9 @@
language: php language: php
php: php:
- 5.5
- 5.6
- 7.0 - 7.0
- 7.1 - 7.1
- 7.2
# This triggers builds to run on the new TravisCI infrastructure. # This triggers builds to run on the new TravisCI infrastructure.
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/ # See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/
@@ -17,7 +16,7 @@ cache:
matrix: matrix:
include: include:
- php: 5.5 - php: 7.0
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"' env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'
before_script: before_script:
@@ -25,7 +24,4 @@ before_script:
script: script:
- vendor/bin/phpcs --standard=psr2 src/ - vendor/bin/phpcs --standard=psr2 src/
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover - vendor/bin/phpunit
after_script:
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != '7.0' ]]; then php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover; fi
+1 -1
View File
@@ -1,6 +1,6 @@
# The MIT License (MIT) # The MIT License (MIT)
Copyright (c) 2016 Barry vd. Heuvel <barryvdh@gmail.com> Copyright (c) Barry vd. Heuvel <barryvdh@gmail.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy > Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal > of this software and associated documentation files (the "Software"), to deal
+13 -11
View File
@@ -10,19 +10,20 @@
} }
], ],
"require": { "require": {
"php": ">=5.4.0", "php": ">=7",
"illuminate/support": "^5.0,<5.6", "illuminate/support": "^5.5,<5.8",
"illuminate/console": "^5.0,<5.6", "illuminate/console": "^5.5,<5.8",
"illuminate/filesystem": "^5.0,<5.6", "illuminate/filesystem": "^5.5,<5.8",
"barryvdh/reflection-docblock": "^2.0.4", "barryvdh/reflection-docblock": "^2.0.4",
"symfony/class-loader": "^2.3|^3.0" "composer/composer": "^1.6"
}, },
"require-dev": { "require-dev": {
"illuminate/config": "^5.0,<5.6", "illuminate/config": "^5.1,<5.8",
"illuminate/view": "^5.0,<5.6", "illuminate/view": "^5.1,<5.8",
"phpro/grumphp": "^0.14",
"phpunit/phpunit" : "4.*", "phpunit/phpunit" : "4.*",
"scrutinizer/ocular": "~1.1", "scrutinizer/ocular": "~1.1",
"squizlabs/php_codesniffer": "~2.3", "squizlabs/php_codesniffer": "^3",
"doctrine/dbal": "~2.3" "doctrine/dbal": "~2.3"
}, },
"suggest": { "suggest": {
@@ -35,16 +36,17 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
":vendor\\:package_name\\": "tests" "Barryvdh\\LaravelIdeHelper\\": "tests"
} }
}, },
"scripts": { "scripts": {
"test": "phpunit", "test": "phpunit",
"cs": "phpcs --standard=psr2 src/" "check-style": "phpcs -p --standard=PSR2 src/",
"fix-style": "phpcbf -p --standard=PSR2 src/"
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.3-dev" "dev-master": "2.5-dev"
}, },
"laravel": { "laravel": {
"providers": [ "providers": [
+6 -4
View File
@@ -14,6 +14,8 @@ return array(
'filename' => '_ide_helper', 'filename' => '_ide_helper',
'format' => 'php', 'format' => 'php',
'meta_filename' => '.phpstorm.meta.php',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Fluent helpers | Fluent helpers
@@ -151,13 +153,13 @@ return array(
| |
| For example, normally you would see this: | For example, normally you would see this:
| |
| * @property \Carbon\Carbon $created_at | * @property \Illuminate\Support\Carbon $created_at
| * @property \Carbon\Carbon $updated_at | * @property \Illuminate\Support\Carbon $updated_at
| |
| With this enabled, the properties will be this: | With this enabled, the properties will be this:
| |
| * @property \Carbon\Carbon $createdAt | * @property \Illuminate\Support\Carbon $createdAt
| * @property \Carbon\Carbon $updatedAt | * @property \Illuminate\Support\Carbon $updatedAt
| |
| Note, it is currently an all-or-nothing option. | Note, it is currently an all-or-nothing option.
| |
+15
View File
@@ -0,0 +1,15 @@
parameters:
git_dir: .
bin_dir: vendor/bin
tasks:
phpunit:
config_file: ~
testsuite: ~
group: []
always_execute: false
phpcs:
standard: PSR2
warning_severity: ~
ignore_patterns:
- tests/
triggered_by: [php]
+1 -8
View File
@@ -10,7 +10,7 @@
processIsolation="false" processIsolation="false"
stopOnFailure="false"> stopOnFailure="false">
<testsuites> <testsuites>
<testsuite name=":vendor Test Suite"> <testsuite name="Unit Tests">
<directory>tests</directory> <directory>tests</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
@@ -19,11 +19,4 @@
<directory suffix=".php">src/</directory> <directory suffix=".php">src/</directory>
</whitelist> </whitelist>
</filter> </filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit> </phpunit>
+7 -7
View File
@@ -22,7 +22,7 @@ If you don't want to generate it, you can add a pre-generated file to the root f
* Generated version for Lumen: https://gist.github.com/barryvdh/be17164b0ad51f832f20 * Generated version for Lumen: https://gist.github.com/barryvdh/be17164b0ad51f832f20
* Generated Phpstorm Meta file: https://gist.github.com/barryvdh/bb6ffc5d11e0a75dba67 * Generated Phpstorm Meta file: https://gist.github.com/barryvdh/bb6ffc5d11e0a75dba67
Note: You do need CodeIntel for Sublime Text: https://github.com/SublimeCodeIntel/SublimeCodeIntel Note: You do need CodeComplice for Sublime Text: https://github.com/spectacles/CodeComplice
### Install ### Install
@@ -37,6 +37,7 @@ After updating composer, add the service provider to the `providers` array in `c
```php ```php
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class, Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
``` ```
**Laravel 5.5** uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
To install this package on only development systems, add the `--dev` flag to your composer command: To install this package on only development systems, add the `--dev` flag to your composer command:
@@ -66,7 +67,7 @@ You can now re-generate the docs yourself (for future updates)
php artisan ide-helper:generate php artisan ide-helper:generate
``` ```
Note: `bootstrap/compiled.php` has to be cleared first, so run `php artisan clear-compiled` before generating (and `php artisan optimize` after). Note: `bootstrap/compiled.php` has to be cleared first, so run `php artisan clear-compiled` before generating.
You can configure your composer.json to do this after each commit: You can configure your composer.json to do this after each commit:
@@ -75,8 +76,7 @@ You can configure your composer.json to do this after each commit:
"post-update-cmd": [ "post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate", "Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan ide-helper:generate", "php artisan ide-helper:generate",
"php artisan ide-helper:meta", "php artisan ide-helper:meta"
"php artisan optimize"
] ]
}, },
``` ```
@@ -122,8 +122,8 @@ php artisan ide-helper:models Post
* @property integer $author_id * @property integer $author_id
* @property string $title * @property string $title
* @property string $text * @property string $text
* @property \Carbon\Carbon $created_at * @property \Illuminate\Support\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Illuminate\Support\Carbon $updated_at
* @property-read \User $author * @property-read \User $author
* @property-read \Illuminate\Database\Eloquent\Collection|\Comment[] $comments * @property-read \Illuminate\Database\Eloquent\Collection|\Comment[] $comments
*/ */
@@ -166,7 +166,7 @@ After publishing vendor, simply change the `include_fluent` line your `config/id
```php ```php
'include_fluent' => true, 'include_fluent' => true,
``` ```
And then run `php artisan ide-helper:generate` , you will now see all of the Fluent methods are recognized by your IDE now. And then run `php artisan ide-helper:generate` , you will now see all of the Fluent methods are recognized by your IDE.
## PhpStorm Meta for Container instances ## PhpStorm Meta for Container instances
+9 -6
View File
@@ -1,21 +1,23 @@
<?= '<?php' ?> <?= '<?php' ?>
// @formatter:off
/** /**
* A helper file for Laravel 5, to provide autocomplete information to your IDE * A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel <?= $version ?> on <?= date("Y-m-d") ?>. * Generated for Laravel <?= $version ?> on <?= date("Y-m-d H:i:s") ?>.
*
* This file should not be included in your code, only analyzed by your IDE!
* *
* @author Barry vd. Heuvel <[email protected]> * @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper * @see https://github.com/barryvdh/laravel-ide-helper
*/ */
namespace {
exit("This file should not be included, only analyzed by your IDE");
}
<?php foreach($namespaces_by_extends_ns as $namespace => $aliases): ?> <?php foreach($namespaces_by_extends_ns as $namespace => $aliases): ?>
<?php if ($namespace == '\Illuminate\Database\Eloquent'): continue; endif; ?> <?php if ($namespace == '\Illuminate\Database\Eloquent'): continue; endif; ?>
namespace <?= $namespace == '__root' ? '' : trim($namespace, '\\') ?> { namespace <?= $namespace == '__root' ? '' : trim($namespace, '\\') ?> {
<?php foreach($aliases as $alias): ?> <?php foreach($aliases as $alias): ?>
<?= trim($alias->getDocComment(' ')) ?>
<?= $alias->getClassType() ?> <?= $alias->getExtendsClass() ?> { <?= $alias->getClassType() ?> <?= $alias->getExtendsClass() ?> {
<?php foreach($alias->getMethods() as $method): ?> <?php foreach($alias->getMethods() as $method): ?>
@@ -72,7 +74,7 @@ namespace Illuminate\Support {
* @method Fluent charset(string $charset) Add the character set modifier * @method Fluent charset(string $charset) Add the character set modifier
* @method Fluent collation(string $collation) Add the collation modifier * @method Fluent collation(string $collation) Add the collation modifier
* @method Fluent comment(string $comment) Add comment * @method Fluent comment(string $comment) Add comment
* @method Fluent default(mixed $value) Add the default modifier * @method Fluent default($value) Add the default modifier
* @method Fluent first() Select first row * @method Fluent first() Select first row
* @method Fluent index(string $name = null) Add the in dex clause * @method Fluent index(string $name = null) Add the in dex clause
* @method Fluent on(string $table) `on` of a foreign key * @method Fluent on(string $table) `on` of a foreign key
@@ -80,10 +82,11 @@ namespace Illuminate\Support {
* @method Fluent onUpdate(string $action) `on update` of a foreign key * @method Fluent onUpdate(string $action) `on update` of a foreign key
* @method Fluent primary() Add the primary key modifier * @method Fluent primary() Add the primary key modifier
* @method Fluent references(string $column) `references` of a foreign key * @method Fluent references(string $column) `references` of a foreign key
* @method Fluent nullable() Add the nullable modifier * @method Fluent nullable(bool $value = true) Add the nullable modifier
* @method Fluent unique(string $name = null) Add unique index clause * @method Fluent unique(string $name = null) Add unique index clause
* @method Fluent unsigned() Add the unsigned modifier * @method Fluent unsigned() Add the unsigned modifier
* @method Fluent useCurrent() Add the default timestamp value * @method Fluent useCurrent() Add the default timestamp value
* @method Fluent change() Add the change modifier
*/ */
class Fluent {} class Fluent {}
} }
+4 -1
View File
@@ -1,10 +1,12 @@
<?= '<?php' ?> <?= '<?php' ?>
// @formatter:off
namespace PHPSTORM_META { namespace PHPSTORM_META {
/** /**
* PhpStorm Meta file, to provide autocomplete information for PhpStorm * PhpStorm Meta file, to provide autocomplete information for PhpStorm
* Generated on <?= date("Y-m-d") ?>. * Generated on <?= date("Y-m-d H:i:s") ?>.
* *
* @author Barry vd. Heuvel <[email protected]> * @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper * @see https://github.com/barryvdh/laravel-ide-helper
@@ -46,5 +48,6 @@ namespace PHPSTORM_META {
override(\head(0), elementType(0)); override(\head(0), elementType(0));
override(\last(0), elementType(0)); override(\last(0), elementType(0));
override(\with(0), type(0)); override(\with(0), type(0));
override(\tap(0), type(0));
} }
+70 -2
View File
@@ -10,6 +10,11 @@
namespace Barryvdh\LaravelIdeHelper; namespace Barryvdh\LaravelIdeHelper;
use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Context;
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
use ReflectionClass;
class Alias class Alias
{ {
protected $alias; protected $alias;
@@ -27,6 +32,7 @@ class Alias
protected $valid = false; protected $valid = false;
protected $magicMethods = array(); protected $magicMethods = array();
protected $interfaces = array(); protected $interfaces = array();
protected $phpdoc = null;
/** /**
* @param string $alias * @param string $alias
@@ -53,10 +59,17 @@ class Alias
} }
$this->addClass($this->root); $this->addClass($this->root);
$this->detectFake();
$this->detectNamespace(); $this->detectNamespace();
$this->detectClassType(); $this->detectClassType();
$this->detectExtendsNamespace(); $this->detectExtendsNamespace();
if (!empty($this->namespace)) {
//Create a DocBlock and serializer instance
$this->phpdoc = new DocBlock(new ReflectionClass($alias), new Context($this->namespace));
}
if ($facade === '\Illuminate\Database\Eloquent\Model') { if ($facade === '\Illuminate\Database\Eloquent\Model') {
$this->usedMethods = array('decrement', 'increment'); $this->usedMethods = array('decrement', 'increment');
} }
@@ -167,6 +180,30 @@ class Alias
return $this->methods; return $this->methods;
} }
/**
* Detect class returned by ::fake()
*/
protected function detectFake()
{
$facade = $this->facade;
if (!method_exists($facade, 'fake')) {
return;
}
$real = $facade::getFacadeRoot();
try {
$facade::fake();
$fake = $facade::getFacadeRoot();
if ($fake !== $real) {
$this->addClass(get_class($fake));
}
} finally {
$facade::swap($real);
}
}
/** /**
* Detect the namespace * Detect the namespace
*/ */
@@ -319,10 +356,9 @@ class Alias
$properties = $reflection->getStaticProperties(); $properties = $reflection->getStaticProperties();
$macros = isset($properties['macros']) ? $properties['macros'] : []; $macros = isset($properties['macros']) ? $properties['macros'] : [];
foreach ($macros as $macro_name => $macro_func) { foreach ($macros as $macro_name => $macro_func) {
$function = new \ReflectionFunction($macro_func);
// Add macros // Add macros
$this->methods[] = new Macro( $this->methods[] = new Macro(
$function, $this->getMacroFunction($macro_func),
$this->alias, $this->alias,
$reflection, $reflection,
$macro_name, $macro_name,
@@ -333,6 +369,38 @@ class Alias
} }
} }
/**
* @param $macro_func
*
* @return \ReflectionFunctionAbstract
* @throws \ReflectionException
*/
protected function getMacroFunction($macro_func)
{
if (is_array($macro_func) && is_callable($macro_func)) {
return new \ReflectionMethod($macro_func[0], $macro_func[1]);
}
return new \ReflectionFunction($macro_func);
}
/*
* Get the docblock for this alias
*
* @param string $prefix
* @return mixed
*/
public function getDocComment($prefix = "\t\t")
{
$serializer = new DocBlockSerializer(1, $prefix);
if ($this->phpdoc) {
return $serializer->getDocComment($this->phpdoc);
}
return '';
}
/** /**
* Output an error. * Output an error.
* *
+61
View File
@@ -0,0 +1,61 @@
<?php
/**
* Laravel IDE Helper Generator - Eloquent Model Mixin
*
* @author Charles A. Peterson <[email protected]>
* @copyright 2017 Charles A. Peterson / Fruitcake Studio (http://www.fruitcakestudio.nl)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link https://github.com/barryvdh/laravel-ide-helper
*/
namespace Barryvdh\LaravelIdeHelper\Console;
use Barryvdh\LaravelIdeHelper\Eloquent;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
/**
* A command to add \Eloquent mixin to Eloquent\Model
*
* @author Charles A. Peterson <[email protected]>
*/
class EloquentCommand extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'ide-helper:eloquent';
/**
* @var Filesystem $files
*/
protected $files;
/**
* The console command description.
*
* @var string
*/
protected $description = 'Add \Eloquent helper to \Eloquent\Model';
/**
* @param Filesystem $files
*/
public function __construct(Filesystem $files)
{
parent::__construct();
$this->files = $files;
}
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
Eloquent::writeEloquentModelHelper($this, $this->files);
}
}
+1 -1
View File
@@ -10,8 +10,8 @@
namespace Barryvdh\LaravelIdeHelper\Console; namespace Barryvdh\LaravelIdeHelper\Console;
use Barryvdh\LaravelIdeHelper\Eloquent;
use Barryvdh\LaravelIdeHelper\Generator; use Barryvdh\LaravelIdeHelper\Generator;
use Illuminate\Config\Repository as ConfigRepository;
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\InputOption;
+14 -4
View File
@@ -28,7 +28,6 @@ class MetaCommand extends Command
* @var string * @var string
*/ */
protected $name = 'ide-helper:meta'; protected $name = 'ide-helper:meta';
protected $filename = '.phpstorm.meta.php';
/** /**
* The console command description. * The console command description.
@@ -43,6 +42,9 @@ class MetaCommand extends Command
/** @var \Illuminate\Contracts\View\Factory */ /** @var \Illuminate\Contracts\View\Factory */
protected $view; protected $view;
/** @var \Illuminate\Contracts\Config */
protected $config;
protected $methods = [ protected $methods = [
'new \Illuminate\Contracts\Container\Container', 'new \Illuminate\Contracts\Container\Container',
'\Illuminate\Contracts\Container\Container::make(0)', '\Illuminate\Contracts\Container\Container::make(0)',
@@ -57,11 +59,13 @@ class MetaCommand extends Command
* *
* @param \Illuminate\Contracts\Filesystem\Filesystem $files * @param \Illuminate\Contracts\Filesystem\Filesystem $files
* @param \Illuminate\Contracts\View\Factory $view * @param \Illuminate\Contracts\View\Factory $view
* @param \Illuminate\Contracts\Config $config
*/ */
public function __construct($files, $view) public function __construct($files, $view, $config)
{ {
$this->files = $files; $this->files = $files;
$this->view = $view; $this->view = $view;
$this->config = $config;
parent::__construct(); parent::__construct();
} }
@@ -118,7 +122,11 @@ class MetaCommand extends Command
$abstracts = $this->laravel->getBindings(); $abstracts = $this->laravel->getBindings();
// Return the abstract names only // Return the abstract names only
return array_keys($abstracts); $keys = array_keys($abstracts);
sort($keys);
return $keys;
} }
/** /**
@@ -138,8 +146,10 @@ class MetaCommand extends Command
*/ */
protected function getOptions() protected function getOptions()
{ {
$filename = $this->config->get('ide-helper.meta_filename');
return array( return array(
array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the meta file', $this->filename), array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the meta file', $filename),
); );
} }
} }
+58 -11
View File
@@ -10,14 +10,15 @@
namespace Barryvdh\LaravelIdeHelper\Console; namespace Barryvdh\LaravelIdeHelper\Console;
use Composer\Autoload\ClassMapGenerator;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Filesystem\Filesystem; use Illuminate\Filesystem\Filesystem;
use ReflectionClass;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\ClassLoader\ClassMapGenerator;
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;
@@ -56,6 +57,7 @@ class ModelsCommand extends Command
protected $write = false; protected $write = false;
protected $dirs = array(); protected $dirs = array();
protected $reset; protected $reset;
protected $keep_text;
/** /**
* @var bool[string] * @var bool[string]
*/ */
@@ -86,12 +88,15 @@ class ModelsCommand extends Command
$model = $this->argument('model'); $model = $this->argument('model');
$ignore = $this->option('ignore'); $ignore = $this->option('ignore');
$this->reset = $this->option('reset'); $this->reset = $this->option('reset');
if ($this->option('smart-reset')) {
$this->keep_text = $this->reset = true;
}
$this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true); $this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true);
//If filename is default and Write is not specified, ask what to do //If filename is default and Write is not specified, ask what to do
if (!$this->write && $filename === $this->filename && !$this->option('nowrite')) { if (!$this->write && $filename === $this->filename && !$this->option('nowrite')) {
if ($this->confirm( if ($this->confirm(
"Do you want to overwrite the existing model files? Choose no to write to $filename instead? (Yes/No): " "Do you want to overwrite the existing model files? Choose no to write to $filename instead?"
) )
) { ) {
$this->write = true; $this->write = true;
@@ -136,6 +141,7 @@ class ModelsCommand extends Command
array('write', 'W', InputOption::VALUE_NONE, 'Write to Model file'), array('write', 'W', InputOption::VALUE_NONE, 'Write to Model file'),
array('nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'), array('nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'),
array('reset', 'R', InputOption::VALUE_NONE, 'Remove the original phpdocs instead of appending'), array('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'),
array('ignore', 'I', InputOption::VALUE_OPTIONAL, 'Which models to ignore', ''), array('ignore', 'I', InputOption::VALUE_OPTIONAL, 'Which models to ignore', ''),
); );
} }
@@ -145,6 +151,8 @@ class ModelsCommand extends Command
$output = "<?php $output = "<?php
// @formatter:off
/** /**
* A helper file for your Eloquent Models * A helper file for your Eloquent Models
* Copy the phpDocs from this file to the correct Model, * Copy the phpDocs from this file to the correct Model,
@@ -179,10 +187,9 @@ class ModelsCommand extends Command
if (class_exists($name)) { if (class_exists($name)) {
try { try {
// handle abstract classes, interfaces, ... // handle abstract classes, interfaces, ...
$reflectionClass = new \ReflectionClass($name); $reflectionClass = new ReflectionClass($name);
if (!$reflectionClass->isSubclassOf('Illuminate\Database\Eloquent\Model') if (!$reflectionClass->isSubclassOf('Illuminate\Database\Eloquent\Model')) {
|| $reflectionClass->isSubclassOf('Illuminate\Database\Eloquent\Relations\Pivot')) {
continue; continue;
} }
@@ -277,7 +284,7 @@ class ModelsCommand extends Command
break; break;
case 'date': case 'date':
case 'datetime': case 'datetime':
$realType = '\Carbon\Carbon'; $realType = '\Illuminate\Support\Carbon';
break; break;
case 'collection': case 'collection':
$realType = '\Illuminate\Support\Collection'; $realType = '\Illuminate\Support\Collection';
@@ -291,6 +298,10 @@ class ModelsCommand extends Command
continue; continue;
} else { } else {
$this->properties[$name]['type'] = $this->getTypeOverride($realType); $this->properties[$name]['type'] = $this->getTypeOverride($realType);
if (isset($this->nullableColumns[$name])) {
$this->properties[$name]['type'] .= '|null';
}
} }
} }
} }
@@ -337,7 +348,7 @@ class ModelsCommand extends Command
foreach ($columns as $column) { foreach ($columns as $column) {
$name = $column->getName(); $name = $column->getName();
if (in_array($name, $model->getDates())) { if (in_array($name, $model->getDates())) {
$type = '\Carbon\Carbon'; $type = '\Illuminate\Support\Carbon';
} else { } else {
$type = $column->getType()->getName(); $type = $column->getType()->getName();
switch ($type) { switch ($type) {
@@ -460,17 +471,30 @@ class ModelsCommand extends Command
'morphOne', 'morphOne',
'morphTo', 'morphTo',
'morphMany', 'morphMany',
'morphToMany' 'morphToMany',
'morphedByMany'
) as $relation) { ) as $relation) {
$search = '$this->' . $relation . '('; $search = '$this->' . $relation . '(';
if ($pos = stripos($code, $search)) { if ($pos = stripos($code, $search)) {
//Resolve the relation's model to a Relation object. //Resolve the relation's model to a Relation object.
$methodReflection = new \ReflectionMethod($model, $method);
if ($methodReflection->getNumberOfParameters()) {
return;
}
$relationObj = $model->$method(); $relationObj = $model->$method();
if ($relationObj instanceof Relation) { if ($relationObj instanceof Relation) {
$relatedModel = '\\' . get_class($relationObj->getRelated()); $relatedModel = '\\' . get_class($relationObj->getRelated());
$relations = ['hasManyThrough', 'belongsToMany', 'hasMany', 'morphMany', 'morphToMany']; $relations = [
'hasManyThrough',
'belongsToMany',
'hasMany',
'morphMany',
'morphToMany',
'morphedByMany',
];
if (in_array($relation, $relations)) { if (in_array($relation, $relations)) {
//Collection or array of models (because Collection is Arrayable) //Collection or array of models (because Collection is Arrayable)
$this->setProperty( $this->setProperty(
@@ -575,13 +599,19 @@ class ModelsCommand extends Command
protected function createPhpDocs($class) protected function createPhpDocs($class)
{ {
$reflection = new \ReflectionClass($class); $reflection = new ReflectionClass($class);
$namespace = $reflection->getNamespaceName(); $namespace = $reflection->getNamespaceName();
$classname = $reflection->getShortName(); $classname = $reflection->getShortName();
$originalDoc = $reflection->getDocComment(); $originalDoc = $reflection->getDocComment();
$keyword = $this->getClassKeyword($reflection);
if ($this->reset) { if ($this->reset) {
$phpdoc = new DocBlock('', new Context($namespace)); $phpdoc = new DocBlock('', new Context($namespace));
if ($this->keep_text) {
$phpdoc->setText(
(new DocBlock($reflection, new Context($namespace)))->getText()
);
}
} else { } else {
$phpdoc = new DocBlock($reflection, new Context($namespace)); $phpdoc = new DocBlock($reflection, new Context($namespace));
} }
@@ -661,7 +691,7 @@ class ModelsCommand extends Command
} }
} }
$output = "namespace {$namespace}{\n{$docComment}\n\tclass {$classname} extends \Eloquent {}\n}\n\n"; $output = "namespace {$namespace}{\n{$docComment}\n\t{$keyword}class {$classname} extends \Eloquent {}\n}\n\n";
return $output; return $output;
} }
@@ -764,4 +794,21 @@ class ModelsCommand extends Command
$this->setMethod('onlyTrashed', '\Illuminate\Database\Query\Builder|\\' . get_class($model), []); $this->setMethod('onlyTrashed', '\Illuminate\Database\Query\Builder|\\' . get_class($model), []);
} }
} }
/**
* @param ReflectionClass $reflection
* @return string
*/
private function getClassKeyword(ReflectionClass $reflection)
{
if ($reflection->isFinal()) {
$keyword = 'final ';
} elseif ($reflection->isAbstract()) {
$keyword = 'abstract ';
} else {
$keyword = '';
}
return $keyword;
}
} }
+78
View File
@@ -0,0 +1,78 @@
<?php
/**
* Laravel IDE Helper to add \Eloquent mixin to Eloquent\Model
*
* @author Charles A. Peterson <[email protected]>
*/
namespace Barryvdh\LaravelIdeHelper;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Context;
use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
use Barryvdh\Reflection\DocBlock\Tag;
class Eloquent
{
/**
* Write mixin helper to the Eloquent\Model
* This is needed since laravel/framework v5.4.29
*
* @param Command $command
* @param Filesystem $files
*
* @return void
*/
public static function writeEloquentModelHelper(Command $command, Filesystem $files)
{
$class = 'Illuminate\Database\Eloquent\Model';
$reflection = new \ReflectionClass($class);
$namespace = $reflection->getNamespaceName();
$originalDoc = $reflection->getDocComment();
if (!$originalDoc) {
$command->info('Unexpected no document on ' . $class);
}
$phpdoc = new DocBlock($reflection, new Context($namespace));
$mixins = $phpdoc->getTagsByName('mixin');
foreach ($mixins as $m) {
if ($m->getContent() === '\Eloquent') {
$command->info('Tag Exists: @mixin \Eloquent in ' . $class);
return;
}
}
// add the Eloquent mixin
$phpdoc->appendTag(Tag::createInstance("@mixin \\Eloquent", $phpdoc));
$serializer = new DocBlockSerializer();
$serializer->getDocComment($phpdoc);
$docComment = $serializer->getDocComment($phpdoc);
$filename = $reflection->getFileName();
if ($filename) {
$contents = $files->get($filename);
if ($contents) {
$count = 0;
$contents = str_replace($originalDoc, $docComment, $contents, $count);
if ($count > 0) {
if ($files->put($filename, $contents)) {
$command->info('Wrote @mixin \Eloquent to ' . $filename);
} else {
$command->error('File write failed to ' . $filename);
}
} else {
$command->error('Content did not change ' . $contents);
}
} else {
$command->error('No file contents found ' . $filename);
}
} else {
$command->error('Filename not found ' . $class);
}
}
}
+2 -1
View File
@@ -265,7 +265,8 @@ class Generator
'Schema' => 'Illuminate\Support\Facades\Schema', 'Schema' => 'Illuminate\Support\Facades\Schema',
'Session' => 'Illuminate\Support\Facades\Session', 'Session' => 'Illuminate\Support\Facades\Session',
'Storage' => 'Illuminate\Support\Facades\Storage', 'Storage' => 'Illuminate\Support\Facades\Storage',
//'Validator' => 'Illuminate\Support\Facades\Validator', 'Validator' => 'Illuminate\Support\Facades\Validator',
'Gate' => 'Illuminate\Support\Facades\Gate',
]; ];
$facades = array_merge($facades, $this->config->get('app.aliases', [])); $facades = array_merge($facades, $this->config->get('app.aliases', []));
+17 -4
View File
@@ -10,10 +10,11 @@
namespace Barryvdh\LaravelIdeHelper; namespace Barryvdh\LaravelIdeHelper;
use Illuminate\Support\ServiceProvider; use Barryvdh\LaravelIdeHelper\Console\EloquentCommand;
use Barryvdh\LaravelIdeHelper\Console\GeneratorCommand;
use Barryvdh\LaravelIdeHelper\Console\MetaCommand; use Barryvdh\LaravelIdeHelper\Console\MetaCommand;
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand; use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
use Barryvdh\LaravelIdeHelper\Console\GeneratorCommand; use Illuminate\Support\ServiceProvider;
use Illuminate\View\Engines\EngineResolver; use Illuminate\View\Engines\EngineResolver;
use Illuminate\View\Engines\PhpEngine; use Illuminate\View\Engines\PhpEngine;
use Illuminate\View\Factory; use Illuminate\View\Factory;
@@ -76,11 +77,23 @@ class IdeHelperServiceProvider extends ServiceProvider
$this->app->singleton( $this->app->singleton(
'command.ide-helper.meta', 'command.ide-helper.meta',
function ($app) use ($localViewFactory) { function ($app) use ($localViewFactory) {
return new MetaCommand($app['files'], $localViewFactory); return new MetaCommand($app['files'], $localViewFactory, $app['config']);
} }
); );
$this->commands('command.ide-helper.generate', 'command.ide-helper.models', 'command.ide-helper.meta'); $this->app->singleton(
'command.ide-helper.eloquent',
function ($app) use ($localViewFactory) {
return new EloquentCommand($app['files']);
}
);
$this->commands(
'command.ide-helper.generate',
'command.ide-helper.models',
'command.ide-helper.meta',
'command.ide-helper.eloquent'
);
} }
/** /**
+8 -3
View File
@@ -10,14 +10,19 @@ class Macro extends Method
/** /**
* Macro constructor. * Macro constructor.
* *
* @param \ReflectionFunction $method * @param \ReflectionFunctionAbstract $method
* @param string $alias * @param string $alias
* @param \ReflectionClass $class * @param \ReflectionClass $class
* @param null $methodName * @param null $methodName
* @param array $interfaces * @param array $interfaces
*/ */
public function __construct(\ReflectionFunction $method, $alias, $class, $methodName = null, $interfaces = array()) public function __construct(
{ \ReflectionFunctionAbstract $method,
$alias,
$class,
$methodName = null,
$interfaces = array()
) {
$this->method = $method; $this->method = $method;
$this->interfaces = $interfaces; $this->interfaces = $interfaces;
$this->name = $methodName ?: $method->name; $this->name = $methodName ?: $method->name;