php-casbin / webman-permission

🔒 An authorization library that supports access control models like ACL, RBAC, ABAC for webman plugin
https://www.workerman.net/plugin/6
Apache License 2.0
39 stars 15 forks source link

addPermissionsForUser可以使用没有加到Permission的静态方法注释里 #15

Closed lly0414 closed 1 year ago

lly0414 commented 1 year ago

能否加上, phpstrom提示方法不存在

hsluoyz commented 1 year ago

@Tinywan @leeqvip

leeqvip commented 1 year ago

@lly0414 你能提个PR不?

Tinywan commented 1 year ago

addPermissionForUser 这个方法是有的

hsluoyz commented 1 year ago

@Tinywan 那为什么phpstrom会提示方法不存在呢?

lly0414 commented 1 year ago

应该是因为我是在Permission上静态调用的

Permission::AddPermissionsForUser((string)$role->id, ...$rolePermissions);

需要在类的注释上加一下

@method static bool AddPermissionsForUser(string $user, string ...$permission)

不过不加也没啥, 就是ide老是提示调用非静态方法, 有点难受 😂

lly0414 commented 1 year ago

@lly0414 你能提个PR不?

可以 就是最近在忙 歹稍等两天

leeqvip commented 1 year ago

@Tinywan 那为什么phpstrom会提示方法不存在呢?

PHP 不是强类型语言,和 js 一样,魔法调用,ide追踪不到

lly0414 commented 1 year ago

@Tinywan @leeqvip 提了pr #16