Showing 50 of 50 total issues
The property $final_query is not named in camelCase. Open
class Datatable
{
/**
* @var string
*/
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(string $alias, string $name, $where = '', $resolve = '', string $aliasOrderby = null)
Function calculTotaux
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function calculTotaux(): array
{
$query = clone $this->final_query;
$query->resetDQLPart('orderBy');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function processRowEditing
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function processRowEditing(object $entity, array $data): array
{
$entities = array();
foreach ($data as $field => $value) {
$property = $this->processValue($entity, $field, $value);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method processColumnIdentifier has a boolean flag argument $withAlias, which is a certain sign of a Single Responsibility Principle violation. Open
private function processColumnIdentifier(bool $withAlias = true): string
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '23', column '24'). Open
$method = (new \ReflectionClass($obj))->getMethod($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
Function setGlobalSearch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setGlobalSearch(bool $globalSearch): self
{
$this->globalSearch = $globalSearch;
if ($this->globalSearch) {
foreach ($this->columns as $column) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Whitespace found at end of line Open
);
- Exclude checks
Call to method setFirstResult
from undeclared class \Doctrine\ORM\QueryBuilder
Open
$this->final_query->setFirstResult($filters['start'] ?? 0)
- Exclude checks
Call to method resetDQLPart
from undeclared class \Doctrine\ORM\QueryBuilder
Open
$query->resetDQLPart('orderBy');
- Exclude checks
Parameter $query
has undeclared type \Doctrine\ORM\QueryBuilder
Open
private function setParameter(QueryBuilder &$query, string $data): void
- Exclude checks
Call to method getRootAliases
from undeclared class \Doctrine\ORM\QueryBuilder
Open
return $this->final_query->getRootAliases()[0].'.'.$this->identifier.($withAlias ? ' AS '.$this->nameIdentifier : '');
- Exclude checks
Call to method select
from undeclared class \Doctrine\ORM\QueryBuilder
Open
$result = $query->select('COUNT(DISTINCT '.$this->processColumnIdentifier(false).') as count')
- Exclude checks
Call to method select
from undeclared class \Doctrine\ORM\QueryBuilder
Open
$this->final_query->select($this->processColumnIdentifier());
- Exclude checks
@throws type of edit
has undeclared type \Doctrine\ORM\ORMException
Open
public function edit(array $params): array
- Exclude checks
@throws type of edit
has undeclared type \Doctrine\ORM\OptimisticLockException
Open
public function edit(array $params): array
- Exclude checks
Call to method getQuery
from undeclared class \Doctrine\ORM\QueryBuilder
Open
foreach ($this->datatable->createFinalQuery(array(
- Exclude checks
Parameter $query
has undeclared type \Doctrine\ORM\QueryBuilder
Open
public function where(QueryBuilder &$query, $data): string
- Exclude checks
Property \DoctrineDatatable\Datatable->query
has undeclared type \Doctrine\ORM\QueryBuilder
Open
protected $query;
- Exclude checks
Property \DoctrineDatatable\Column->where
has undeclared type \Doctrine\ORM\Query\Expr
Open
private $where;
- Exclude checks