Missing class import via use statement (line '36', column '32'). Open
$criteria->add(new Criteria('gperm_itemid', (int)$gperm_itemid));
- 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 '32', column '39'). Open
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
- 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 '34', column '28'). Open
$criteria->add(new Criteria('gperm_name', $gperm_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 '32', column '21'). Open
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
- 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 assigning values to variables in if clauses and the like (line '40', column '10'). Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
if (isset($gperm_name)) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid unused local variables such as '$result'. Open
if (!$result = $db->query($sql)) {
- 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
The parameter $gperm_name is not named in camelCase. Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
if (isset($gperm_name)) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
- 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 parameter $gperm_modid is not named in camelCase. Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
if (isset($gperm_name)) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
- 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
Avoid variables with short names like $db. Configured minimum length is 3. Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The parameter $gperm_itemid is not named in camelCase. Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
if (isset($gperm_name)) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
- 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
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 30 and the first side effect is on line 21. Open
<?php
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
$msg[] = sprintf(_MD_APCAL_PERMADDNG, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>',
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
$msg[] = sprintf(_MD_APCAL_PERMADDNG, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>',
- Exclude checks
Line exceeds 120 characters; contains 187 characters Open
$msg[] = sprintf(_MD_APCAL_PERMADDOK, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>', '<b>' . $group_list[$group_id] . '</b>');
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
'<b>' . $group_list[$group_id] . '</b>') . ' (' . _MD_APCAL_PERMADDNGP . ')';
- Exclude checks
Line exceeds 120 characters; contains 187 characters Open
$msg[] = sprintf(_MD_APCAL_PERMADDNG, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>', '<b>' . $group_list[$group_id] . '</b>');
- Exclude checks
Line exceeds 120 characters; contains 153 characters Open
$msg[] = sprintf(_MD_APCAL_PERMADDNG, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>',
- Exclude checks
Multi-line function call not indented correctly; expected 36 spaces but found 53 Open
'<b>' . $group_list[$group_id] . '</b>') . ' (' . _MD_APCAL_PERMADDNGP . ')';
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
$msg[] = sprintf(_MD_APCAL_PERMADDNG, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>',
- Exclude checks
Closing parenthesis of a multi-line function call must be on a line by itself Open
'<b>' . $group_list[$group_id] . '</b>') . ' (' . _MD_APCAL_PERMADDNGP . ')';
- Exclude checks
The variable $gperm_name is not named in camelCase. Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
if (isset($gperm_name)) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
- 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 $gperm_modid is not named in camelCase. Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
if (isset($gperm_name)) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
- 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 $gperm_name is not named in camelCase. Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
if (isset($gperm_name)) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
- 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 $gperm_itemid is not named in camelCase. Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
if (isset($gperm_name)) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
- 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 $gperm_itemid is not named in camelCase. Open
function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
{
$criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
if (isset($gperm_name)) {
$criteria->add(new Criteria('gperm_name', $gperm_name));
- 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();
}
}