Avoid using undefined variables such as '$callee_type' which will lead to PHP notices. Open
throw new TypeError(Localization::message('TYP310', [$callee_type]));
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using static access to class '\QuackCompiler\Intl\Localization' in method 'getType'. Open
throw new TypeError(Localization::message('TYP310', [$callee_type]));
- 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 '\QuackCompiler\Intl\Localization' in method 'getType'. Open
throw new TypeError(Localization::message('TYP450', [$callee]));
- 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 unused local variables such as '$callee_type'. Open
throw new TypeError(Localization::message('TYP310', [$callee_type]));
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
TODO found Open
// TODO: TYP330 for parameter error
- Exclude checks
The parameter $parent_scope is not named in camelCase. Open
public function injectScope($parent_scope)
{
$this->scope = new Scope($parent_scope);
$this->callee->injectScope($this->scope);
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The variable $parent_scope is not named in camelCase. Open
public function injectScope($parent_scope)
{
$this->scope = new Scope($parent_scope);
$this->callee->injectScope($this->scope);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $called_with_argc is not named in camelCase. Open
public function getType()
{
// TODO: TYP330 for parameter error
$called_with_argc = count($this->arguments);
$callee = $this->callee->getType();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $callee_type is not named in camelCase. Open
public function getType()
{
// TODO: TYP330 for parameter error
$called_with_argc = count($this->arguments);
$callee = $this->callee->getType();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $called_with_argc is not named in camelCase. Open
public function getType()
{
// TODO: TYP330 for parameter error
$called_with_argc = count($this->arguments);
$callee = $this->callee->getType();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}