Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Model helper generation causing Intelephense to error for Eloquent accessor #150

Open
getupkid opened this issue Jan 6, 2025 · 0 comments
Assignees
Labels

Comments

@getupkid
Copy link

getupkid commented Jan 6, 2025

Extension Version

0.1.14

PHP Binary

Herd

Operating System

Windows

What happened?

So I think I've worked out that this extension generates a bunch of ide_helper files for eloquent models behind-the-scenes (as per

export const writeEloquentDocBlocks = (
)

I've found what seems to be a bug or something that's sending Intelephense into a little spin.

I created an Accessor on my Eloquent Model:

protected function source(): Attribute
    {
        return Attribute::make(
            get: fn(?string $value): ?string => ucfirst($value),
        );
    }

but then this generates the following in vendor\_laravel_ide\_model_helpers.php:

/**
     * App\Models\Enquiry
     *
     * @property-read mixed $source

which then causes the Intelephense to think that the property is read-only:
image
Cannot modify readonly property App\Models\Enquiry::$source.intelephense(P1056)

Mimimal Code Sample

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants