plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Bug]: Accessor containing number does not generate all relevant helper code.

Open dmason30 opened this issue 2 years ago • 0 comments

Bug description

Not sure if you would want to handle this but I figure I should point it out anyway:

Assume you have a mode with the two accessors below (showing the two supported approaches to be thorough):

public function line1(): Attribute {
    return Attribute::get(fn () => 'line 1');
}


public function getLine2Attribute(): string {
    return  'line 2';
}

Now to access this laravel supports both of the following names:

echo $model->line1; // outputs 'line 1'
echo $model->line2; // outputs 'line 2'

echo $model->line_1; // outputs 'line 1'
echo $model->line_2; // outputs 'line 2'

However the Laravel Idea Eloquent generator only generates the following:

/*
* @property-read string $line1 attribute
* @property-read string $line2 attribute
*/

And doesn't seem to support line_1 or line_2.

Plugin version

7.2.0.231

Operating system

MacOS

dmason30 avatar Aug 07 '23 12:08 dmason30