dataslang /
dataslang-php
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | class DataslangApiTest extends PHPUnit_Framework_TestCase |
||
|
0 ignored issues
–
show
|
|||
| 3 | { |
||
| 4 | |||
| 5 | public function testValidate() |
||
| 6 | { |
||
| 7 | $api = new DataslangApi(); |
||
|
0 ignored issues
–
show
$api is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 8 | |||
| 9 | // $api->validate() |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 10 | |||
| 11 | // Assert |
||
| 12 | // $this->assertEquals... |
||
| 13 | } |
||
| 14 | |||
| 15 | // ... |
||
| 16 | } |
||
| 17 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.