for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* User: ms
* Date: 29.08.15
* Time: 12:37
*/
namespace Mvg\Parser\Html;
use phpQuery;
use Mvg\Parser\AbstractParser;
* Class Stations
* @package Mvg\Parser\Html
class Stations extends AbstractParser {
* @param $searchTerm
public function getStationsForTerm() {
$html = $this->getHtmlResponse();
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
$stationObjects = [];
phpQuery::newDocumentHTML($html);
$html
string
object<unknown_type>|null
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$listItems = pq('li a');
foreach ($listItems as $listItem) {
$stationObject = new \stdClass();
$stationObject->name = trim(pq($listItem)->html());
$stationObjects[] = $stationObject;
}
return $stationObjects;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.