Avoid using undefined variables such as '$clauses' which will lead to PHP notices. Open
$objProjects = Project::QueryArray(QQ::All(), $clauses);
- 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 undefined variables such as '$clauses' which will lead to PHP notices. Open
$clauses[] = QQ::ExpandAsArray (QQN::Project()->PersonAsTeamMember);
- 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
Missing class import via use statement (line '26', column '16'). Open
$item = new QHListItem ($objProject->Name);
- Read upRead up
- Exclude checks
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
Missing class import via use statement (line '12', column '28'). Open
$this->lstProjects = new QHListControl($this);
- Read upRead up
- Exclude checks
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 using static access to class 'QQ' in method 'lstProjects_Bind'. Open
$clauses[] = QQ::ExpandAsArray (QQN::Project()->PersonAsTeamMember);
- 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 'QQ' in method 'lstProjects_Bind'. Open
$objProjects = Project::QueryArray(QQ::All(), $clauses);
- 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 'Project' in method 'lstProjects_Bind'. Open
$objProjects = Project::QueryArray(QQ::All(), $clauses);
- 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
The method Form_Create is not named in camelCase. Open
protected function Form_Create() {
// Define the ListBox, and create the first listitem as 'Select One'
$this->lstProjects = new QHListControl($this);
$this->lstProjects->SetDataBinder(array ($this, 'lstProjects_Bind'));
$this->lstProjects->UnorderedListStyle = QUnorderedListStyle::Square;
- 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 lstProjects_Bind is not named in camelCase. Open
public function lstProjects_Bind() {
$clauses[] = QQ::ExpandAsArray (QQN::Project()->PersonAsTeamMember);
$objProjects = Project::QueryArray(QQ::All(), $clauses);
foreach ($objProjects as $objProject) {
- 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() {
}
}