for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPSA\Analyzer\Pass\Statement;
use PhpParser\Node;
use PhpParser\Node\Stmt\For_;
use PHPSA\Analyzer\Helper\DefaultMetadataPassTrait;
use PHPSA\Analyzer\Pass;
use PHPSA\Context;
class ForLoopMultiple implements Pass\AnalyzerPassInterface
{
use DefaultMetadataPassTrait;
/**
* @param Property $prop
$prop
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @param Context $context
* @return bool
*/
public function pass($stmt, Context $context)
if ($stmt instanceof For_ && count($stmt->cond) > 1) {
$context->notice(
'for_loop_multiple',
'Number of conditions in for larger than one.Merge them using && symbol.',
$stmt
);
return true;
}
return false;
* @return array
public function getRegister()
return [
For_::class,
];
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.