[5.8] Enh: FactoryMakeCommand updated to generate more IDE friendly code#28188
Conversation
FactoryMakeCommand updated to generate more IDE friendly codeFactoryMakeCommand updated to generate more IDE friendly code
| @@ -1,6 +1,9 @@ | |||
| <?php | |||
|
|
|||
| /* @var $factory \Illuminate\Database\Eloquent\Factory */ | |||
There was a problem hiding this comment.
Is this correct? I think DockBlocks have to start with /** and this is just /*
There was a problem hiding this comment.
Such var description should be recognized correctly by any modern IDE. It is recognized by PHPStorm at least.
In the same time having this as PHPDoc block (e.g. `/**``) may cause problem with PHP code style fixers as they consider this to be a PHPDoc, which is not bound to function or class definition, and thus is incorrect.
|
I'll just give in on this, heh. I think it kinda harms the "tranquility" of the file having some IDE centric docblock in there but I'm just tired of fighting that battle and maybe I'm wrong anyways. 🤷♂️ |
|
Too late to comment on this, but I disagree with such additions. |


Update 'make:factory' command to generate code, which is more consistent regardless to other generators:
usestatement instead of usage fully qualified class name inline.$factoryvariable, facilitating better IDE type-hinting and static analysisWith this patch command
php artisan make:factory -m Foo FooFactorygenerates following code: