modules/Settings/FieldsDependency/models/ListView.php
Avoid assigning values to variables in if clauses and the like (line '23', column '7'). Open
Open
public function getBasicListQuery(): App\Db\Query
{
$query = parent::getBasicListQuery();
if ($sourceModule = $this->get('sourceModule')) {
$query->where(['tabid' => $sourceModule]);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Call to undeclared method \App\Db\Query::where
Open
Open
$query->where(['tabid' => $sourceModule]);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Settings_FieldsDependency_ListView_Model extends Settings_Vtiger_ListView_Model
- Exclude checks
The class Settings_FieldsDependency_ListView_Model is not named in CamelCase. Open
Open
class Settings_FieldsDependency_ListView_Model extends Settings_Vtiger_ListView_Model
{
/** {@inheritdoc} */
public function getBasicListQuery(): App\Db\Query
{
- 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
Spaces must be used for alignment; tabs are not allowed Open
Open
* @author Radosław Skrzypczak <r.skrzypczak@yetiforce.com>
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
$query->where(['tabid' => $sourceModule]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
public function getBasicListQuery(): App\Db\Query
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
return $query;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
$query = parent::getBasicListQuery();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
Open
if ($sourceModule = $this->get('sourceModule')) {
- Exclude checks
Class name "Settings_FieldsDependency_ListView_Model" is not in camel caps format Open
Open
class Settings_FieldsDependency_ListView_Model extends Settings_Vtiger_ListView_Model
- Exclude checks