Showing 38 of 38 total issues
Missing class import via use statement (line '87', column '53'). Open
$this->logger->info('Running parser: '.(new \ReflectionClass(__CLASS__))->getShortName());
- 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
Remove error control operator '@' on line 146. Open
protected function parseDocument($jsonLDDocSource)
{
$jsonLDDocSource = $this->sanitizeJsonSource($jsonLDDocSource);
// Unserialize the JSON-LD document
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Missing class import via use statement (line '66', column '53'). Open
$this->logger->info('Running parser: '.(new \ReflectionClass(__CLASS__))->getShortName());
- 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 '69', column '53'). Open
$this->logger->info('Running parser: '.(new \ReflectionClass(__CLASS__))->getShortName());
- 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 '87', column '53'). Open
$this->logger->info('Running parser: '.(new \ReflectionClass(__CLASS__))->getShortName());
- 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 '73', column '20'). Open
$dom = new \DOMDocument();
- 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 '111', column '38'). Open
$profiledName = new \stdClass();
- 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 '120', column '27'). Open
$xpath = new \DOMXPath($dom);
- 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 '98', column '22'). Open
$dom = new \DOMDocument();
- 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 '70', column '26'). Open
$exception = new \ErrorException('ERROR', 1234);
- 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 getPropertyCursor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getPropertyCursor($name): int
{
// Run through all property names
foreach ($this->names as $cursor => $iri) {
foreach ($this->aliases[strval($iri)] as $alias) {
- 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 renderItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function renderItem(ItemInterface $item)
{
$types = array_map(
function ($type) {
return '<abbr title="'.htmlspecialchars($type->profile.$type->name).'">'.
- 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
Avoid using Jkphl\Micrometa\Infrastructure\Factory\count() function in while loops. Open
while (count($args)) {
$profiledNames[] = self::consumeProfiledName($args, $profile);
}
- Read upRead up
- Exclude checks
CountInLoopExpression
Since: 2.7.0
Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.
Example
class Foo {
public function bar()
{
$array = array();
for ($i = 0; count($array); $i++) {
// ...
}
}
}
Source https://phpmd.org/rules/design.html#countinloopexpression
renderItem accesses the super-global variable $GLOBALS. Open
function renderItem(ItemInterface $item)
{
$types = array_map(
function ($type) {
return '<abbr title="'.htmlspecialchars($type->profile.$type->name).'">'.
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Line exceeds 120 characters; contains 126 characters Open
'hhvm -m server -d hhvm.server.host=%s -d hhvm.server.type=fastcgi -d hhvm.server.port=%d -d hhvm.server.source_root=%s' :
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 12 Open
$this->nameToCursor) ? $this->nameToCursor[$iriStr] : count($this->values);
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
$cursor = array_key_exists($iriStr,
- Exclude checks
Closing parenthesis of a multi-line function call must be on a line by itself Open
$this->nameToCursor) ? $this->nameToCursor[$iriStr] : count($this->values);
- Exclude checks