Missing class import via use statement (line '95', column '19'). Open
$db = new \PHPWS_DB('intern_department');
- Read upRead up
- Create a ticketCreate a ticket
- 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 '40', column '22'). Open
throw new \InvalidArgumentException('Missing department ID.');
- Read upRead up
- Create a ticketCreate a ticket
- 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 '73', column '19'). Open
$db = new \PHPWS_DB('intern_department');
- Read upRead up
- Create a ticketCreate a ticket
- 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 '\Current_User' in method 'getDepartmentsAssocForUsername'. Open
if(!\Current_User::allow('intern', 'all_departments') && !\Current_User::isDeity()){
- Read upRead up
- Create a ticketCreate a ticket
- 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 '\PHPWS_DB' in method 'getDepartmentById'. Open
$result = \PHPWS_DB::getRow($query);
- Read upRead up
- Create a ticketCreate a ticket
- 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 '\PHPWS_Error' in method 'getDepartmentById'. Open
if (\PHPWS_Error::isError($result)) {
- Read upRead up
- Create a ticketCreate a ticket
- 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 '\Current_User' in method 'getDepartmentsAssocForUsername'. Open
if(!\Current_User::allow('intern', 'all_departments') && !\Current_User::isDeity()){
- Read upRead up
- Create a ticketCreate a ticket
- 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
Call to method getRow
from undeclared class \PHPWS_DB
Open
$result = \PHPWS_DB::getRow($query);
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \Intern\DatabaseException
Open
throw new DatabaseException($result->toString());
- Create a ticketCreate a ticket
- Exclude checks
Call to method addColumn
from undeclared class \PHPWS_DB
Open
$db->addColumn('name');
- Create a ticketCreate a ticket
- Exclude checks
Call to method addJoin
from undeclared class \PHPWS_DB
Open
$db->addJoin('LEFT', 'intern_department', 'intern_admin', 'id', 'department_id');
- Create a ticketCreate a ticket
- Exclude checks
Call to method addColumn
from undeclared class \PHPWS_DB
Open
$db->addColumn('id');
- Create a ticketCreate a ticket
- Exclude checks
Call to method setIndexBy
from undeclared class \PHPWS_DB
Open
$db->setIndexBy('id');
- Create a ticketCreate a ticket
- Exclude checks
Call to method addColumn
from undeclared class \PHPWS_DB
Open
$db->addColumn('name');
- Create a ticketCreate a ticket
- Exclude checks
Call to method addOrder
from undeclared class \PHPWS_DB
Open
$db->addOrder('name');
- Create a ticketCreate a ticket
- Exclude checks
Parameter $id
has undeclared type \Intern\unknown
Open
public static function getDepartmentById($id)
- Create a ticketCreate a ticket
- Exclude checks
Call to method addColumn
from undeclared class \PHPWS_DB
Open
$db->addColumn('id');
- Create a ticketCreate a ticket
- Exclude checks
Call to method select
from undeclared class \PHPWS_DB
Open
return $db->select('col');
- Create a ticketCreate a ticket
- Exclude checks
Call to method addWhere
from undeclared class \PHPWS_DB
Open
$db->addWhere('id', $except, '=', 'OR');
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \PHPWS_DB
Open
$db = new \PHPWS_DB('intern_department');
- Create a ticketCreate a ticket
- Exclude checks
Call to method addOrder
from undeclared class \PHPWS_DB
Open
$db->addOrder('name');
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \PHPWS_DB
Open
$db = new \PHPWS_DB('intern_department');
- Create a ticketCreate a ticket
- Exclude checks
Call to method setIndexBy
from undeclared class \PHPWS_DB
Open
$db->setIndexBy('id');
- Create a ticketCreate a ticket
- Exclude checks
Call to method addWhere
from undeclared class \PHPWS_DB
Open
$db->addWhere('hidden', 0, '=', 'OR', 'grp');
- Create a ticketCreate a ticket
- Exclude checks
Call to method isDeity
from undeclared class \Current_User
Open
if(!\Current_User::allow('intern', 'all_departments') && !\Current_User::isDeity()){
- Create a ticketCreate a ticket
- Exclude checks
Call to method addWhere
from undeclared class \PHPWS_DB
Open
$db->addWhere('intern_admin.username', $username);
- Create a ticketCreate a ticket
- Exclude checks
Returning type null
but getDepartmentById()
is declared to return \Intern\Department
Open
return null;
- Create a ticketCreate a ticket
- Exclude checks
Call to method addWhere
from undeclared class \PHPWS_DB
Open
$db->addWhere('id', $includeHiddenDept, '=', 'OR', 'grp');
- Create a ticketCreate a ticket
- Exclude checks
Suspicious type \Intern\unknown
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
$query = "SELECT * FROM intern_department WHERE id = $id";
- Create a ticketCreate a ticket
- Exclude checks
Call to method allow
from undeclared class \Current_User
Open
if(!\Current_User::allow('intern', 'all_departments') && !\Current_User::isDeity()){
- Create a ticketCreate a ticket
- Exclude checks
Call to method addWhere
from undeclared class \PHPWS_DB
Open
$db->addWhere('hidden', 0, '=', 'OR');
- Create a ticketCreate a ticket
- Exclude checks
Call to method isError
from undeclared class \PHPWS_Error
Open
if (\PHPWS_Error::isError($result)) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method select
from undeclared class \PHPWS_DB
Open
$depts += $db->select('col');
- Create a ticketCreate a ticket
- Exclude checks
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = new \PHPWS_DB('intern_department');
- Read upRead up
- Create a ticketCreate a ticket
- 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
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = new \PHPWS_DB('intern_department');
- Read upRead up
- Create a ticketCreate a ticket
- 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
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function getDepartmentById($id)
- Read upRead up
- Create a ticketCreate a ticket
- 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;
}
}
}