tapestry-cloud/tapestry

View on GitHub
src/Modules/Renderers/LoadContentRenderers.php

Summary

Maintainability
A
0 mins
Test Coverage
A
91%

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

    public function __invoke(Project $project, OutputInterface $output)
    {
        if (! $contentRenderers = $this->configuration->get('content_renderers', null)) {
            $output->writeln('[!] Your project\'s content renderers are miss-configured. Doing nothing and exiting.]');
        }

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 excessively long variable names like $contentRendererFactory. Keep variable name length under 20.
Open

        $contentRendererFactory = new ContentRendererFactory();

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

There are no issues that match your filters.

Category
Status