tapestry-cloud/tapestry

View on GitHub
src/Modules/Generators/LoadContentGenerators.php

Summary

Maintainability
A
0 mins
Test Coverage
B
80%

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

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

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

The method __invoke() contains an exit expression.
Open

            exit(1);

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

There are no issues that match your filters.

Category
Status