plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Feature Request]: Model properties generation

Open ibrahem-kamal opened this issue 2 years ago • 9 comments

Feature Description

if its possible it would be nice to auto generate model properties like

/**
 * @property string $interval_label
 * @property string $formatted_amount
 * @property int|null $features_count
 */

ibrahem-kamal avatar May 12 '23 14:05 ibrahem-kamal

Laravel Idea generates them. main menu > Laravel > Generate Helper Code. But it generates them in internal files, so all this helper code doesn't mess with real model code...

adelf avatar May 12 '23 14:05 adelf

yea but i was talking about generating them in the model itself so other packages like larastan don't throw errors for undefined properties

maybe give an option to generate them inside the model or separated ?

ibrahem-kamal avatar May 12 '23 15:05 ibrahem-kamal

I have the same issue... Laravel Idea is awesome but I must use laravel-ide-helper to have a _ide_helper_models.php.

With this file I can configure phpstan.neon

    scanFiles:
        - _ide_helper_models.php
        - app/helpers.php

in this way larastan works fine.

I've tried to add the vendor/_laravel_idea folder to phpstan.neon

    scanDirectories:
        - vendor/_laravel_idea 

but it doesn't work at all.

makroxyz avatar Jul 14 '23 14:07 makroxyz

@adelf have you any suggestions about that? Should I continue to use laravel-ide-helper to generate a model mixin file?

makroxyz avatar Jul 18 '23 10:07 makroxyz

I have similar request. Also tried to add scan vendor/_laravel_idea but it does not work like previous user says.

Would be nice to be able to use laravel idea helper code for larastan.

cyppe avatar Mar 10 '24 14:03 cyppe

@cyppe @makroxyz @ibrahem-kamal https://phpstan.org/user-guide/discovering-symbols

scanDirectories:
          - ./vendor/_laravel_idea

from 250+ errors to 3 in a second (after hours of searching...)

RomainMazB avatar Jan 26 '25 13:01 RomainMazB

I'll add a task to propose this configuration change if the PHPstan package is added.

adelf avatar Jan 27 '25 10:01 adelf

@cyppe @makroxyz @ibrahem-kamal https://phpstan.org/user-guide/discovering-symbols

scanDirectories: - ./vendor/_laravel_idea from 250+ errors to 3 in a second (after hours of searching...)

after testing it , it still didn't help with the errors . idk if i am doing something wrong but my config file seems correct

ibrahem-kamal avatar Jan 28 '25 16:01 ibrahem-kamal

any news about this? As adding laravel idea folder did not work for me either.

cyppe avatar Mar 17 '25 08:03 cyppe