pug-php/pug-symfony

View on GitHub
src/Pug/PugSymfonyEngine.php

Summary

Maintainability
A
0 mins
Test Coverage

The class PugSymfonyEngine has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13.
Open

class PugSymfonyEngine implements EngineInterface, InstallerInterface
{
    use Installer;
    use HelpersHandler;
    use Filters;
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpmd

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

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

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

    protected function getFileFromName(string $name, string $directory = null): string
    {
        $parts = explode(':', $name);

        if (count($parts) > 1) {
Severity: Minor
Found in src/Pug/PugSymfonyEngine.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

syntax error, unexpected 'protected' (T_PROTECTED), expecting variable (T_VARIABLE)
Open

        protected readonly KernelInterface $kernel,
Severity: Critical
Found in src/Pug/PugSymfonyEngine.php by phan

Avoid excessively long variable names like $defaultTemplateDirectory. Keep variable name length under 20.
Open

    protected $defaultTemplateDirectory;
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpmd

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

Line exceeds 120 characters; contains 122 characters
Open

        $this->userOptions = ($this->container->hasParameter('pug') ? $this->container->getParameter('pug') : null) ?: [];
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpcodesniffer

Line indented incorrectly; expected 12 spaces, found 16
Open

                static fn (string $interceptorClass) => $container->get($interceptorClass),
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly ?RequestContext $context = null,
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpcodesniffer

Space before opening parenthesis of function call prohibited
Open

        return array_unique(array_map(static fn ($path) => realpath($path) ?: $path, $paths));
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        protected readonly KernelInterface $kernel,
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpcodesniffer

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly ?RequestStack $stack = null,
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpcodesniffer

Space before opening parenthesis of function call prohibited
Open

                static fn (string $interceptorClass) => $container->get($interceptorClass),
Severity: Minor
Found in src/Pug/PugSymfonyEngine.php by phpcodesniffer

There are no issues that match your filters.

Category
Status