rhosocial/yii2-organization

View on GitHub
OperatorTrait.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid using undefined variables such as '$behaviors' which will lead to PHP notices.
Open

            $behaviors[] = [
Severity: Minor
Found in OperatorTrait.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using undefined variables such as '$behaviors' which will lead to PHP notices.
Open

            return $behaviors;
Severity: Minor
Found in OperatorTrait.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

Source https://phpmd.org/rules/cleancode.html#undefinedvariable

Avoid using static access to class '\Yii' in method 'getOperatorLabels'.
Open

            $this->operatorAttribute => Yii::t('organization', 'Operator GUID'),
Severity: Minor
Found in OperatorTrait.php by phpmd

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 '\Yii' in method 'getOperatorLabels'.
Open

            'operator' => Yii::t('organization', 'Operator'),
Severity: Minor
Found in OperatorTrait.php by phpmd

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 parameters such as '$event'.
Open

    public function onAssignOperator($event)
Severity: Minor
Found in OperatorTrait.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

PHP keywords must be lowercase; expected "trait" but found "Trait"
Open

Trait OperatorTrait
Severity: Minor
Found in OperatorTrait.php by phpcodesniffer

There are no issues that match your filters.

Category
Status