Missing class import via use statement (line '33', column '28'). Open
static::assertTrue(((new \App\Db\Query())->from('vtiger_ws_fieldtype')->count()) > 0);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Db' in method 'testInstall'. Open
$db = \App\Db::getInstance();
- 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 '\Settings_ModuleManager_Library_Model' in method 'testDownloadLibrary'. Open
\Settings_ModuleManager_Library_Model::downloadAll();
- 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 unused local variables such as '$name'. Open
foreach (\Settings_ModuleManager_Library_Model::$libraries as $name => $lib) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Static call to undeclared method \Tests\Init\InstallTest::assertTrue
Open
static::assertTrue(((new \App\Db\Query())->from('vtiger_ws_fieldtype')->count()) > 0);
- Exclude checks
Static call to undeclared method \Tests\Init\InstallTest::assertNotNull
Open
static::assertNotNull($schema->getTableSchema('a_yf_adv_permission'));
- Exclude checks
Static call to undeclared method \Tests\Init\InstallTest::assertNotNull
Open
static::assertNotNull($schema->getTableSchema('yetiforce_updates'));
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
static::assertTrue(((new \App\Db\Query())->from('vtiger_ws_fieldtype')->count()) > 0);
- Exclude checks
Static call to undeclared method \Tests\Init\InstallTest::assertFileExists
Open
static::assertFileExists($lib['dir'] . 'version.php');
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$schema = $db->getSchema();
- Exclude checks
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- 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
$db = \App\Db::getInstance();
- 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 function testDownloadLibrary()
- 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
static::assertNotNull($schema->getTableSchema('a_yf_adv_permission'));
- 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 function testInstall()
- 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
$schema = $db->getSchema();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing database installation from SQL file.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertNotNull($schema->getTableSchema('yetiforce_updates'));
- 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
* Testing library downloads.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (\Settings_ModuleManager_Library_Model::$libraries as $name => $lib) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertTrue(((new \App\Db\Query())->from('vtiger_ws_fieldtype')->count()) > 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\Settings_ModuleManager_Library_Model::downloadAll();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::assertFileExists($lib['dir'] . 'version.php');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks