pug-php/pug-yii2

View on GitHub

Showing 30 of 30 total issues

Avoid using static access to class '\Yii' in method 'initCachePath'.
Open

        $cachePath = empty($this->cachePath) ? false : Yii::getAlias($this->cachePath);
Severity: Minor
Found in ViewRenderer.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Yii' in method 'init'.
Open

            throw new Exception(Yii::t('app', 'Pug cache path is not readable.'));
Severity: Minor
Found in ViewRenderer.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\yii\helpers\FileHelper' in method 'initCachePath'.
Open

            FileHelper::createDirectory($cachePath);
Severity: Minor
Found in ViewRenderer.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Yii' in method 'init'.
Open

            throw new Exception(Yii::t('app', 'Pug cache path is not writable.'));
Severity: Minor
Found in ViewRenderer.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Yii' in method 'init'.
Open

        $baseDir = realpath(Yii::getAlias($this->viewPath));
Severity: Minor
Found in ViewRenderer.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\Yii' in method 'render'.
Open

            $path = realpath(Yii::getAlias($this->viewPath));
Severity: Minor
Found in ViewRenderer.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Class extends undeclared class \yii\base\ViewRenderer (Did you mean class \Pug\Yii\ViewRenderer)
Open

class ViewRenderer extends YiiViewRenderer
Severity: Critical
Found in ViewRenderer.php by phan

Call to method getAlias from undeclared class \Yii
Open

        $baseDir = realpath(Yii::getAlias($this->viewPath));
Severity: Critical
Found in ViewRenderer.php by phan

Checking instanceof against undeclared class \Phug\Renderer
Open

        if ($this->pug instanceof \Tale\Pug\Renderer && !($this->pug instanceof \Phug\Renderer)) {
Severity: Critical
Found in ViewRenderer.php by phan

Class extends undeclared class \yii\base\Exception (Did you mean class \Exception or class \Pug\Yii\Exception)
Open

class Exception extends YiiException
Severity: Critical
Found in Exception.php by phan

Call to method getAlias from undeclared class \Yii
Open

        $cachePath = empty($this->cachePath) ? false : Yii::getAlias($this->cachePath);
Severity: Critical
Found in ViewRenderer.php by phan

Call to method createDirectory from undeclared class \yii\helpers\FileHelper
Open

            FileHelper::createDirectory($cachePath);
Severity: Critical
Found in ViewRenderer.php by phan

Parameter $view has undeclared type \yii\base\View
Open

    public function render($view, $file, $params)
Severity: Minor
Found in ViewRenderer.php by phan

Call to method filter from undeclared class \Pug\Pug
Open

        $this->pug->filter($name, $handler);
Severity: Critical
Found in ViewRenderer.php by phan

Rename "$cachePath" which has the same name as the field declared at line 29.
Open

        $cachePath = empty($this->cachePath) ? false : Yii::getAlias($this->cachePath);
Severity: Major
Found in ViewRenderer.php by sonar-php

Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

Noncompliant Code Example

class Foo {
  public $myField;

  public function doSomething() {
    $myField = 0;
    ...
  }
}

See

Call to method getAlias from undeclared class \Yii
Open

            $path = realpath(Yii::getAlias($this->viewPath));
Severity: Critical
Found in ViewRenderer.php by phan

Rename "$cachePath" which has the same name as the field declared at line 29.
Open

        $cachePath = $this->initCachePath();
Severity: Major
Found in ViewRenderer.php by sonar-php

Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.

Noncompliant Code Example

class Foo {
  public $myField;

  public function doSomething() {
    $myField = 0;
    ...
  }
}

See

@throws type of init has undeclared type \yii\base\Exception (Did you mean class \Exception)
Open

    public function init()
Severity: Minor
Found in ViewRenderer.php by phan

Call with 1 arg(s) to \Pug\Yii\Exception::__construct() which only takes 0 arg(s) defined at /code/Exception.php:13
Open

            throw new Exception(Yii::t('app', 'Pug cache path is not readable.'));
Severity: Info
Found in ViewRenderer.php by phan

Call to method t from undeclared class \Yii
Open

            throw new Exception(Yii::t('app', 'Pug cache path is not writable.'));
Severity: Critical
Found in ViewRenderer.php by phan
Severity
Category
Status
Source
Language