Avoid using static access to class '\App\Fields\Owner' in method 'member'. Open
$name = \App\Fields\Owner::getUserLabel((int) $id) ?: '';
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\Owner' in method 'member'. Open
$name = \App\Fields\Owner::getGroupName((int) $id) ?: '';
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\PrivilegeUtil' in method 'role'. Open
}
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Call to method getGroupName
from undeclared class \App\Fields\Owner
Open
$name = \App\Fields\Owner::getGroupName((int) $id) ?: '';
- Exclude checks
Call to method getUserLabel
from undeclared class \App\Fields\Owner
Open
$name = \App\Fields\Owner::getUserLabel((int) $id) ?: '';
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
[$type, $id] = explode(':', $member);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$type, $id] = explode(':', $member);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $member
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\PrivilegeUtil::getRoleDetail($roleId)['rolename'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case \App\PrivilegeUtil::MEMBER_TYPE_USERS:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = \App\Fields\Owner::getUserLabel((int) $id) ?: '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case \App\PrivilegeUtil::MEMBER_TYPE_ROLES:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case \App\PrivilegeUtil::MEMBER_TYPE_ROLE_AND_SUBORDINATES:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case \App\PrivilegeUtil::MEMBER_TYPE_GROUPS:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = \App\Fields\Owner::getGroupName((int) $id) ?: '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get role name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get member name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $roleId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function member(string $member): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = self::role($id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function role(string $roleId): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks