pug-php/js-phpize-phug

View on GitHub

Showing 13 of 13 total issues

Method __construct has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct(ModuleContainerInterface $container)
    {
        parent::__construct($container);

        if ($container instanceof Renderer) {
Severity: Minor
Found in src/JsPhpize/JsPhpizePhug.php - About 1 hr to fix

    Missing class import via use statement (line '114', column '23').
    Open

                throw new \InvalidArgumentException(sprintf(
    Severity: Minor
    Found in src/JsPhpize/JsPhpizePhug.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

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

        protected function getLanguageKeywordValue($value, KeywordElement $keyword, $name)
        {
            $value = trim($value, "()\"' \t\n\r\0\x0B");
    
            if (!in_array($value, $this->languages, true)) {
    Severity: Minor
    Found in src/JsPhpize/JsPhpizePhug.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 '77', column '14').
    Open

        public function handleNodeEvent(NodeEvent $event)
        {
            /* @var CommentNode $node */
            if (($node = $event->getNode()) instanceof CommentNode &&
                !$node->isVisible() &&
    Severity: Minor
    Found in src/JsPhpize/JsPhpizePhug.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 '80', column '14').
    Open

        public function handleNodeEvent(NodeEvent $event)
        {
            /* @var CommentNode $node */
            if (($node = $event->getNode()) instanceof CommentNode &&
                !$node->isVisible() &&
    Severity: Minor
    Found in src/JsPhpize/JsPhpizePhug.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 '132', column '13').
    Open

        public function handleNodeLanguageKeyword($value, KeywordElement $keyword, $name)
        {
            $value = $this->getLanguageKeywordValue($value, $keyword, $name);
    
            if ($next = $keyword->getNextSibling()) {
    Severity: Minor
    Found in src/JsPhpize/JsPhpizePhug.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

    Call to undeclared method \JsPhpize\JsPhpizePhug::getOption
    Open

            if ($this->getOption('language') === 'php') {
    Severity: Critical
    Found in src/JsPhpize/JsPhpizePhug.php by phan

    Call to undeclared method \JsPhpize\JsPhpizePhug::setOptionsRecursive
    Open

            $this->setOptionsRecursive($compiler->getOption(['module_options', 'jsphpize']));
    Severity: Critical
    Found in src/JsPhpize/JsPhpizePhug.php by phan

    Call to undeclared method \JsPhpize\JsPhpizePhug::getOption
    Open

                $next->appendChild(new KeywordElement('language', $this->getOption('language'), $keyword->getOriginNode()));
    Severity: Critical
    Found in src/JsPhpize/JsPhpizePhug.php by phan

    Possibly zero references to use statement for classlike/namespace Compiler (\Phug\Compiler)
    Open

    use Phug\Compiler;
    Severity: Minor
    Found in src/JsPhpize/JsPhpizePhug.php by phan

    Argument 1 (compiler) is \Phug\Util\ModuleContainerInterface but \JsPhpize\JsPhpizePhug::getJsPhpizeEngine() takes \Phug\CompilerInterface defined at /code/src/JsPhpize/Traits/Compilation.php:22
    Open

                        return $this->transformExpression($this->getJsPhpizeEngine($compiler), $code, $compiler->getPath());
    Severity: Minor
    Found in src/JsPhpize/JsPhpizePhug.php by phan

    Call to undeclared method \JsPhpize\JsPhpizePhug::setOptionsRecursive
    Open

            $this->setOptionsRecursive([
    Severity: Critical
    Found in src/JsPhpize/JsPhpizePhug.php by phan

    Call to undeclared method \JsPhpize\JsPhpizePhug::setOption
    Open

            $this->setOption('language', $value);
    Severity: Critical
    Found in src/JsPhpize/JsPhpizePhug.php by phan
    Severity
    Category
    Status
    Source
    Language