Method analyzeFunctionLikeParam
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function analyzeFunctionLikeParam(CodeBase $code_base, FunctionInterface $method, Node $param_node): void
{
$param_type = $param_node->children['type'];
if (!$param_type instanceof Node) {
return;
Function determineShorterType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function determineShorterType(Context $context, Node $type_node): ?string
{
if ($type_node->kind !== ast\AST_NAME) {
return null;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function analyzeFunctionLikeParam
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeFunctionLikeParam(CodeBase $code_base, FunctionInterface $method, Node $param_node): void
{
$param_type = $param_node->children['type'];
if (!$param_type instanceof Node) {
return;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return $name_end;
Function analyzeFunctionLike
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function analyzeFunctionLike(CodeBase $code_base, FunctionInterface $method): void
{
$node = $method->getNode();
if (!$node) {
return;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Constant PreferNamespaceUseParamType should be defined in uppercase Open
private const PreferNamespaceUseParamType = 'PhanPluginPreferNamespaceUseParamType';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}
Source https://phpmd.org/rules/naming.html#constantnamingconventions
Constant PreferNamespaceUseReturnType should be defined in uppercase Open
private const PreferNamespaceUseReturnType = 'PhanPluginPreferNamespaceUseReturnType';
- Read upRead up
- Exclude checks
ConstantNamingConventions
Since: 0.2
Class/Interface constant names should always be defined in uppercase.
Example
class Foo {
const MY_NUM = 0; // ok
const myTest = ""; // fail
}