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\Stmt;
use PhpParser\Node;
use PhpParser\Node\Stmt\Goto_;
use PhpParser\Node\Stmt\Label;
use PHPSA\Analyzer\Pass;
use PHPSA\Context;
class GotoUsage implements Pass\AnalyzerPassInterface
{
/**
* @param $stmt
* @param Context $context
* @return bool
*/
public function pass($stmt, Context $context)
if ($stmt instanceof Label) {
$context->notice(
'goto_usage',
'Do not use labels',
$stmt
);
return true;
} elseif ($stmt instanceof Goto_) {
'Do not use goto statements',
}
return false;
* @return array
public function getRegister()
return [
Goto_::class,
Label::class,
];