-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Hint model properties #2230
Hint model properties #2230
Conversation
|
Looking in to things a bit more I think that there is a fault in the application I'm working on where the wrong model has been hinted for this relation so that explains the incorrect properties that I added by mistake. I'll correct them but I'm a bit sure if you guys are just not interested in this change or have issues with the mistakes I made as a first time contributor to this project? |
Ok, I have adjusted the properties according to the migration found here: https://github.com/spatie/laravel-permission/blob/main/database/migrations/create_permission_tables.php.stub#L28 Please let me know if there are any other adjustments you would like me to make to this PR for it to be ready for merging. |
@erikn69 since you edited your comment I'm guessing that maybe you also want me to add hints to Role for this PR to be ready? Well in any case I have done so now. P.s. I'm not here for Hacktoberfest if that is what is causing the terse environment, I can sympathies as I manage a project as well where we had to deal with some less then helpful contributions. |
I am not a staff member, i only helping reviewing, I have nothing against the changes, I just want they are as complete as possible |
Ok, I saw that you where a regular contributor and didn't know how things are organized in this project. The feedback is still appreciated. |
Is it possible to avoid unnecessary * @property ?\Illuminate\Support\Carbon $created_at
* @property ?\Illuminate\Support\Carbon $updated_at |
You could do that. But I don't think they are unnecessary, you could remove all cases of <?php
/**
* @property int $id
* @property string $name
* @property string $guard_name
* @property ?\Illuminate\Support\Carbon $created_at
* @property ?\Illuminate\Support\Carbon $updated_at
*/
class Role extends \Illuminate\Database\Eloquent\Model implements \Spatie\Permission\Contracts\Role
{
} Doing so generally degrade readability imo. |
if you leave all that unnecessary and pointless space, it affects readability, look at this: laravel-permission/src/Traits/HasRoles.php Lines 65 to 69 in 2ec9bef
|
To me It's hard to distinguish what is a pipe and what is a backslash in that block, also I can't even read the name of the second parameter as it is off screen. The spaces are not pointless, they are there to align the properties to allow it to be read as a list. What is the issue with having a potentially extra import line? Calling things unnecessary and pointless is loaded language and doesn't help understanding. |
I was going to create a similar PR myself. I sometimes log the name of the permission, but need to disable
|
This would be great to have! I think currently the best workaround for those wanting to fix this locally is adding a stub file with these 'magic properties' listed. This way you don't need to add manual ignores for each line and can still automatically check for typos in your property-accessing code. |
@patinthehat what is the best way to get a review from the maintainers? |
The best way is follow preferred coding patterns for the package |
@angeljqv could you please point me to where the issue is so that I can adjust my PR? This is my first contribution to this project so I'm not familiar with it. |
@angeljqv Thanks, it was getting hard to see what was the opinion outsiders and what was the project style. I have updated the PR please let me know if anything else needs adjusting. |
Apologies for the long delay in merging. |
This is helpful for project that run static analyzers on there code, or simply like auto-completion in there IDE.