Showing 61 of 62 total issues
Avoid excessively long variable names like $ratingAmountStringParts. Keep variable name length under 20. Open
$ratingAmountStringParts = explode(' ', $ratingAmountString);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $stockAmountStringParts. Keep variable name length under 20. Open
$stockAmountStringParts = explode(' ', $stockAmountString);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $sellerSinceStringParts. Keep variable name length under 20. Open
$sellerSinceStringParts = explode(' ', $sellerSinceString);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Missing class import via use statement (line '55', column '23'). Open
throw new \InvalidArgumentException();
- 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 unused parameters such as '$article'. Open
public function renderArticle(Article $article): string
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$crawlVariations'. Open
public function crawlArticle(string $responseBody, bool $crawlVariations): Article
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
The method renderArticle uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new \InvalidArgumentException();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid unused parameters such as '$article'. Open
public function renderArticle(Article $article): string
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
The method extractProperties uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$properties[$propertyTitle] = $propertyValue;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Line exceeds 120 characters; contains 185 characters Open
'With this option you can control if Sesame will crawl the variations for the article too. Syntax "-cv0" to ignore variations or "--crawlVariations=1" to include them.',
- Exclude checks
Class extends undeclared class \Symfony\Component\Console\Command\Command
Open
class CrawlArticleCommand extends Command
- Exclude checks
Call to method writeln
from undeclared class \Symfony\Component\Console\Output\OutputInterface
Open
$output->writeln($exception->getMessage());
- Exclude checks
Parameter $articleCrawler
has undeclared type \Symfony\Component\DomCrawler\Crawler
(Did you mean class \Sesame\Crawler\Crawler) Open
protected function extractDescription(DomCrawler $articleCrawler): string
- Exclude checks
Call to method filter
from undeclared class \Symfony\Component\DomCrawler\Crawler
(Did you mean class \Sesame\Crawler\Crawler) Open
$descriptionHtml = $articleCrawler->filter('#j-product-description');
- Exclude checks
Parameter $articleCrawler
has undeclared type \Symfony\Component\DomCrawler\Crawler
(Did you mean class \Sesame\Crawler\Crawler) Open
protected function extractPrice(DomCrawler $articleCrawler): float
- Exclude checks
Parameter $articleCrawler
has undeclared type \Symfony\Component\DomCrawler\Crawler
(Did you mean class \Sesame\Crawler\Crawler) Open
protected function extractPriceDiscount(DomCrawler $articleCrawler): float
- Exclude checks
Parameter $input
has undeclared type \Symfony\Component\Console\Input\InputInterface
Open
protected function execute(InputInterface $input, OutputInterface $output): int
- Exclude checks
Call to method filter
from undeclared class \Symfony\Component\DomCrawler\Crawler
(Did you mean class \Sesame\Crawler\Crawler) Open
$nameHtml = $articleCrawler->filter('h1.product-name');
- Exclude checks
Call to method filter
from undeclared class \Symfony\Component\DomCrawler\Crawler
(Did you mean class \Sesame\Crawler\Crawler) Open
$sellerHtml = $articleCrawler->filter('#j-store-info-wrap .store-lnk');
- Exclude checks
Call to method filter
from undeclared class \Symfony\Component\DomCrawler\Crawler
(Did you mean class \Sesame\Crawler\Crawler) Open
$priceCurrencyHtml = $articleCrawler->filter('.p-price-content .p-symbol');
- Exclude checks