YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/FieldsDependency/models/ListView.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid assigning values to variables in if clauses and the like (line '23', column '7').
Open

    public function getBasicListQuery(): App\Db\Query
    {
        $query = parent::getBasicListQuery();
        if ($sourceModule = $this->get('sourceModule')) {
            $query->where(['tabid' => $sourceModule]);

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

            $query->where(['tabid' => $sourceModule]);

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Settings_FieldsDependency_ListView_Model extends Settings_Vtiger_ListView_Model

The class Settings_FieldsDependency_ListView_Model is not named in CamelCase.
Open

class Settings_FieldsDependency_ListView_Model extends Settings_Vtiger_ListView_Model
{
    /** {@inheritdoc} */
    public function getBasicListQuery(): App\Db\Query
    {

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

 * @author       Radosław Skrzypczak <r.skrzypczak@yetiforce.com>

Spaces must be used for alignment; tabs are not allowed
Open

    {

Spaces must be used for alignment; tabs are not allowed
Open

    /** {@inheritdoc} */

Spaces must be used for alignment; tabs are not allowed
Open

            $query->where(['tabid' => $sourceModule]);

Spaces must be used for alignment; tabs are not allowed
Open

    public function getBasicListQuery(): App\Db\Query

Spaces must be used for alignment; tabs are not allowed
Open

        return $query;

Spaces must be used for alignment; tabs are not allowed
Open

        $query = parent::getBasicListQuery();

Spaces must be used for alignment; tabs are not allowed
Open

    }

Spaces must be used for alignment; tabs are not allowed
Open

        }

Spaces must be used for alignment; tabs are not allowed
Open

        if ($sourceModule = $this->get('sourceModule')) {

Class name "Settings_FieldsDependency_ListView_Model" is not in camel caps format
Open

class Settings_FieldsDependency_ListView_Model extends Settings_Vtiger_ListView_Model

There are no issues that match your filters.

Category
Status