Description
Is your feature request related to a problem? Please describe.
When investigating an issue that was ultimately reported on barryvdh/laravel-ide-helper#1236 I've found that, within psalm plugin, php artisan ide-helper:models
command is run with '--reset' => true,
parameter, thus removing phpdoc blocks that are provided ie within ModelStubProvider::generateStubFile
:
$models_generator_command->run(
new ArrayInput([
'--nowrite' => true,
'--reset' => true,
]),
new NullOutput()
);
In my case class for which I'm running psalm has following declaration:
/**
* @property \App\DTO\QuoteGroup\Premium[]|null $premium
* @mixin IdeHelperQuoteGroup
*/
class QuoteGroup extends Model {
protected $casts = [
'premium' => Serializer::class . ':' . Premium::class,
];
(with Serializer::get
returning mixed
type) and as such will be generated within _ide_helper_models.php
as this:
namespace App\Models{
/**
* @property \App\DTO\QuoteGroup\Premium[]|null $premium
But within models.stubphp
, because phpdoc is ignored, it'll be generated as this:
* @property mixed|null|null $premium
Currently I don't see any other issues when operating on the $premium
parameter, but I can imagine that as soon as I'll try to access a property / method that exists on \App\DTO\QuoteGroup\Premium
I'll get a false positive about missing property / method when running analysis for mixed.
Describe the solution you'd like
$models_generator_command->run(
new ArrayInput([
'--nowrite' => true,
'--reset' => true,
]),
new NullOutput()
);
to change to:
$models_generator_command->run(
new ArrayInput([
'--nowrite' => true,
]),
new NullOutput()
);
Describe alternatives you've considered
I don't think there are any alternatives