Avoid using static access to class '\Yii' in method 'init'. Open
throw new Exception(Yii::t('app', 'Pug cache path is not writable.'));
- Read upRead up
- Exclude checks
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));
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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));
- Read upRead up
- Exclude checks
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.'));
- Read upRead up
- Exclude checks
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 'initCachePath'. Open
$cachePath = empty($this->cachePath) ? false : Yii::getAlias($this->cachePath);
- Read upRead up
- Exclude checks
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
Rename "$cachePath" which has the same name as the field declared at line 29. Open
$cachePath = $this->initCachePath();
- Read upRead up
- Exclude checks
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
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
Rename "$cachePath" which has the same name as the field declared at line 29. Open
$cachePath = empty($this->cachePath) ? false : Yii::getAlias($this->cachePath);
- Read upRead up
- Exclude checks
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
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
@throws annotation of init
has suspicious class type \Pug\Yii\Exception,
which does not extend Error/Exception (Did you mean class \Exception) Open
public function init()
- Exclude checks
Checking instanceof against undeclared class \Phug\Renderer
Open
if ($this->pug instanceof \Tale\Pug\Renderer && !($this->pug instanceof \Phug\Renderer)) {
- Exclude checks
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.'));
- Exclude checks
Class extends undeclared class \yii\base\ViewRenderer
(Did you mean class \Pug\Yii\ViewRenderer) Open
class ViewRenderer extends YiiViewRenderer
- Exclude checks
Property \Pug\Yii\ViewRenderer->pug
has undeclared type \Pug\Pug
Open
public $pug;
- Exclude checks
Expected an object instance or the name of a class but saw expression with type 'Pug\\Pug'|string
Open
$this->pug = new $className(array_merge([
- Exclude checks
Call to method compile
from undeclared class \Pug\Pug
Open
$this->pug->compile(''); // Init ->files
- Exclude checks
Call to method getAlias
from undeclared class \Yii
Open
$baseDir = realpath(Yii::getAlias($this->viewPath));
- Exclude checks
@throws type of initCachePath
has undeclared type \yii\base\Exception
(Did you mean class \Exception) Open
protected function initCachePath()
- Exclude checks
Checking instanceof against undeclared class \Tale\Pug\Renderer
Open
if ($this->pug instanceof \Tale\Pug\Renderer && !($this->pug instanceof \Phug\Renderer)) {
- Exclude checks
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 writable.'));
- Exclude checks
Call to method t
from undeclared class \Yii
Open
throw new Exception(Yii::t('app', 'Pug cache path is not writable.'));
- Exclude checks
Call to method t
from undeclared class \Yii
Open
throw new Exception(Yii::t('app', 'Pug cache path is not readable.'));
- Exclude checks
Call to method filter
from undeclared class \Pug\Pug
Open
$this->pug->filter($name, $handler);
- Exclude checks
Call to method getAlias
from undeclared class \Yii
Open
$path = realpath(Yii::getAlias($this->viewPath));
- Exclude checks
Call to method createDirectory
from undeclared class \yii\helpers\FileHelper
Open
FileHelper::createDirectory($cachePath);
- Exclude checks
Parameter $view
has undeclared type \yii\base\View
Open
public function render($view, $file, $params)
- Exclude checks
Reference to static property app
from undeclared class \Yii
Open
'app' => Yii::$app,
- Exclude checks
@throws type of init
has undeclared type \yii\base\Exception
(Did you mean class \Exception) Open
public function init()
- Exclude checks
Reference to undeclared class \Pug\Pug
Open
$this->pug = new $className(array_merge([
- Exclude checks
Call to method getAlias
from undeclared class \Yii
Open
$cachePath = empty($this->cachePath) ? false : Yii::getAlias($this->cachePath);
- Exclude checks