rinvex/laravel-attributes

View on GitHub

Showing 27 of 27 total issues

Avoid unused parameters such as '$model'.
Open

        static::saved(function ($model) use ($entities) {
Severity: Minor
Found in src/Models/Attribute.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

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

    public function handle(Entity $entity): void
    {
        $this->trash = $entity->getEntityAttributeValueTrash();

        // Wrap the whole process inside database transaction
Severity: Minor
Found in src/Events/EntityWasSaved.php by phpmd

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

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

    public function handle(Entity $entity): void
    {
        // We will initially check if the model is using soft deletes. If so,
        // the attribute values will remain untouched as they should sill
        // be available till the entity is truly deleted from database.
Severity: Minor
Found in src/Events/EntityWasDeleted.php by phpmd

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

TODO found
Open

            // @TODO: This is REALLY REALLY BAD DESIGN!! But can't figure out a better way for now!!
Severity: Minor
Found in src/Traits/Attributable.php by fixme

TODO found
Open

            $table->integer('entity_id')->unsigned()->nullable(); // TODO: Making this nullable for now as it breaks the basic features

TODO found
Open

                        // @TODO: because when RelationBuilder::build is called very early
Severity: Minor
Found in src/Events/EntityWasSaved.php by fixme

TODO found
Open

                            // @TODO: because when RelationBuilder::build is called very early
Severity: Minor
Found in src/Events/EntityWasSaved.php by fixme
Severity
Category
Status
Source
Language