Avoid using undefined variables such as '$retVal' which will lead to PHP notices. Open
$retVal;
- 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 unused local variables such as '$retVal'. Open
$retVal;
- 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
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class MetaCoinSlider extends MetaSlider
- Exclude checks
The property $js_function is not named in camelCase. Open
class MetaCoinSlider extends MetaSlider
{
protected $js_function = 'coinslider';
protected $js_path = 'sliders/coinslider/coin-slider.min.js';
protected $css_path = 'sliders/coinslider/coin-slider-styles.css';
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $css_path is not named in camelCase. Open
class MetaCoinSlider extends MetaSlider
{
protected $js_function = 'coinslider';
protected $js_path = 'sliders/coinslider/coin-slider.min.js';
protected $css_path = 'sliders/coinslider/coin-slider-styles.css';
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $js_path is not named in camelCase. Open
class MetaCoinSlider extends MetaSlider
{
protected $js_function = 'coinslider';
protected $js_path = 'sliders/coinslider/coin-slider.min.js';
protected $css_path = 'sliders/coinslider/coin-slider-styles.css';
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Method name "MetaCoinSlider::get_html" is not in camel caps format Open
protected function get_html()
- Exclude checks
Method name "MetaCoinSlider::get_param" is not in camel caps format Open
protected function get_param($param)
- Exclude checks
The variable $return_value is not named in camelCase. Open
protected function get_html()
{
$return_value = "<div id='" . $this->get_identifier() . "' class='coin-slider'>";
foreach ($this->slides as $slide) {
- 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 $return_value is not named in camelCase. Open
protected function get_html()
{
$return_value = "<div id='" . $this->get_identifier() . "' class='coin-slider'>";
foreach ($this->slides as $slide) {
- 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 $return_value is not named in camelCase. Open
protected function get_html()
{
$return_value = "<div id='" . $this->get_identifier() . "' class='coin-slider'>";
foreach ($this->slides as $slide) {
- 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 $return_value is not named in camelCase. Open
protected function get_html()
{
$return_value = "<div id='" . $this->get_identifier() . "' class='coin-slider'>";
foreach ($this->slides as $slide) {
- 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 method get_param is not named in camelCase. Open
protected function get_param($param)
{
$params = [
'effect' => 'animation',
'width' => 'width',
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method get_html is not named in camelCase. Open
protected function get_html()
{
$return_value = "<div id='" . $this->get_identifier() . "' class='coin-slider'>";
foreach ($this->slides as $slide) {
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}