Showing 4,939 of 4,939 total issues
The method addProperty() has 209 lines of code. Current threshold is set to 100. Avoid really long methods. Open
private function addProperty(Clazz $class, string $property_name, $default_node, UnionType $real_union_type, ?Comment\Parameter $variable, int $lineno, int $flags, ?string $doc_comment, Comment $property_comment): ?Property
{
$variable_has_literals = $variable && $variable->getUnionType()->hasLiterals();
// If something goes wrong will getting the type of
- Exclude checks
The method addConstant() has 114 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function addConstant(
CodeBase $code_base,
Context $context,
int $lineno,
string $name,
- Exclude checks
The function check_fields() has an NPath complexity of 1189728. The configured NPath complexity threshold is 200. Open
function check_fields(string $function_name, array $fields, array $signatures): void
{
$return_type = $fields[0]; // TODO: Check type
if (!is_string($return_type)) {
throw new InvalidArgumentException("Invalid return type: " . json_encode($return_type));
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method dumpClassDot() has an NPath complexity of 310. The configured NPath complexity threshold is 200. Open
private function dumpClassDot(string $title, array $graph = null): void
{
if (!$graph) {
$graph = $this->cgraph;
}
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method functionMatchesSignature() has an NPath complexity of 2160. The configured NPath complexity threshold is 200. Open
public function functionMatchesSignature(
CodeBase $code_base,
FunctionInterface $function
): float {
// TODO: Account for visibility
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getAnalyzeFunctionCallClosuresStatic() has 132 lines of code. Current threshold is set to 100. Avoid really long methods. Open
private static function getAnalyzeFunctionCallClosuresStatic(): array
{
$make_order_warner = static function (int $expected_const_pos, int $expected_variable_pos): Closure {
$expected_arg_count = 1 + (int)\max($expected_const_pos, $expected_variable_pos);
/**
- Exclude checks
The method beforeAnalyze() contains an exit expression. Open
exit(\EXIT_SUCCESS);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method compareNamedParameters() contains an exit expression. Open
exit(1);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method shouldWarnAboutImpossibleInArray() has an NPath complexity of 440. The configured NPath complexity threshold is 200. Open
private static function shouldWarnAboutImpossibleInArray(CodeBase $code_base, Context $context, array $args, ?UnionType $needle_type = null, ?UnionType $haystack_type = null): bool
{
$haystack_type = $haystack_type ?? UnionTypeVisitor::unionTypeFromNode($code_base, $context, $args[1]);
if (!$haystack_type->hasRealTypeSet()) {
return false;
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method visitClassConst() has an NPath complexity of 256. The configured NPath complexity threshold is 200. Open
public function visitClassConst(Node $node): void
{
if (!isset($node->tolerant_ast_node)) {
return;
}
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getAnalyzeFunctionCallClosuresStatic() has an NPath complexity of 1216512. The configured NPath complexity threshold is 200. Open
private static function getAnalyzeFunctionCallClosuresStatic(): array
{
/**
* @param Closure(UnionType):int $checker returns _IS_IMPOSSIBLE/_IS_REDUNDANT/_IS_REASONABLE_CONDITION
* @param string $expected_type
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method beforeAnalyze() has an NPath complexity of 360. The configured NPath complexity threshold is 200. Open
public function beforeAnalyze(CodeBase $code_base): void
{
self::addMissingNamespacesToTypes($code_base);
$code_base->eagerlyLoadAllSignatures();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method main() contains an exit expression. Open
exit(1);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method main() contains an exit expression. Open
exit(1);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method visitThrow() has an NPath complexity of 608. The configured NPath complexity threshold is 200. Open
public function visitThrow(Node $node): void
{
$code_base = $this->code_base;
$context = $this->context;
$union_type = UnionTypeVisitor::unionTypeFromNode($code_base, $context, $node->children['expr']);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method visitStaticCall() has an NPath complexity of 384. The configured NPath complexity threshold is 200. Open
public function visitStaticCall(Node $node): void
{
[$parent, $used] = $this->findNonUnaryParentNode($node);
if (!$parent) {
//fwrite(STDERR, "No parent in " . __METHOD__ . "\n");
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method warnAboutVariableGraph() has an NPath complexity of 21473. The configured NPath complexity threshold is 200. Open
private function warnAboutVariableGraph(
Node $method_node,
VariableGraph $graph,
array $issue_overrides_for_definition_ids
): void {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
Avoid using empty try-catch blocks in visitCall. Open
} catch (CodeBaseException $_) {
}
- Read upRead up
- Exclude checks
EmptyCatchBlock
Since: 2.7.0
Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.
Example
class Foo {
public function bar()
{
try {
// ...
} catch (Exception $e) {} // empty catch block
}
}
Source https://phpmd.org/rules/design.html#emptycatchblock
The method processGraph() contains an exit expression. Open
exit(\EXIT_FAILURE);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method isMatchingNamespaceUseDeclaration() has an NPath complexity of 512. The configured NPath complexity threshold is 200. Open
private static function isMatchingNamespaceUseDeclaration(
string $file_contents,
NamespaceUseDeclaration $declaration,
IssueInstance $issue_instance
): bool {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}