Missing class import via use statement (line '64', column '25'). Open
$queryGenerator = new \App\QueryGenerator('ModComments');
- 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 'VTWorkflowUtils' in method 'getSettingLinks'. Open
if (VTWorkflowUtils::checkModuleWorkflow($this->getName())) {
- 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 '\Vtiger_Record_Model' in method 'deleteForRecord'. Open
$recordModel = \Vtiger_Record_Model::getInstanceById($id, $queryGenerator->getModule());
- 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 'Vtiger_Loader' in method 'getSettingLinks'. Open
Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
- 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
Saw unextractable annotation for comment '* @param <type> $parentRecord - parent record for which comment need to be added'</type>
Open
* @param <type> $parentRecord - parent record for which comment need to be added
- Exclude checks
Saw unextractable annotation for comment '* @return <array> List of Vtiger_Link_Model instances'</array>
Open
* @return <Array> List of Vtiger_Link_Model instances
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = new \App\QueryGenerator('ModComments');
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$dataReader = $queryGenerator->setFields(['id'])->setStateCondition('All')->addNativeCondition(['related_to' => $recordId])->createQuery()->createCommand()->query();
- Exclude checks
Call to method getModule
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$recordModel = \Vtiger_Record_Model::getInstanceById($id, $queryGenerator->getModule());
- Exclude checks
Saw unextractable annotation for comment '* @param <array> $linkParams'</array>
Open
* @param <Array> $linkParams
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class ModComments_Module_Model extends Vtiger_Module_Model
- Exclude checks
The class ModComments_Module_Model is not named in CamelCase. Open
class ModComments_Module_Model extends Vtiger_Module_Model
{
/**
* Function to get the Quick Links for the module.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
while ($id = $dataReader->readColumn(0)) {
- 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
* @return string Url
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($links['SIDEBARLINK']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getCreateRecordUrl() . '&parent_id=' . $parentRecord->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $links;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Array> List of Vtiger_Link_Model instances
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getSettingLinks(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (VTWorkflowUtils::checkModuleWorkflow($this->getName())) {
- 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
*/
- 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 getCreateRecordUrlWithParent($parentRecord)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param <Array> $linkParams
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param <type> $parentRecord - parent record for which comment need to be added
- 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
'linktype' => 'LISTVIEWSETTING',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- 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
$links = parent::getSideBarLinks($linkParams);
- 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 getSideBarLinks($linkParams)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the create url with parent id set.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$settingsLinks[] = [
- 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
$recordModel->delete();
- 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
'linklabel' => 'LBL_EDIT_WORKFLOWS',
- 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
while ($id = $dataReader->readColumn(0)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getInstanceById($id, $queryGenerator->getModule());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $settingsLinks;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete comments associated with record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 173 characters Open
$dataReader = $queryGenerator->setFields(['id'])->setStateCondition('All')->addNativeCondition(['related_to' => $recordId])->createQuery()->createCommand()->query();
- 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
$settingsLinks = [];
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Quick Links for the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => 'index.php?parent=Settings&module=Workflows&view=List&sourceModule=' . $this->getName(),
- 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
$queryGenerator = new \App\QueryGenerator('ModComments');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'yfi yfi-workflows-2',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function deleteForRecord(int $recordId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $queryGenerator->setFields(['id'])->setStateCondition('All')->addNativeCondition(['related_to' => $recordId])->createQuery()->createCommand()->query();
- Exclude checks
Class name "ModComments_Module_Model" is not in camel caps format Open
class ModComments_Module_Model extends Vtiger_Module_Model
- Exclude checks